内容简介:本文收集了我常用的CSS代码片段!

*reset

@charset "utf-8";

/* reset */
body, dl, dd, h1, h2, h3, h4, h5, h6, p, form, ol, ul, textarea, button, input, select {
margin:;
}
ol, ul, dd, td, th, textarea, button, input, select {
padding:;
}
h1, h2, h3, h4, h5, h6 {
font-size: 100%;
font-weight:;
}
body {
font: 12px/1.5 "Microsoft Yahei", SimSun, arial, sans-serif;
}
ol, ul {
list-style: none;
}
a, button, input, textarea, select {
outline:;
color: inherit;
font: inherit;
}
button::-moz-focus-inner, input::-moz-focus-inner {
border:;
padding:;
}
button {
overflow: visible;
}
button, input[type="button"], input[type="reset"], input[type="submit"] {
-webkit-appearance: button;
cursor: pointer;
}
input::-moz-placeholder, textarea::-moz-placeholder {
color: #ccc;
}
input:-ms-input-placeholder, textarea:-ms-input-placeholder {
color: #ccc;
}
input::-webkit-input-placeholder, textarea::-webkit-input-placeholder {
color: #ccc;
}
input::-ms-clear {
display: none;
}
a {
text-decoration: none;
}
img {
vertical-align: top;
border: 0 none;
}
textarea {
resize: none;
overflow: auto;
}
table {
border-collapse: collapse;
border-spacing:;
}
th {
text-align: center;
}
/* clearfix */
.clearfix:before, .clearfix:after {
content: "";
display: table;
}
.clearfix:after {
clear: both;
}
.clearfix {
*zoom:;
}

*select兼容

select { height:22px; line-height:18px; padding:2px 0; }

*input兼容

.ipt {
border: 1px solid #469021;
background: #64A246;
color: #fff;
font:bold 11px arial,sans-serif;
padding: 0.25em 0.5em;
text-transform: uppercase;
margin:;
overflow: visible;
height: 27px;
line-height: 19px;
_line-height: 16px;
width: 80px;
}

*css圆角

.radius {
-moz-border-radius: 30px;
-webkit-border-radius: 30px;
border-radius: 30px;
}

*水平翻转

.flipx {
-moz-transform:scaleX(-1);
-webkit-transform:scaleX(-1);
-o-transform:scaleX(-1);
transform:scaleX(-1);
filter:FlipH();
}

*垂直翻转

.flipy {
-moz-transform:scaleY(-1);
-webkit-transform:scaleY(-1);
-o-transform:scaleY(-1);
transform:scaleY(-1);
filter:FlipV();
}

*css旋转

.rotate90 {
filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=1);
-moz-transform: rotate(90deg);
-o-transform: rotate(90deg);
-webkit-transform: rotate(90deg);
transform: rotate(90deg);
}

*css盒阴影

.box_shadow {
-moz-box-shadow: 3px 3px 4px #000;
-webkit-box-shadow: 3px 3px 4px #000;
box-shadow: 3px 3px 4px #000;
filter: progid:DXImageTransform.Microsoft.dropshadow(OffX=3px, OffY=3px, Color='#000');
-ms-filter: "progid:DXImageTransform.Microsoft.dropshadow(OffX=3px, OffY=3px, Color='#000')";
}

*clearfix清浮动

.clearfix:before, .clearfix:after { content:""; display:table; }
.clearfix:after{ clear:both; }
.clearfix{ *zoom:;}

*锚点

<a name="link">不能为空</a>
<a href="#link">锚点链接</a>

*纯CSS三角形

.triangle {
width: 0;
height: 0;
font-size: 0;
line-height: 0;
border-width: 50px;
border-style: solid;
border-top-color: #fff;
border-right-color: #fff;
border-bottom-color: red;
border-left-color: #fff;
}

*opacity透明

