Css skills and compatibility issues

Source: Internet
Author: User

1css controls truncated text overflow:

. Block {display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; text-align: Left ;}

Automatic line feed

dd{white-space:normal; word-break:break-all;}

Force do not wrap

dd{white-space:nowrap;}

2 solve the problem of double ie6margin

.fl{float:left;display:inline}.fr{float:right;display:inline}

3. Adaptive height

① Add a sub-Div to the parent Div

.clear{clear:both}

② Add attributes to the CSS of the parent Div

#wrapper{ overflow:hidden; zoom:1; margin:5px auto;}

4css clear floating universal float Closure

.clearfix:after{content:”.”;display:block;height:0;clear:both;visibility:hidden;}.clearfix{display:inline-block;}*html .clearfix{height:1%;}*+html .clearfix{height:1%;}.clearfix {display:block;}

Simplified font

font:italic bold 12px/20px arial,sans-serif;

Remove the dotted border of links (including image links)

/* for IE */a,area { blr:expression(this.onFocus=this.blur()) }/* for Firefox */:focus { outline: none; } 

Align icons and text

<Span style = "vertical-align: middle;">  </span> <a style = "vertical-align: middle; "href =" "> link </>

1. Difference between CSS hack code in IE and non-ie browsers

# Divcss5 {Background: Blue;/* Non-ie background colors */Background: Red \ 9;/* IE6, IE7, and IE8 background colors */}

2. Differences between IE6, IE7, IE8, and ff css hack
[Difference]: "\ 9", "*", and 」,「*」,「_」
[Example ]:

# Divcss5 {Background: Blue;/* the Firefox background turns blue */Background: Red \ 9;/* The IE8 background turns red */* Background: black; /* change the IE7 background to black */_ Background: orange;/* change the IE6 background to orange */}

[Note]: Internet Explorer series can read "\ 9", Internet Explorer 6 and Internet Explorer 7 can read "*" (in meters), and Internet Explorer 6 can recognize "_" (bottom line ), therefore, you can write it down in order, so that the browser can correctly read and understand the CSS syntax, therefore, you can effectively distinguish ie versions from non-ie browsers (such as Firefox, opera, Google Chrome, and Safari ).

3. Differences between IE6, IE7, and Firefox (exp 1)
[Difference]: "*" and ]:「*」,「_」
[Example ]:

# Divcss5 {Background: Blue;/* the Firefox background turns blue */* Background: black;/* The IE7 background turns black */_ Background: orange; /* change the IE6 background to orange */}

[Note]: IE7 and IE6 can read "*", while IE6 can read "_" (bottom line), but IE7 cannot read 「_」, firefox (non-ie browsers) cannot identify "*" or "_" at all. Therefore, we can distinguish IE6, IE7, and Firefox through such differences.

4. Differences between IE6, IE7, and Firefox (Exp 2)
[Difference symbol ]:「*」,「! Important 」
[Example ]:

# Divcss5 {Background: Blue;/* the Firefox background turns blue */* Background: Green! Important;/* change the IE7 background to green */* Background: orange;/* change the IE6 background to orange */}

[Note]: IE7 can identify "*" and 「! Important, but IE6 can only recognize "*", but cannot recognize 「! Important. Firefox can read 「! Important ", but cannot identify" * ". Therefore, we can effectively distinguish IE6, IE7, and Firefox by using these differences.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.