CSS language notes <1>. css language notes
CSS (Cascading Style Sheets) Chinese: stacked style sheet Syntax: <style type = ""> </Style>
Instance:
<style type="text/css">a{ color:red; text-align:center; font-size:24px; }</style>Selector id Selector
The HTML Tag attribute sets the selector based on the id, and "#" is selected in CSS.
For example, <a id = "a"> a text </a>
The methods shown in the following figure are selected.
Instance:
<style type="text/css">#a{ color:red; text-align:center; font-size:24px; }</style>Class Selector
If the class selector is used, the expression is ".". Unlike the id selector, the class selector can be used in multiple HTML tags.
For example, <a class = "qqq"> a text </a>
<P class = "qqq"> text </p>
Instance:
<style type="text/css">.qqq{ color:red; text-align:center; font-size:24px; }</style>
The second method indicates the qqq element under tag.
<style type="text/css">a.qqq{ color:red; text-align:center; font-size:24px; }</style>Multi-element Selector
Instance:
<style type="text/css">a,b,c,d{ color:#FFFFFF; text-align:center; font-size:24px; }</style>Descendant element Selector
Select the li element under instance a. The child element is selected with spaces.
Instance:
<style type="text/css">.a li{ color:red; }</style>Child element Selector
The child element is the same element in the class and has a parent-child relationship. Expressed with a greater than sign
Instance:
<style type="text/css">.a > .title{ color:#FF6300 }</style>
Summary
The id is unique and the class is versatile.
To be continued .............