正常的项目当中,应当有一个common.css,就是把一些常用的样式,写入其中。

然后再结合一些特性的css,构造漂亮的页面。

下面欣赏一些海盗商城的common.css。

/***样式初始化***/

html {
margin: 0;
padding: 0;
border: 0;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, code, del, dfn, em, q, dl, dt, dd, ol, ul, li, input, fieldset, form, legend, caption, tbody, tfoot, thead, article, aside, dialog, figure, footer, header, hgroup, nav, section {
margin: 0;
padding: 0;
border: 0;
font-size: 14px;
font: inherit;
vertical-align: baseline;
}
article, aside, details, figcaption, figure, dialog, footer, header, hgroup, menu, nav, section {
display: block;
}
body {
font-size: 12px;
color: #333;
background: #fff;
font-family: "Microsoft YaHei", "simsun", "Helvetica Neue", Arial, Helvetica, sans-serif;
}
img {
border: 0;
}
::-webkit-input-placeholder {
color: #999;
}
:-moz-placeholder {
color: #999;
}
::-moz-placeholder {
color: #999;
}
:-ms-input-placeholder {
color: #ccc;
}
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
*:before, *:after {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
button::-moz-focus-inner, input::-moz-focus-inner {
padding: 0;
border: 0;
}
textarea {
overflow: auto;
} /*a{text-decoration: none;}*/ b, strong {
font-weight: bold;
}
input:focus, textarea:focus, button:focus, select:focus {
outline: none;
}
input::-ms-clear {
display: none;
}
button[disabled], html input[disabled] {
cursor: default;
}
table {
border-collapse: collapse;
border-spacing: 0;
} /*清除浮动*/ .clearfix:after {
visibility: hidden;
display: block;
font-size: 0;
content: " ";
clear: both;
height: 0;
}
.clear {
clear: both;
} /***样式初始化 END***/ /***float***/ .fl {
float: left !important;
}
.fr {
float: right !important;
} /***隐藏与显示***/ .show {
display: block !important;
}
.hidden {
display: none !important;
}
.visible-hidden {
visibility: hidden;
}
.over-initial {
overflow: initial !important;
} /***动画过渡时间***/ .transition-0-3s {
transition: all 0.3s;
}
.transition-0-5s {
transition: all 0.5s;
}
.transition-0-8s {
transition: all 0.8s;
}
.transition-1-0s {
transition: all 1s;
}
.transition-1-5s {
transition: all 1.5s;
}
.transition-2-0s {
transition: all 2s;
}
.no-transition {
transition: none !important;
} /***文本类容***/ /*标题*/ h1, .h1 {
font-size: 28px;
}
h2, .h2 {
font-size: 24px;
}
h3, .h3 {
font-size: 18px;
}
h4, .h4 {
font-size: 16px;
}
h5, .h5 {
font-size: 14px;
}
h6, .h6 {
font-size: 12px;
}
h1 small, .h1 small, h2 small, .h2 small, h3 small, .h3 small {
font-size: 60%;
filter: alpha(opacity=60);
opacity: .6;
}
h4 small, .h4 small, h5 small, .h5 small, h6 small, .h6 small {
font-size: 12px;
filter: alpha(opacity=60);
opacity: .6;
} /*自定义链接颜色(可自由更换)*/ a {
color: #333;
text-decoration: none;
} /*链接-颜色*/ a:hover {
color: #1380cb;
} /*链接-悬浮颜色*/ .text-underline:hover {
text-decoration: underline;
} /*段落*/ p, .p {
line-height: 25px;
}
.text-indent, .text-indent p, .text-indent div {
text-indent: 2em;
} /*粗体*/ .strong {
font-weight: bold;
}
.text-normal {
font-weight: normal;
} /*对齐*/ .text-left {
text-align: left !important;
}
.text-center {
text-align: center !important;
}
.text-right {
text-align: right !important;
}
.text-justify {
text-align: justify !important;
} /*文本省略*/ .text-ellipsis {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.no-ellipsis {
overflow: auto;
text-overflow: initial;
white-space: normal;
} /*字号*/ .text-large {
font-size: 24px !important;
}
.text-big {
font-size: 16px !important;
}
.text-default {
font-size: 14px !important;
}
.text-small {
font-size: 12px !important;
}
.text-little {
font-size: 10px !important;
} /*字体颜色*/ .text-main {
color: #2a95de;
} /*主色*/ .text-sub {
color: #1380cb;
} /*辅色*/ .text-dot {
color: #ff5a00;
} /*点缀色*/ .text-mix {
color: #d93600;
} /*融合色*/ .text-white {
color: #fff;
} /*白色*/ .text-black {
color: #000;
} /*黑色*/ .text-gray {
color: #999;
} /*浅灰色*/ .text-drak-grey {
color: #3a3a3a;
} /*深灰色*/ .text-red {
color: #b10;
}
.text-orange {
color: #f60;
}
.text-blue {
color: #0ae;
}
.text-green {
color: green;
} /*行高*/ .text-lh-little {
line-height: 16px;
}
.text-lh-small {
line-height: 18px;
}
.text-lh {
line-height: 22px;
}
.text-lh-big {
line-height: 24px;
}
.text-lh-large {
line-height: 28px;
} /***input***/ .input {
font-size: 14px;
padding: 6px;
border: solid 1px #ccc;
width: 100%;
height: 34px;
line-height: 20px;
display: block;
background-color: #fff;
-webkit-appearance: none;
/*transition:all 1s;*/
}
.input:focus, .input-focus {
border-color: #2a95de;
background-color: #f5f8fd;
/*transition:all 0.3s*/
}
.input:hover, .input-hover {
border-color: #2a95de;
}
.input-error, .input-error:hover {
border-color: #d93600;
}
.input-error:focus {
border-color: #d93600;
background-color: #fff;
}
.input-disabled, .input-disabled:hover, .input[disabled], .input[disabled]:hover {
border-color: #999;
background-color: #eee;
}
.input-readonly, .input[readonly], .input[readonly]:hover {
border-color: #ccc;
background-color: #fff;
} /***Button***/ .button {
display: inline-block;
padding: 6px 20px;
border: 1px solid #ddd;
border-radius: 3px;
color: #3a3a3a;
font-size: 12px;
line-height: 22px;
text-align: center;
background: transparent;
/*transition: all 0.3s;*/
cursor: pointer;
}
.button-full {
display: block;
width: 100%;
}
.button:hover {
background: #f1f1f1;
}
.button.bg-black, .button.bg-dark-grey, .button.bg-main, .button.bg-dot, .button.bg-gray, .button.bg-light-gray, .button.bg-sub, .button.bg-mix, .button.bg-pink, .button.bg-red, .button.bg-orange, .button.bg-blue, .button.bg-green {
color: #fff;
border: 0;
}
.button.bg-black:hover {
background: #222;
}
.button.bg-dark-grey:hover {
background: #444;
}
.button.bg-main:hover {
background: #1380cb;
}
.button.bg-dot:hover {
background: #d93600;
}
.button.bg-gray:hover {
background: #aaa;
}
.button.bg-light-gray:hover {
background: #aaa;
}
.button.bg-sub:hover {
background: #2a95de;
}
.button.bg-mix:hover {
background: #ff5a00;
}
.button.bg-white:hover {
background: #f1f1f1;
}
.button.bg-gray-white:hover {
background: #fff;
}
.button.bg-pink:hover {
background: #e13538;
}
.button.bg-red:hover {
background: #d10;
}
.button.bg-orange:hover {
background: #f60;
}
.button.bg-blue:hover {
background: #0ae;
}
.button.bg-green:hover {
background: green;
}
.button.border-gray:hover, .button.border-main:hover, .button.border-dot:hover, .button.border-mix:hover, .button.border-sub:hover, .button.border-black:hover {
color: #fff;
}
.button.border-gray-white:hover {
background: #eee;
}
.button.border-light-gray:hover {
background: #ccc;
}
.button.border-gray:hover {
background: #999;
}
.button.border-black:hover {
background: #000;
}
.button.border-main:hover {
background: #2a95de;
}
.button.border-sub:hover {
background: #1380cb;
}
.button.border-mix:hover {
background: #d93600;
}
.button.border-dot:hover {
background: #ff5a00;
} /***select***/ .select {
width: 100%;
height: 26px;
border: 1px solid #ccc;
}
.select:focus, .select:hover {
border-color: #2a95de;
} /***textarea***/ .textarea {
border: 1px solid #ccc;
resize: none;
}
.textarea:hover {
border-color: #2a95de;
}
.textarea:focus {
border-color: #2a95de;
background-color: #f5f8fd;
} /***margin***/ /***border***/ .border {
border: solid 1px #ddd;
}
.border-top {
border-top: solid 1px #ddd;
}
.border-right {
border-right: solid 1px #ddd;
}
.border-bottom {
border-bottom: solid 1px #ddd;
}
.border-left {
border-left: solid 1px #ddd;
}
.border-top-bottom {
border-top: solid 1px #ddd;
border-bottom: solid 1px #ddd;
}
.border-left-right {
border-left: solid 1px #ddd;
border-right: solid 1px #ddd;
} /*边框样式*/ .border-dashed {
border-style: dashed;
}
.border-dotted {
border-style: dotted;
}
.border-double {
border-style: double;
}
.border-inset {
border-style: inset;
}
.border-outset {
border-style: outset;
} /*边框大小*/ .border-large {
border-width: 10px;
}
.border-big {
border-width: 5px;
}
.border-middle {
border-width: 3px;
}
.border-small {
border-width: 2px;
}
.border-none {
border: none !important;
} /*边框颜色*/ .border-gray-white {
border-color: #eee;
}
.border-light-gray {
border-color: #ccc;
}
.border-gray {
border-color: #999;
}
.border-main {
border-color: #2a95de;
}
.border-sub {
border-color: #1380cb;
}
.border-mix {
border-color: #d93600;
}
.border-dot {
border-color: #ff5a00;
}
.border-white {
border-color: #fff;
}
.border-black {
border-color: #000;
} /***border radius***/ .radius-none {
border-radius: 0;
}
.radius-small {
border-radius: 2px;
}
.radius {
border-radius: 4px;
}
.radius-big {
border-radius: 6px;
}
.radius-rounded {
border-radius: 2em;
}
.radius-circle {
border-radius: 50%;
} /***boxshadow***/ .box-shadow {
box-shadow: 0 3px 5px #ccc;
} /***background***/ .bg {
background: #eee;
}
.bg-gray {
background: #999;
}
.bg-dark-grey {
background: #3a3a3a;
}
.bg-black {
background: #000;
}
.bg-white {
background: #fff;
}
.bg-gray-white {
background: #f7f7f7;
}
.bg-main {
background: #2a95de;
}
.bg-sub {
background: #1380cb;
}
.bg-mix {
background: #d93600;
}
.bg-dot {
background: #ff5a00;
}
.bg-pink {
background: #e13538;
}
.bg-red {
background: #d10;
}
.bg-orange {
background: #f60;
}
.bg-blue {
background: #0ae;
}
.bg-green {
background: green;
}
.bg-inverse, .bg-inverse a {
color: #fff;
}
.bg-none {
background: none !important;
}
.bg-light-red {
background: #f00;
} /*内边距,全,上,下,左,右*/ .padding-large {
padding: 30px;
}
.padding-large-top {
padding-top: 30px;
}
.padding-large-right {
padding-right: 30px;
}
.padding-large-bottom {
padding-bottom: 30px;
}
.padding-large-left {
padding-left: 30px;
}
.padding-big {
padding: 20px;
}
.padding-big-top {
padding-top: 20px;
}
.padding-big-right {
padding-right: 20px;
}
.padding-big-bottom {
padding-bottom: 20px;
}
.padding-big-left {
padding-left: 20px;
}
.padding {
padding: 10px;
}
.padding-tb {
padding: 10px 0;
}
.padding-lr {
padding: 0 10px;
}
.padding-top {
padding-top: 10px;
}
.padding-right {
padding-right: 10px;
}
.padding-bottom {
padding-bottom: 10px;
}
.padding-left {
padding-left: 10px;
}
.padding-small {
padding: 5px;
}
.padding-small-top {
padding-top: 5px;
}
.padding-small-right {
padding-right: 5px;
}
.padding-small-bottom {
padding-bottom: 5px;
}
.padding-small-left {
padding-left: 5px;
}
.padding-little {
padding: 2px;
}
.padding-little-top {
padding-top: 2px;
}
.padding-little-right {
padding-right: 2px;
}
.padding-little-bottom {
padding-bottom: 2px;
}
.padding-little-left {
padding-left: 2px;
}
.padding-none {
padding: 0 !important;
} /*外边距,全,上,下,左,右*/ .margin-large {
margin: 30px;
}
.margin-large-top {
margin-top: 30px;
}
.margin-large-right {
margin-right: 30px;
}
.margin-large-bottom {
margin-bottom: 30px;
}
.margin-large-left {
margin-left: 30px;
}
.margin-big {
margin: 20px;
}
.margin-big-top {
margin-top: 20px;
}
.margin-big-right {
margin-right: 20px;
}
.margin-big-bottom {
margin-bottom: 20px;
}
.margin-big-left {
margin-left: 20px;
}
.margin {
margin: 10px !important;
clear: both;
}
.margin-tb {
margin: 10px 0;
}
.margin-lr {
margin: 0 10px;
}
.margin-top {
margin-top: 10px;
}
.margin-right {
margin-right: 10px;
}
.margin-bottom {
margin-bottom: 10px;
}
.margin-left {
margin-left: 10px;
}
.margin-around {
margin: 0 10px;
}
.margin-small {
margin: 5px;
}
.margin-small-top {
margin-top: 5px;
}
.margin-small-right {
margin-right: 5px;
}
.margin-small-bottom {
margin-bottom: 5px;
}
.margin-small-left {
margin-left: 5px;
}
.margin-little {
margin: 2px;
}
.margin-little-top {
margin-top: 2px;
}
.margin-little-right {
margin-right: 2px;
}
.margin-little-bottom {
margin-bottom: 2px;
}
.margin-little-left {
margin-left: 2px;
}
.margin-none {
margin: 0 !important;
} /*无序有序列表*/ ul {
list-style: none;
}
ol {
padding-left: 24px;
}
.list-cn {
list-style-type: cjk-ideographic;
}
.list-alpha {
list-style-type: upper-alpha;
}
.list-unstyle {
list-style: none;
padding-left: 0;
}
.list-unstyle ul {
list-style: disc;
}
.list-inline li {
display: inline-block;
padding: 0 10px;
width: auto;
} /***布局***/ .layout {
width: 100%;
}
.container {
margin: 0 auto;
width: 1200px;
} /*宽度比例*/ .w10 {
width: 10%;
}
.w20 {
width: 20%;
}
.w30 {
width: 30%;
}
.w40 {
width: 40%;
}
.w50 {
width: 50%;
}
.w60 {
width: 60%;
}
.w70 {
width: 70%;
}
.w80 {
width: 80%;
}
.w90 {
width: 90%;
}
.w5 {
width: 5%;
}
.w15 {
width: 15%;
}
.w25 {
width: 25%;
}
.w35 {
width: 35%;
}
.w45 {
width: 45%;
}
.w55 {
width: 55%;
}
.w65 {
width: 65%;
}
.w75 {
width: 75%;
}
.w85 {
width: 85%;
}
.w95 {
width: 95%;
} /*HR*/ .hr-gray {
width: 100%;
border-top: 1px solid #d6d6d6;
border-bottom: 1px solid #fff;
}
.hr-black {
width: 100%;
border-top: 1px solid #171717;
border-bottom: 1px solid #707070;
}
.hr-blue {
width: 100%;
border-top: 1px solid #2969a6;
border-bottom: 1px solid #488bcb;
} /*spacer*/ .spacer-gray {
border-left: 1px solid #d6d6d6;
border-right: 1px solid #fff;
} /*广告*/ .roof {
width: 1200px;
height: 90px;
overflow: hidden;
margin: 0 auto;
display: none;
}
.mask {
opacity: 0.7;
position: fixed;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
overflow: hidden;
z-index: 1030;
background: rgb(0, 0, 0);
display: none;
overflow: hiden;
}
.ads {
position: absolute;
top: 23%;
left: 23%;
}
.ads a {
position: absolute;
top: 0;
right: 0;
} /* 订单支付 */ .order-container .border, .pay-checkbox:hover {
cursor: pointer;
}

类名称通俗易懂,样式多样且全面。支持各种手机端布局。很棒。值得借鉴。

common.css 值得学习的css样式布局的更多相关文章

  1. 值得学习的CSS知识

    这里零度给大家推荐几个值得学习的CSS技巧,能让你编写网页事半功倍!一.清除默认值 通常 padding 的默认值为 0,background-color 的默认值是 transparent.但是在不 ...

  2. 微信小程序开发:学习笔记[4]——样式布局

    微信小程序开发:学习笔记[4]——样式布局 Flex布局 新的布局方式 在小程序开发中,我们需要考虑各种尺寸终端设备上的适配.在传统网页开发,我们用的是盒模型,通过display:inline | b ...

  3. css案例学习之层叠样式

    代码 <html> <head> <title>层叠特性</title> <style type="text/css"> ...

  4. (3)《Head First HTML与CSS》学习笔记---CSS入门

    1.O‘Reilly的<CSS PocketReference>是一本不错的CSS参考小书,记录了常用的元素属性. 2.元素选择器的作用强于继承的作用:用户定义强于浏览器默认(以下所有讨论 ...

  5. CSS基础学习 21.CSS居中总结

    注意:*在IE中并不代表通配符的意思,是代表根元素的意思,所以为了匹配适应各种浏览器,进行页面初始化 <style> *{ margin:0; padding:0; } </styl ...

  6. CSS基础学习-2.CSS选择器(上)

    元素选择符 关系选择符 属性选择符 伪类选择符 伪对象选择符 一.元素选择符 1.通配符:*{ } 2.类选择符:.类名称{ } 3.id选择符::#id名称{ } 4.类型选择符(标签选择符):标签 ...

  7. CSS基础学习 20.CSS媒体查询

  8. CSS基础学习 19.CSS hack

  9. CSS基础学习 18.CSS多列

    四种常见的浏览器内核:

随机推荐

  1. Registry uninstall values

    Original link: http://windowssucks.wordpress.com/win-registry-uninstall-values/ -------------------- ...

  2. 安装Cygwin

    如果你现在正在学习C语言,而你又不希望使用微软提供的任何C语言的任何编译器,那么你应该考虑一下GCC.GCC是运行于类UNIX系统下的编译器工具集,这又引出了另一个让人头疼的问题,你没有一台现成的装有 ...

  3. 最完美解决Nginx部署ThinkPHP项目的办法

    网上通用解决方法的配置如下: server { ... location / { index index.htm index.html index.php; #访问路径的文件不存在则重写URL转交给T ...

  4. js实现完美身份证号有效性验证

    最近需要对身份证合法性进行验证,实名验证是不指望了,不过原来的验证规则太过简单,只是简单的验证了身份证长度,现在业务需要加强下身份证验证规则,网上找到了不少资料,不过都不合偶的心意,无奈只好直接写一个 ...

  5. ecshop用户中心订单详情增加快递单物流信息查询显示的功能

    1,themes\default\user_transaction.dwt 找到: <!--{if $action eq order_detail} --> 在下面一行加入: <st ...

  6. web2py--------------用web2py写 django的例子 --------建立一个投票应用(1)

    按照上一篇我们新建一个名为  polls 的app 然后文件结构如下 然后web2py 会自动向里边添加一些代码. 我们需要剔除一些,如这个 controllers ,defualt.py  的ind ...

  7. Python用format格式化字符串

    format是是python2.6新增的一个格式化字符串的方法,相对于老版的%格式方法,它有很多优点. 1.不需要理会数据类型的问题,在%方法中%s只能替代字符串类型 2.单个参数可以多次输出,参数顺 ...

  8. Kinetic使用注意点--blob

    new Blob(config) 参数: config:包含所有配置项的对象. { points: "存放路径点的数组,可以用一层数组[a,b,c,d].二层数组[[a,b],[c,d]]或 ...

  9. WPF从入门到放弃系列第二章 XAML

    本文是作者学习WPF从入门到放弃过程中的一些总结,主要内容都是对学习过程中拜读的文章的整理归纳. 参考资料 XAML 概述 (WPF):https://msdn.microsoft.com/zh-cn ...

  10. Lucene基础(三)-- 中文分词及高亮显示

    Lucene分词器及高亮 分词器 在lucene中我们按照分词方式把文档进行索引,不同的分词器索引的效果不太一样,之前的例子使用的都是标准分词器,对于英文的效果很好,但是中文分词效果就不怎么样,他会按 ...