手机
当前位置:查字典教程网 >网页设计 > Div+Css教程 >网页制作中十个最好的CSS hacks
网页制作中十个最好的CSS hacks
摘要:Ifyouarefrontendcoderyoumustknowhowimportantistomakecrossbrowses,valid...

Ifyouarefrontendcoderyoumustknowhowimportantistomakecrossbrowses,validCSSandxHTMLcode.Andalsoyoumustknowhowmuchtimewearespendinginallthosehacksandfixesforvariousbrowsers.I'vewrittenaboutsomeofthemearlieronPNGtransparencyissues,Yellowfieldsinwebform,Verticalaligndivetc..

Hereisthelistof10handpickedCSShacksandtrickswhichcanhelpyouinyourCSScodeandalsosavesometime.

1.Verticalaligndiv(垂直居中)

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

2.Min-Height(最小高度)

selector{

min-height:500px;

height:auto;!important

height:500px;

}

3.PNGtransparency(透明png)

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

4.Autoclear(自动清除)

.container:after{

content:“.”;

display:block;

height:0;

clear:both;

visibility:hidden;

}

.container{display:inline-table;}

/*HidesfromIE-mac*/

*html.container{height:1%;}

.container{display:block;}

/*EndhidefromIE-mac*/

5.ResetCSS(CSS重设)

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.ScrollingRenderIE(IE滚动条渲染)

html{

background:url(null)fixedno-repeat;

}

7.Opacity(透明度)

#transdiv{

filter:alpha(opacity=75);

-moz-opacity:.75;

opacity:.75;

}

8.PRETag(标签预格式)

pre{

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

white-space:-moz-pre-wrap!important;/*Mozilla,since1999*/

white-space:-pre-wrap;/*Opera4-6*/

white-space:-o-pre-wrap;/*Opera7*/

word-wrap:break-word;/*InternetExplorer5.5+*/

}

9.LiBackgroundRepeatIE(LI标签背景重复)

<!–[ifltIE7]>

<style>

#leftnavli{zoom:1;}/*haslayout=true*/

</style>

<![endif]–>

10.Goodtoknow(最好知道的)

@charset“UTF-8″;

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

WinIE7

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

*:first-child+htmlselector{property:value;}

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

WinIE6&MacIE

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

*htmlselector{property:value;}

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

WinIE6

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

/**/

*htmlselector{property:value;}

/**/

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

MacIE

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

/**//*/

selector{property:value;}

/**/

【网页制作中十个最好的CSS hacks】相关文章:

Div+CSS网页制作布局入门

网站制作如何用CSS控制超链接样式

修复网页在IE8下的显示兼容问题

网页排版经常用到的5个CSS

发现两个有趣的CSS3动画效果

纯CSS3制作漂亮带动画效果的主机价格表

网站制作css书写规范

最近在网页中常用的css和js酷炫动画效果

让网页中居中层css一则

学习css网页布局口诀

精品推荐
分类导航