Home >Web Front-end >HTML Tutorial >HTML basic selectors

HTML basic selectors

不言
不言Original
2018-04-28 16:46:282426browse

This article introduces the basics of HTML selectors, which has certain reference value. Now I share it with you. Friends in need can refer to it

The role of selectors

You can operate various styles and attributes of html more conveniently and quickly in the style sheet

Classification

1. Tag type selector: Set styles for tags

a{
  text-decoration: none;
}

2. Contains selector

span[class=demo]{
    color:red;
}

3. Contains selector inside

p a{
    text-decoration: underline;
    font-size: 30px;
    color:#ff00ff;
}

4. Sub-object selector

body>p{
    font-size:34px;
}

5. ID selector

#content{
    border-style: solid;
}

6. Class selector

.note{
    font-size: 34px;
}
span.note1{
    font-size: 54px;
}

7. Group selector

td,p,a{
				
}

The above is the detailed content of HTML basic selectors. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:html tag classificationNext article:html tag classification