1. CSS: a stacked style sheet that provides more precise control over la S, fonts, colors, backgrounds, and other graphic effects.
Rules
2. The rules of the inherited style sheet can be extended from the parent to the child, for example, <B> <I> Haha </I> </B> for <I> labels, however, because <I> is in <B>, the style can be inherited from the parent <B>.
3. There are four ways to add a style sheet to a webpage:
Insert style sheet: All the style sheet information is located at the top of the HTML file, and is separated by <body>. This rule is executed once on the webpage.
Type = "text/CSS": it is set to adopt mime (multi-purpose Internet Mail Extension, an e-mail Technical Specification). After writing, the style sheet will be ignored in browsers that do not support CSS.
Comment tag <! -- And --> More importantly, you must set the type = "text/CSS" attribute in some old browsers. You cannot ignore the style sheet and continue executing the following commands, in addition, the style sheet code is displayed, which can be avoided by using annotation labels.
Link to a style sheet: link Multiple HTML files to a central style sheet file. This external style sheet file sets the rules for all your web pages. If you change the details of a style sheet file, all the pages will change accordingly.
Usage: generate a common webpage. Instead of using the <style> rule, use the <link> label in <Head>
<Title>
<LINK rel = stylesheet href = "mystyles.css" type = "text/CSS">
</Title>
</Head>
When using the Chain Sample table, there is no need to note the label. Now we want to generate an external Sample Table file named mystyles.css. The file contains the following content: H4 {color: green; font-size: 37px; font-family: Impact}
P {text-indent: 1 cm; background; yellow; font-family: courier}
You can select relative or absolute URL in the href attribute.
Input style table: similar to the link method, the difference is that the link method cannot be used with other methods, but the input method can
Add @ import url(company.css) to the annotation label in <style> );
When the implanted style sheet conflicts with the external style sheet, the content of the webpage is displayed according to the embedded style sheet.
Add a style sheet: directly add the style sheet in HTML, and in <body> <H1 style = "color: orange; font-family; Impact"> Hahahaha
4. Category reference: P. First {color: Green}
<P class = first> Haha </P>
Or generate any classification without HTML tags:. First {color: Green} and use class = first for any HTML Tag. The set text is displayed in green.
5. Call the font by name: for example, H2 {font-family: Helvetica, impact, sans-serif} first looks for the font Helvetica installed on the computer. If it is found, use it, if this font is not found, it is moved to the next font (IMPACT). If this font is not installed, it is moved to the third font (sans-serif ), the sans-serif parameter is the last parameter that can be used by the browser. It tells the browser to use any default sans-serif font.
If the name of a font is not just a word, enclose the font name in quotation marks.
6. Font Size Control: You can use font-size to control the text size infinitely, such as P {font-size: 16pt}
7. Font Style: italic: h3 {font-style: italic} bold P {font-weight: bold}. The value can be bold. The normal font value 400,900 indicates the maximum font size.
8. Text-Decoration: underline, dashes, and strikethrough. The link is not displayed as follows.
9. Font Spacing: Add a larger distance between fonts: h3 {word-Spacing: 10px}, letter spacing H3 {letter-Spacing: 10px}
10. Line Height: control the vertical distance between the two nodes: B {Line-Height: 16pt}, B {font-size: 12pt; line-height: 2} the line height here will be 24 o'clock, B <font-size: 10pt; line-Height: 140%> the line spacing here is 14 points.
11. Align text: H4 {text-align: Center} is only used for block content, left, right, center;
12. control vertical alignment: H4 {vertical-align: Top}
13. Text row shrinking: applies only to the entire content. P {text-index: 40%} is used only for the entire content. If a negative value is assigned, the starting position of the first line of the text is left away from its normal position.
14. In HTML, the background image will scroll along with the page. You can use the fixed background attribute of CSS to create a background image that does not scroll, that is, when the page is scrolling, the background image can still be fixed, such as body {background-Attachment: fixed; Background-image: url(background.gif )}
15. When an element is hidden, it still occupies the original space in the browser window. Therefore, if you enclose the text behind a hidden image, the display effect is a blank area surrounded by text. H4 {visibility: hidden}