I haven't been here for a long time. It seems very busy recently.
Paste something practical.
1. UL labels have padding values by default in Mozilla, while only margin has values in IE.
2. The same class selector can be repeated in a document, but the ID selector can only appear once. CSS definition is performed for a label using both Class and ID, if the definition is repeated, the definition of the ID selector is valid because the weight of the ID is greater than that of the class.
3. A stupid way to adjust compatibility (ie and Mozilla:
A beginner may encounter this situation: it is normal to set the attribute of the same tag to a for display in IE, and B for display in Mozilla, or two for display.
Temporary solution: select the character {property name: B! Important; attribute name:}
4. If some spacing is required between a group of labels to be nested, leave it to the margin attribute of the label located inside, rather than defining the padding of the label located outside.
5. We recommend that you use background-image instead of list-style-image for the icon in front of the Li label.
6. ie cannot tell the differences between the inheritance relationship and the parent-child relationship. All are inheritance relationships.
7. When adding a selector to your tag, do not forget to add comments to the selector in CSS. When you modify your CSS later, you will know why.
8. If you set a deep background image and a bright text effect for a label. We recommend that you set a deep background color for your tag at this time.
9. Pay attention to the order of the four states of the link: link visited hover active
10. Use background for images unrelated to content
11. Define the color abbreviation # 8899ff = # 89f
12. Table performs better in some aspects than other labels. Use it where column alignment is required.
13. <SCRIPT> the language attribute does not exist. It should be written as follows:
<SCRIPT type = "text/JavaScript">
14. The title is the title, and the text of the title is the text of the title. Sometimes the title does not need to display text, so:
15. Perfect single-pixel external box table (tests can be performed in ie5, IE6, IE7, and ff1.0.4)
Table {border-collapse: collapse ;}
TD {border: #000 solid 1px ;}
16. The negative value of margin can be used for relative positioning when the label is absolutely positioned. When the page is centered, the left: xxpx attribute is not suitable for the layer with absolute positioning. Place this layer next to a tag to be located, and then use the negative value of margin as a good method.
17. When absolute positioning is performed, you can use the margin value to locate the position relative to the position of the window. This is different from the top, left, and other attributes. The advantage of absolute positioning is that it allows other elements to ignore its existence.
18. If the text is too long, the excessive text will be displayed as ellipsis: ie5, FF is invalid, but can be hidden. IE6 is valid.
<Div style = "width: 120px; Height: 50px; Border: 1px solid blue; overflow: hidden; text-overflow: ellipsis">
<Nobr> for example, a row of text is long and cannot be displayed in a table. </nobr>
19. In IE, you can change the comment:
<! -[If! IE]> put your commentary in here... <! [Endif]->
20. How to Use CSS to call external Fonts
Syntax:
@ Font-face {font-family: Name; SRC: URL (URL); srules}
Valid value:
Name: font name. Any possible font-family attribute values
URL: Specifies the opentype font file with an absolute or relative URL.
Srules: style sheet Definition
21. How to vertically center the text in a text box in a form?
If the Row Height and height groups are ineffective in FF, you can define the upper and lower whitelists to achieve the desired effect.
22. Notes for defining the tag:
When we define a {color: red;}, it represents the four state styles of A. If we want to define the State put by a mouse at this time, we only need to define: the other three States are the styles defined in.
When defining only one A: Link, remember to define the other three States!
23. Not all styles must be abbreviated as follows:
When P {padding: 1px 2px 3px 4px} is defined in the style sheet, a style is added in the subsequent project to add 5 PX and 6 PX. We do not have to write P. style1 {padding: 5px 6px 3px 4px }. It can be written as p. style1 {padding-top: 5px; padding-Right: 6px;}, you may feel that this writing is not as good as it was before, but you have never thought about it, you have already defined the style in your writing. In addition, you do not have to look for the original value of bottom and left fill! If the previous style P changes later, the style of P. style1 you define will also change.
24. The larger the website, the more CSS styles it has. make full preparations and planning before you start, including naming rules. Page block division, internal Style Classification, and so on.
25. Several Common CSS styles:
1) Align the two ends of the text: Text-align: justify; text-justify: Inter-ideograph;
2) fixed width Chinese Character truncation: overflow: hidden; text-overflow: ellipsis; white-space: nowrap .) (Ie5 or above) FF cannot. It only hides.
3) fixed-width Chinese character (Word) lines: Table-layout: fixed; Word-break: Break-all; (ie5 or above) FF cannot.
4) <acronym Title = "Enter the text to be prompted" style = "cursor: help;"> text </acronym> move the cursor over the text to see the effect. This effect can be seen on many foreign websites, with few in China.
5) set the image to translucent :. halfalpha {background-color: #000000; filter: alpha (opacity = 50)} passed the test in IE6 and ie5, and FF failed. This is because the style is private to IE;
6) Flash transparency: Select SWF to open the originalCodeWindow, enter <Param name = "wmode" value = "Transparent"> before </Object>. The above is the code for IE.
Add a similar parameter wmode = "Transparent" to the <embed> label for Firefox"
7) When you place your mouse over an image for a webpage, the image will become brighter. You can use the image replacement technique or the following filter:
. Pictures IMG {
Filter: alpha (opacity = 45 );}
. Pictures A: hover IMG {
Filter: alpha (opacity = 90 );}