Abroad turn over 10 best CSS Hacks

Source: Internet
Author: User
Tags min reset
Author:dejan Cancarevic Come from:http://stylizedweb.com/2008/02/14/10-best-css-hacks/





from foreign websites, I would like to translate into Chinese, but look at the article is simple, if you do not understand this, I think there is no need to continue to do the front end.





If You are are front end coder You must know how important are to make cross browses, valid CSS and XHTML code. And also you must know, we are spending in all those hacks and fixes for various browsers. I ' ve written about some of them earlier on PNG transparency issues, yellow fields in Web Form, Vertical align div etc.





This is the list of hand picked CSS hacks and tricks which can help you in your CSS code and also save some time.





1. Vertical Align Div (vertically centered)





http://stylizedweb.com/2008/02/01/vertical-align-div/





2. Min-height (minimum height)





Selector {


min-height:500px;


Height:auto;!important


height:500px;


}





3. PNG transparency (transparent PNG)





http://stylizedweb.com/2007/12/30/png-transparency-issues/





4. Autoclear (auto Clear)





. container:after {


content: ".";


Display:block;


height:0;


Clear:both;


Visibility:hidden;


}


. container {display:inline-table;}


/* Hides from Ie-mac \*/


* HTML. Container {height:1%;}


. container {display:block;}


/* End Hide from Ie-mac * *





5. Reset CSS (CSS reset)





Body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,


FIELDSET,INPUT,P,BLOCKQUOTE,TH,TD {


margin:0; padding:0;


}


table {border-collapse:collapse;border-spacing:0;}


fieldset,img {border:0}


Address,caption,cite,code,dfn,em,strong,th,var {


Font-style:normal;font-weight:normal;


}


Ol,ul {list-style:none;}


caption,th {text-align:left;}


h1,h2,h3,h4,h5,h6 {font-size:100%;}


q:before,q:after {content: ";}





6. Scrolling Render ie (ie scroll bar rendering)





HTML {


background:url (null) fixed no-repeat;


}





7. Opacity (transparency)





#transdiv {


Filter:alpha (opacity=75);


-moz-opacity:.75;


opacity:.75;


}





8. Pre tag (label pre-format)





Pre {


White-space:pre-wrap; /* css-3 * *


white-space:-moz-pre-wrap!important; * Mozilla, since 1999 * *


white-space:-pre-wrap; /* Opera 4-6 */


White-space:-o-pre-wrap; /* Opera 7 */


Word-wrap:break-word; /* Internet Explorer 5.5+ */


}





9. Li Background Repeat IE (repeat of Li label background)





<!–[if lt IE 7]>


<style>


#leftnav li {zoom:1}//* haslayout=true * *


</style>


<! [endif]–>





10. Good to Know (best known)





@charset "Utf-8″;





/* ———————————————————————-


WinIE7


———————————————————————- */


*:first-child+html Selector{property:value;}





/* ———————————————————————-


WinIE6 & Mac IE


———————————————————————- */


* HTML selector{property:value;}





/* ———————————————————————-


WinIE6


———————————————————————- */


/*\*/


* HTML selector{property:value;}


/**/





/* ———————————————————————-


Macie


———————————————————————- */


/*\*//*/


Selector{property:value;}


/**/








Related Article

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.