CSS is a language for styling pages in a waterfall style, used to add layouts, animations, geometric shapes, filters, counters, among other settings.
Ways to declare CSS
Inline CSS: Adds CSS using the style attribute within the HTML tags; Internal CSS: Added inside the
of the HTML page; External CSS: A file with the extension .css is created with all the rules that will be applied and this file in the HTML with the tag .
Attribute selector ([attrib]): elements with specific attributes
Universal (*): Selects all HTML elements
Combinators
Combiners combine levels of tag selectors to which settings will be applied in common.
Descendant: tags that descend from another are applied with a space between them. Example:
div span{
regra: CSS;
}
Child: All immediate child elements connected with ">". Example
ul > li{
regra: CSS;
}
Adjacent sibling: The first element that follows directly connected with "+". Example:
ul + li {
regra: CSS;
}
//Nesse caso, havendo mais que um elemento li na lista, somente o primeiro receberá a regra
Sibling General: Connects all elements that have the same parent with "~". Example:
p ~ span{
regra: css;
}
The above is the detailed content of Page declaration structures in CSS. For more information, please follow other related articles on the PHP Chinese website!
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