生活随笔
收集整理的這篇文章主要介紹了
一些常用的CSS hack代码
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
一.清零代碼:因為不同的瀏覽器,默認的初始值是不同的,用清零代碼把這些默認值高置為0是很有必要的。
body,?div,?dl,?dt,?dd,?ul,?ol,?li,?h1,?h2,?h3,?h4,?h5,?h6,?pre,?code,?form,?fieldset,?legend,?input,?button,?textarea,?p,?blockquote,?th,?td?{?margin:?0;?padding:?0;?}? 二.clearfix:如果有一個DIV作為外部容器,內部的DIV如果設置了float樣式,則外部的容器DIV因為內部沒有 clear,導致不能被撐開。可用如下代碼解決。
.clearfix:after{?????content:".";?????display:block;?????height:0;?????clear:both;?????visibility:hidden;?}??*?html?.clearfix{?????height:1%;?}? 三.ie6不支持position:fixed;的BUG;
/*?除IE6瀏覽器的通用方法?*/?.ie6fixedTL{position:fixed;left:0;top:0}?.ie6fixedBR{position:fixed;right:0;bottom:0}?/*?IE6瀏覽器的特有方法?*/?/*?修正IE6振動bug?*/?*?html,*?html?body{background-p_w_picpath:url(about:blank);background-p_w_upload:fixed}?*?html?.ie6fixedTL{position:absolute;left:expression(eval(document.documentElement.scrollLeft));top:expression(eval(document.documentElement.scrollTop))}?*?html?.ie6fixedBR{position:absolute;left:expression(eval(document.documentElement.scrollLeft+document.documentElement.clientWidth-this.offsetWidth)-(parseInt(this.currentStyle.marginLeft,10)||0)-(parseInt(this.currentStyle.marginRight,10)||0));top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight-(parseInt(this.currentStyle.marginTop,10)||0)-(parseInt(this.currentStyle.marginBottom,10)||0)))}? 四.ie6不支持max-width、max-height、min-width、min-height的BUG。
?
_width:expression((documentElement.clientWidth?<?500)???"500px"?:?"auto"?);//實現min-width?_width:expression((documentElement.clientWidth?>500)???"500px"?:?"auto"?);//實現max-width?_height:expression((documentElement.clientHeight<500)???"500px"?:"auto");//實現min-height?_height:expression((documentElement.clientHeight>500)???"500px"?:"auto");//實現max-height?
?
轉載于:https://blog.51cto.com/usual/665952
總結
以上是生活随笔為你收集整理的一些常用的CSS hack代码的全部內容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。