Page declaration structures in CSS

王林
Release: 2024-07-19 01:56:11
Original
923 people have browsed it

Estruturas de declaração de pagina em CSS

What is CSS

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 .

<head> 
   <link rel="stylesheet"
    href="estilos.css" />
<head/>
Copy after login

Selectors

  • Tag: searches for elements by a tag
  • ID(#): searches for elements using ID
  • Classes(.): "class" attribute
  • 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;
}
Copy after login
  • Child: All immediate child elements connected with ">". Example
ul > li{
   regra: CSS;
}
Copy after login
  • 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
Copy after login
  • Sibling General: Connects all elements that have the same parent with "~". Example:
p ~ span{
    regra: css;
}
Copy after login

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!

source:dev.to
Statement of this 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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!