CSS: Cascading style sheets (cascading style Sheets)-improve display, define styles
HTML provides div and span, just to encapsulate text data, Div is a row of data, and span is the data within the row.
- How CSS and HTML are combined:
- Use the Style property in the HTML tag: <div style= "Color:red;font:.; Size:24px;background-color:blue; " >...</div>
- Use the style tag to improve code reusability:
- <style> div{style; ...} </style>
- or <style type= "text/css" > @import url (...); </style>
- or <link rel= "stylesheet" href "... css file" type= "Text/css" >
- Selector:
- HTML Tag name selector: Specifies the label to load the style div{...} (a category of labels).
- Classes Class Property Selector: Uses the class attribute in the tag to provide the properties of the action specifically for the CSS:
- For label <div class= "haha" >...</div>, you can modify the following:
- <style type= "Text/css" >
- Div.haha{...}
- </style>
- For labels with the same class, such as <span class= "haha" >...</span>, you can also use the following statement:
- <style type= "Text/css" >
- . haha{...}
- </style>
- ID selector: Using the id attribute in the tag, such as div#qq{...}. In general, the ID attribute in an HTML tag is unique, and both CSS and JavaScript often use the id attribute.
- Extended selector:
- Association selector: The DIV contains a span tag, then it is written as: Div span{...}.
- Combo selector: Multiple choices, such as. Haha.span, #qq,. xixi{...} Multiple selections use the same style, separated by commas.
- Pseudo-Element selector: such as the four states of the hyperlink, no access, click, hover, Access, that is, link,hover,active,visited four kinds, you can use a:link{...} To specify a style for a particular type. The general declaration order is link----visited---hover active
- Text-to-Picture: Image tag #imgtxt{float:right;}, absolute layout is used.
Java Foundation--css