HTML/CSS代码片段
内容简介:本文收集了我常用的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代码片段的更多相关文章
- 30+有用的CSS代码片段
在一篇文章中收集所有的CSS代码片段几乎是不可能的事情,但是我们这里列出了一些相对于其他的更有用的代码片段,不要被这些代码的长度所吓到,因为它们都很容易实现,并且具有良好的文档.除了那些解决常见的恼人 ...
- 【转】30+有用的CSS代码片段
来自:WEB资源网 链接:http://webres.wang/31-css-code-snippets-to-make-you-a-better-coder/ 原文:http://www.desig ...
- 实用的60个CSS代码片段
1.垂直对齐 如果你用CSS,则你会有困惑:我该怎么垂直对齐容器中的元素?现在,利用CSS3的Transform,可以很优雅的解决这个困惑: .verticalcenter{ position: re ...
- 60个有用CSS代码片段
1.垂直对齐 如果你用CSS,则你会有困惑:我该怎么垂直对齐容器中的元素?现在,利用CSS3的Transform,可以很优雅的解决这个困惑: .verticalcenter{ position: re ...
- 拥有的50个CSS代码片段(上)
1. CSS 重置 ;;;font-size: 100%; font: inherit; vertical-align: baseline; outline: none; -webkit-box-si ...
- (转)每位设计师都应该拥有的50个CSS代码片段
原文地址:http://www.cnblogs.com/fengyuqing/archive/2013/06/15/css_50.html 面对每年如此多的 新趋势 ,保持行业的领先是个很困难问题. ...
- 很实用的50个CSS代码片段
原文:50 Useful CSS Snippets Every Designer Should Have 面对每年如此多的 新趋势 ,保持行业的率先是个非常困难问题. 站点设计者和前 ...
- Css学习总结(2)——60个有用CSS代码片段
1.垂直对齐 如果你用CSS,则你会有困惑:我该怎么垂直对齐容器中的元素?现在,利用CSS3的Transform,可以很优雅的解决这个困惑: .verticalcenter{ position: re ...
- 实用的60个CSS代码片段[上]
1.垂直对齐 如果你用CSS,则你会有困惑:我该怎么垂直对齐容器中的元素?现在,利用CSS3的Transform,可以很优雅的解决这个困惑: .verticalcenter{ position: re ...
随机推荐
- python 如何重新加载有修改过的模块(module)
写 Python 程序的时候,一边写模块一边调试.调试是在 Python 自身的命令行终端进行的.但当对模块里的代码进行修改后,在原调试终端上执行到模块中新修改上去的内容. 我之前是一直用退出再重新进 ...
- pyqt5:标签显示文本框内容
文本框(lineEdit)输入文本,标签(label)就会显示文本框的内容. 原理如下: 输入文本时,lineEdit控件发射信号textChanged(),label收到后触发setText()槽. ...
- docker中运行ASP.NET Core Web API
在docker中运行ASP.NET Core Web API应用程序 本文是一篇指导快速演练的文章,将介绍在docker中运行一个ASP.NET Core Web API应用程序的基本步骤,在介绍的过 ...
- fiddler使用之坑
今天一上午都在搞fiddler,之前可以抓到浏览器的请求,今天突然不行了,弄得我花一上午时间去设置浏览器代理的事情,遇到各种各样的问题,现将解决办法记录如下: 1.原来fiddler安装在E盘中,安装 ...
- Lintcode--010(最长上升子序列)
给定一个整数序列,找到最长上升子序列(LIS),返回LIS的长度.LIS(longestIncreasingSubsequence) 说明: 最长上升子序列的定义: 最长上升子序列问题是在一个无序的给 ...
- Chrome下的语音控制框架MyVoix.js使用篇(一)
日前因工作需求,着手研究了语音识别技术,发现github上有网友发布了一款叫做voix.js的javascript框架.在拜读voix.js的源码后发现了不少问题,于是自己写了一款语音识别框架MyVo ...
- TranslateAnimation详解
TranslateAnimation详解 Android JDK为我们提供了4种动画效果,分别是: AlphaAnimation,RotateAnimation, ScaleAnimation, Tr ...
- 虚拟机最佳实践:单个 VM、临时存储和已上传磁盘
大家好! 我是 Drew McDaniel,来自 Microsoft Azure虚拟机功能研发团队,我从团队成立之初就已加入. 在本博客文章中,我将分享一些最佳实践指南,帮助您充分利用您的Azure虚 ...
- HDU 4276 The Ghost Blows Light
K - The Ghost Blows Light Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & ...
- 【hihoCoder第十六周】RMQ-ST算法
RMQ的大裸题.没什么意思.开始数组开小了,RE了一次.下面放代码. #include <bits/stdc++.h> using namespace std; vector<int ...