Home >Web Front-end >HTML Tutorial >div css day four_html/css_WEB-ITnose
1. CSS features
1. Inheritance
Child elements will inherit some styles of the parent element,
because some child elements themselves have default styles.
2. Cascading
If the child element defines the same style as the parent element, it will override the style of the parent element.
2. Some tips on using CSS
1. I just want to use a special font, what should I do?
Convert it to a picture.
Chinese and English fonts. Set the order of fonts. Set the English font to the front and the Chinese font to the back.
2. If you want the text to be centered in the vertical direction, set the line-height to the height of the element, line-height (line-height) == element height.
Note: ****** The text content cannot exceed the width of the element, that is, it cannot wrap. At this time, you can solve the problem by setting the width of the element to be longer.
3.css can reset the default style of xhtml tags, such as h1 bold by default.
4. Imported style: that is, writing the style into a file and then importing it into the web page.
Note: The imported style is actually similar to the embedded style, both of which add styles to the web page.
The import style will occupy the space of the HTML file
Some browsers, the analysis will have problems, and the browser will finally read the content in @import.
3. Priority of CSS styles
1. Priority of four application methods
Inline (inline style) > Embedded (internal style) > Link Style (external style) > @import imported style
Note: When both link and imported styles are used on the same page
, then the proximity principle must be used to judge Their priority, that is, the order in which they appear
.
2.css priority:
Proximity principle (very important);
The smaller the scope, the higher the priority;
Close to modification The closer the target, the higher the priority.