/*opacity*/
.opacity {
filter: alpha(opacity=50);
-khtml-opacity: 0.5;
-moz-opacity: 0.5;
opacity: 0.5;
}

*选择文本颜色

/* 自定义文本选择颜色 */
::selection { background: #e2eae2; }
::-moz-selection { background: #e2eae2; }
::-webkit-selection { background: #e2eae2; }

*全屏背景

/* 全屏背景 */
.cover {
background: url('bg.jpg') no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}

*强制滚动条

html { height: 101% }

*渐变gradient

/* 渐变 */
.gradient {
background: #629721;
background-image: -webkit-gradient(linear, left top, left bottom, from(#83b842), to(#629721));
background-image: -webkit-linear-gradient(top, #83b842, #629721);
background-image: -moz-linear-gradient(top, #83b842, #629721);
background-image: -ms-linear-gradient(top, #83b842, #629721);
background-image: -o-linear-gradient(top, #83b842, #629721);
background-image: linear-gradient(top, #83b842, #629721);
}

*font-face

/*font-face*/
@font-face {
font-family: 'MyWebFont';
src: url('webfont.eot'); /* IE9 Compat Modes */
src: url('webfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('webfont.woff') format('woff'), /* Modern Browsers */
url('webfont.ttf') format('truetype'), /* Safari, Android, iOS */
url('webfont.svg#svgFontName') format('svg'); /* Legacy iOS */
}
body {
font-family: 'MyWebFont', Arial, sans-serif;
}

*png透明

/* png透明 */
.png {
width:200px;
height:100px;
background: url(this.png) no-repeat;
_background:none;
_filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='this.png',sizingMethod='crop');/* 路径相对于html */
}

*min-height

/* 最小高度 */
.minheight {
min-height: 550px;
height: auto !important;
height: 550px;
}

*移动端reset 

body,nav,dl,dt,dd,p,h1,h2,h3,h4,ul,ol,li,input,button,textarea,footer{margin:;padding:}
header,nav,section,article,footer,figure,figcaption { display: block; }
html,body{width:100%;height:100%;}
li{list-style:none;}
h1,h2,h3,h4,h5{font-size:100%}
img,object,video,embed { max-width: 100%;}
img {border:none; vertical-align: middle; }
button,input,select,textarea{font-size:100%; vertical-align:middle; outline:none;}
a { text-decoration: none; }
body{min-width:320px;font:normal 62.5%/1.5 Tahoma,"Lucida Grande",Verdana,"Microsoft Yahei",STXihei,hei;color:#000;background:#f1f1f1;overflow-x:hidden;-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-text-size-adjust:none;-moz-user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0);}
/* common */
.g-tensile { width: 100%; height: 100%; }
.g-auto { margin-left: auto; margin-right: auto; }

HTML/CSS代码片段的更多相关文章

  1. 30+有用的CSS代码片段

    在一篇文章中收集所有的CSS代码片段几乎是不可能的事情,但是我们这里列出了一些相对于其他的更有用的代码片段,不要被这些代码的长度所吓到,因为它们都很容易实现,并且具有良好的文档.除了那些解决常见的恼人 ...

  2. 【转】30+有用的CSS代码片段

    来自:WEB资源网 链接:http://webres.wang/31-css-code-snippets-to-make-you-a-better-coder/ 原文:http://www.desig ...

  3. 实用的60个CSS代码片段

    1.垂直对齐 如果你用CSS,则你会有困惑:我该怎么垂直对齐容器中的元素?现在,利用CSS3的Transform,可以很优雅的解决这个困惑: .verticalcenter{ position: re ...

  4. 60个有用CSS代码片段

    1.垂直对齐 如果你用CSS,则你会有困惑:我该怎么垂直对齐容器中的元素?现在,利用CSS3的Transform,可以很优雅的解决这个困惑: .verticalcenter{ position: re ...

  5. 拥有的50个CSS代码片段(上)

    1. CSS 重置 ;;;font-size: 100%; font: inherit; vertical-align: baseline; outline: none; -webkit-box-si ...

  6. (转)每位设计师都应该拥有的50个CSS代码片段

    原文地址:http://www.cnblogs.com/fengyuqing/archive/2013/06/15/css_50.html 面对每年如此多的 新趋势 ,保持行业的领先是个很困难问题. ...

  7. 很实用的50个CSS代码片段

    原文:50 Useful CSS Snippets Every Designer Should Have          面对每年如此多的 新趋势 ,保持行业的率先是个非常困难问题. 站点设计者和前 ...

  8. Css学习总结(2)——60个有用CSS代码片段

    1.垂直对齐 如果你用CSS,则你会有困惑:我该怎么垂直对齐容器中的元素?现在,利用CSS3的Transform,可以很优雅的解决这个困惑: .verticalcenter{ position: re ...

  9. 实用的60个CSS代码片段[上]

    1.垂直对齐 如果你用CSS,则你会有困惑:我该怎么垂直对齐容器中的元素?现在,利用CSS3的Transform,可以很优雅的解决这个困惑: .verticalcenter{ position: re ...

随机推荐

  1. JavaScript 系列笔记(一)数据类型

    关于JS的数据类型 简单类型有五种:Undifined, Null, Boolean, Number, String 复杂类型有一种:Object 通过typeof 操作符来获取数据类型,此操作符返回 ...

  2. Hadoop学习历程(二、配置)

    以下是进行单节点Hadoop配置的内容,多节点也类似 1. 进行Hadoop的安装 1.1 上文进行了Hadoop的编译,将编译结果目录 hadoop-2.2.0 拷贝为 /usr/hadoop 目录 ...

  3. IOS 使用新浪微博SDK

    项目需要,测试了一下新浪微博SDK,现在记录一下初步使用过程. 1.下载导入新浪SDK. 2.去新浪开发者平台申请APPkey等. 3.工程中使用 4.在 APPDelegate中写两行 [Weibo ...

  4. JDBC开发模式

    一]代码模块———Demo.java public class Demo { private static Connection connection; private static Statemen ...

  5. selenium太有爱,我已离不开!!!

    自动化测试,超有用. PROXY,PLUGIN,PROFILE,WINDOWS HANDLE个个搞定!!! from selenium import webdriver from selenium.c ...

  6. 微软开源PowerShell并支持Linux和OS X

    [微软在开源的道路上加速度了] 从一开始的各种对抗,各种通吃,到现在开始做服务,包罗万象.果然,换了主力,大有不同. 微软今天还宣布开源其.NET框架,令.NET Core能在Linux和OS X上运 ...

  7. b/s客户端和服务器的交互(转)

    原文:http://igoro.com/archive/what-really-happens-when-you-navigate-to-a-url/ 作为一个软件开发者,你一定会对网络应用如何工作有 ...

  8. CH Round #53 -密室

    描述 有N个密室,3种钥匙(红色,绿色,白色)和2种锁(红色,绿色),红色钥匙只能开红色的锁,绿色钥匙只能开绿色的锁,白色钥匙可以开红色的锁和绿 色的锁,一把钥匙使用一次之后会被扔掉.每个密室由一扇门 ...

  9. sgu495:概率dp / 推公式

    概率题..可以dp也可以推公式 抽象出来的题目大意: 有 n个小球,有放回的取m次  问 被取出来过的小球的个数的期望 dp维护两个状态 第 i 次取出的是 没有被取出来过的小球的 概率dp[i] 和 ...

  10. PHP设计模式笔记八:原型模式 -- Rango韩老师 http://www.imooc.com/learn/236

    原型模式 概述: 1.与工厂模式作用类似,都是用来创建对象 2.与工厂模式的实现不同,原型模式是先创建好一个原型对象,然后通过clone原型对象来创建新的对象,这样就免去了类创建时重复的初始化操作 3 ...