common.css 值得学习的css样式布局

简介:

正常的项目当中,应当有一个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;
}

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



本文转自TBHacker博客园博客,原文链接:http://www.cnblogs.com/jiqing9006/p/5545030.html,如需转载请自行联系原作者

相关文章
|
前端开发 JavaScript
|
前端开发
网站开发之DIV+CSS简单布局网站入门篇(五)
这篇文章主要介绍如何使用DIV和CSS简单布局一个网站的首页,通常将网站划分为顶部(Logo、导航条)、中部(页面主要内容、左右栏目)、底部(制作方介绍、超链接)。这是非常基础的一篇引入性文章,采用案例的方式进行介绍的,希望对你有所帮助。运行结果如下图所示:main.html主页面代码:主要通过di
3570 0
|
Web App开发 前端开发 容器
CSS布局快速入门
最近因为项目需要,不得不重新看看CSS/HTML之类的东西,不看不要紧,一看吓一跳 原来不知道真的是太多,以前从未认真对待过,这次总结了一下学习所得,算是对自己 有个交代,也可能让想了解CSS/HTML布局应用的朋友快速入门: 1. CSS 与HTML元素直接关联,以HTML h1元素为例。
840 0
|
9天前
|
前端开发 JavaScript 开发工具
【HTML/CSS】入门导学篇
【HTML/CSS】入门导学篇
19 0
|
1月前
|
XML 编解码 前端开发
编程笔记 html5&css&js 033 HTML SVG
编程笔记 html5&css&js 033 HTML SVG
|
4天前
|
前端开发 搜索推荐 数据安全/隐私保护
HTML标签详解 HTML5+CSS3+移动web 前端开发入门笔记(四)
HTML标签详解 HTML5+CSS3+移动web 前端开发入门笔记(四)
14 1
|
4天前
|
PHP
web简易开发——通过php与HTML+css+mysql实现用户的登录,注册
web简易开发——通过php与HTML+css+mysql实现用户的登录,注册
|
11天前
|
JSON JavaScript 前端开发
js是什么、html、css
js是什么、html、css
|
12天前
|
XML 前端开发 JavaScript
css和html
【4月更文挑战第7天】css和html
12 0
|
28天前
|
前端开发 容器 内存技术
使用CSS3画出一个叮当猫HTML源码
本文教程介绍了如何使用CSS3绘制叮当猫,通过HTML结构和CSS样式逐步构建叮当猫的各个部位,如头部、脸部、脖子、身体、手脚等。代码示例展示了如何利用渐变、边框、阴影和定位技巧实现三维效果和细节特征。此外,还添加了眼珠的动画效果,让叮当猫的眼睛能够转动。整个过程适合对CSS3感兴趣的读者参考学习,以提升动态图形创作技能。
16 0
使用CSS3画出一个叮当猫HTML源码