css公共样式

mac2022-07-05  13

建议是找到其中自己需要的,不要全盘照搬

第一种PC端公共样式:

html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td ,textarea,input { margin:0; padding:0; } address,cite,dfn,em,var, i {font-style:normal;} body {font-size: 16px; line-height: 1.5; font-family:'Microsoft Yahei','simsun','arial','tahoma'; color: #333; } table { border-collapse:collapse; border-spacing:0; } h1, h2, h3, h4, h5, h6, th { font-size: 100%; font-weight: normal; } button,input,select,textarea{font-size:100%;} fieldset,img{border:0;} a, img { -webkit-touch-callout: none } a, a:active, a:focus, a:hover, a:visited {text-decoration: none} input[type=password], input[type=text], textarea { resize: none; outline: 0; -webkit-appearance: none; white-space: pre-wrap; word-wrap: break-word; background: #fff } ul, ol { list-style: none; } :focus{ outline:none;} .clearfix{ clear: both; content: ""; display: block; overflow: hidden } .clear{clear: both;} .fl{ float: left; } .fr{float: right;}

 

第二种移动端公共样式:

 

/*reset*/html{max-width: 640px;margin:0 auto;}article,aside,dialog,footer,header,section,footer,nav,figure,menu{display:block}body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, code, form, fieldset, figure, section, legend, textarea, p, blockquote, th, td, input, select, textarea, button { margin: 0; padding: 0 }body{font:14px/1.4 "Microsoft Yahei",Arial,Helvetica,sans-serif;background-color: #fff;color:#424242;max-width: 640px;margin: 0 auto;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight: normal;}table{border-collapse:collapse;border-spacing:0}ul,ol,dd,dt,dl{list-style-type:none;}a{color:#333;text-decoration: none;-webkit-touch-callout: none;-webkit-user-select: none;}a,input,select{-webkit-tap-highlight-color: transparent;-webkit-appearance: none;-moz-appearance: none;-webkit-border-radius: 0;}

input,img{border:none;padding:0;font-size:14px;}

i,em{font-style:normal;}:focus{outline: none}

/*iphone6*/@media(min-device-width:375px)and(max-device-width:667px)and(-webkit-min-device-pixel-ratio:2){body{font-size:14.5px;}}/*iphone6plus*/@media(min-device-width:414px) and (max-device-width:736px) and (-webkit-min-device-pixel-ratio:3){body{font-size:15.5px;}}

/*原子类*/.clear { clear: both; }.clear:after { display: block; clear: both; visibility: hidden; height: 0; overflow: hidden; content: "."; }.fl { float: left; }.fr { float: right; }.mb10{margin-bottom: 10px;}.mt10{margin-top: 10px;}/*placeholder css*/::-moz-placeholder{ font-family: "Microsoft YaHei"} ::-webkit-input-placeholder{ font-family: "Microsoft YaHei"} ::-ms-input-placeholder{ font-family: "Microsoft YaHei"}

 

 第三种:当小程序里有div、p标签等,公共样式:

/*html标签默认样式*/ div,ol, p, ul,form,dd,dl, dt{display: block;} del{text-decoration: line-through;} table{ display: table } tr{ display:table-row } thead{ display:table-header-group } tbody{ display:table-row-group } tfoot{ display:table-footer-group } col{ display:table-column } colgroup{ display:table-column-group } td, th{ display: table-cell;} caption{ display: table-caption } th{font-weight: bolder; text-align: center } caption{ text-align: center } table{ border-spacing: 2px;} thead, tbody,tfoot { vertical-align:middle } td, th { vertical-align:inherit }

 

转载于:https://www.cnblogs.com/huanghuali/p/6830481.html

最新回复(0)