Home >Web Front-end >HTML Tutorial >What selectors are there in css?

What selectors are there in css?

零下一度
零下一度Original
2017-06-30 11:09:061897browse

First let’s take a look at what selectors are there? ? ?
1. Basic selector:
html tag selector: select elements through html tags.
①All html tags can be used as selectors.
②No matter how deep the tag is hidden, it will be selected.
③ Select all tags instead of a specific tag.
So what we set through the html tag selector are some common issues.
id selector:
① Any tag can have an id attribute and attribute value (because id is a global attribute). The ID name cannot be named arbitrarily.
It is case sensitive. The ID name can have numbers, letters, and underscores, but it must start with a letter.
Camel case nomenclature: small camel case nomenclature, big hump case nomenclature.
For example: testStudent (small hump) TestStudent (big hump)
②The naming of id cannot be repeated.
class selector:
① Any tag can use the class attribute (the class attribute is also a global attribute).
②The class attribute name can be repeated.
③A class attribute can have multiple class attribute values.

2: Comprehensive selector
1. Descendant selector (div p)
2. Intersection selector (div.p)
3. Union selector (div, p)
4 Child element selector (div>p)
5 Sequence selector (ul li:first-child; ul li:last-child)
6 Adjacent sibling selector (div+p)
7 Ordinary brother selector (div~p)

The above is the detailed content of What selectors are there in css?. 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