CSS 公用常用

1

@charset "utf-8";

body{

font: 0.14rem/200% Helvetica/* 这段代码解析后为移动端定义字体,14号字1.8倍行距 */;

-webkit-text-size-adjust: 100%!important;/*ios使用-webkit-text-size-adjust禁止调整字体大小*/

}

html, body {

min-height: 100%;

background: #FFFFFF;

height: 100%;

-webkit-text-size-adjust: none;/*解决谷歌浏览器对字体的修改,不让谷歌浏览器对小于12号字的文字做出修改*/

}

html{

-webkit-user-select:none; /*移动端禁止选中内容*/

-webkit-touch-callout: none;

@media (min-device-width:320px) and (max-width:509px), (max-device-width:480px) and (orientation:portrait),

screen and (-webkit-min-device-pixel-ratio:1.5),only screen and (-o-device-pixel-ratio : 1.5) ,only screen and (min-device-pixel-ratio : 1.5)

/*这段话是用来识别设备像素比小于1.5的,具体就是应用在手机端,有了这段代码,手机端的CSS样式可以和PAD、电脑等大屏幕设备区别开。*/

}

img{

max-width: 100%;

border:none;

vertical-align: top;

-ms-interpolation-mode: bicubic;

/*这段话的用途是解决图片缩放的失真问题。在手机端是非常重要的,不可缺少*/

}

div {

text-align:justify; text-justify:inter-ideograph;/*文字两端对齐,不会出现标点符号把文字拖入下一行的情况。在手机端会更加美观*/

}

body,div,span,h1,h2,h3,h4,h5,h6,ul,ol,pre,form,input,textarea,th,td,select,p,dt,dl,dd,li,figure, footer, header, menu, nav,aside,article,section{

margin:0;

padding:0;

font-weight: normal;

text-indent: 0;

}

a,button,input,textarea,select{

/*ios android去除自带阴影的样式*/

background: none;

-webkit-tap-highlight-color:rgba(0,0,0,0);

outline:none;

border: 0;

-webkit-appearance:none;/*屏蔽阴影*/

}

li{

list-style:none;

vertical-align:top;

}

a{

text-decoration:none;

color: #555555;

}

a, img {

/* 禁止长按链接与图片弹出菜单 */

-webkit-touch-callout: none;

}

(古朴中用到的)

2

body{ font-size: 0.7rem; font-family:Helvetica; /* 移动端定义字体的代码 */ -webkit-text-size-adjust: 100%!important;/*ios使用-webkit-text-size-adjust禁止调整字体大小*/ }img{ border:none;-ms-interpolation-mode: bicubic; vertical-align: top;/*这段话的用途是解决图片缩放的失真问题。在手机端是非常重要的,不可缺少*/}/* hcysun */ @charset "utf-8"; /* reset */html{ -webkit-user-select:none;  -webkit-touch-callout: none font-family: Helvetica;-webkit-text-size-adjust: none;/*解决谷歌浏览器对字体的修改,不让谷歌浏览器对小于12号字的文字做出修改*/@media (min-device-width:320px) and (max-width:509px), (max-device-width:480px) and (orientation:portrait), screen and (-webkit-min-device-pixel-ratio:1.5),only screen and (-o-device-pixel-ratio : 1.5) ,only screen and (min-device-pixel-ratio : 1.5) /*这段话是用来识别设备像素比小于1.5的,具体就是应用在手机端,有了这段代码,手机端的CSS样式可以和PAD、电脑等大屏幕设备区别开。*/}body,h1,h2,h3,h4,h5,h6,p,dl,dd,ul,ol,pre,form,input,textarea,th,td,select{margin:0; padding:0; font-weight: normal;text-indent: 0;} a,button,input,textarea,select{ background: none; -webkit-tap-highlight-color:rgba(255,0,0,0);  outline:none;  -webkit-appearance:none;  } li{list-style:none;vertical-align:top;} a{ text-decoration:none; } a,input{    -webkit-appearance: none;/*屏蔽阴影*/    -webkit-tap-highlight-color:rgba(0,0,0,0);    /*ios android去除自带阴影的样式*/  }table{ border-collapse:collapse;}textarea{resize:none;overflow:auto;}a, img {    /* 禁止长按链接与图片弹出菜单 */    -webkit-touch-callout: none;    }.noWrapEllipsis{ white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}var w=window.innerWidth

|| document.documentElement.clientWidth

|| document.body.clientWidth;

var h=window.innerHeight

|| document.documentElement.clientHeight

|| document.body.clientHeight;

document.getElementById("footer").style.width=w + "px";CSS初始化示例代码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; }body { background:#fff; color:#555; font-size:14px; font-family: Verdana, Arial, Helvetica, sans-serif; }td,th,caption { font-size:14px; }h1, h2, h3, h4, h5, h6 { font-weight:normal; font-size:100%; }address, caption, cite, code, dfn, em, strong, th, var { font-style:normal; font-weight:normal;}a { color:#555; text-decoration:none; }a:hover { text-decoration:underline; }img { border:none; }ol,ul,li { list-style:none; }input, textarea, select, button { font:14px Verdana,Helvetica,Arial,sans-serif; }table { border-collapse:collapse; }html {overflow-y: scroll;} /* css common */.clearfix:after {content: "."; display: block; height:0; clear:both; visibility: hidden;}.clearfix { *zoom:1; }

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 1、垂直对齐 如果你用CSS,则你会有困惑:我该怎么垂直对齐容器中的元素?现在,利用CSS3的Transform,...
    kiddings阅读 3,202评论 0 11
  • AMD 和 CMD 的区别有哪些?AMD 是 RequireJS 在推广过程中对模块定义的规范化产出。CMD 是 ...
    竿牍阅读 720评论 0 1
  • 选择qi:是表达式 标签选择器 类选择器 属性选择器 继承属性: color,font,text-align,li...
    love2013阅读 2,337评论 0 11
  • 差异:社会大环境的变化给销售模式带来新的模式,无论哪种销售模式,中心思想都是为了把产品销售出去。。 从事销售行业近...
    翻滚吧海阔天空阅读 488评论 0 1
  • 不要玻璃心,别怕跌倒,要brave
    一望无际的风声阅读 141评论 0 0