日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 前端技术 > CSS >内容正文

CSS

一些常用的CSS hack代码

發(fā)布時(shí)間:2024/4/14 CSS 40 豆豆
生活随笔 收集整理的這篇文章主要介紹了 一些常用的CSS hack代码 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

一.清零代碼:因?yàn)椴煌臑g覽器,默認(rèn)的初始值是不同的,用清零代碼把這些默認(rèn)值高置為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:如果有一個(gè)DIV作為外部容器,內(nèi)部的DIV如果設(shè)置了float樣式,則外部的容器DIV因?yàn)閮?nèi)部沒(méi)有 clear,導(dǎo)致不能被撐開(kāi)。可用如下代碼解決。

  • .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振動(dòng)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"?);//實(shí)現(xiàn)min-width?
  • _width:expression((documentElement.clientWidth?>500)???"500px"?:?"auto"?);//實(shí)現(xiàn)max-width?
  • _height:expression((documentElement.clientHeight<500)???"500px"?:"auto");//實(shí)現(xiàn)min-height?
  • _height:expression((documentElement.clientHeight>500)???"500px"?:"auto");//實(shí)現(xiàn)max-height?

  • ?

    轉(zhuǎn)載于:https://blog.51cto.com/usual/665952

    總結(jié)

    以上是生活随笔為你收集整理的一些常用的CSS hack代码的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

    如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。