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; }

你可能感兴趣的:(CSS 公用常用)