css初始化样式代码
为什么要初始化CSS?
CSS初始化是指重设浏览器的样式。不同的浏览器默认的样式可能不尽相同,所以开发时的第一件事可能就是如何把它们统一。如果没对CSS初始化往往会出现浏览器之间的页面差异。每次新开发网站或新网页时候通过初始化CSS样式的属性,为我们将用到的CSS或html标签更加方便准确,使得我们开发网页内容时更加方便简洁,同时减少CSS代码量,节约网页下载时间。
CSS初始化示例代码
- /* css reset www.admin10000.com */
- body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,p,blockquote,th,td { margin:; padding:; }
- body { background:#fff; color:#555; font-size:14px; font-family: Verdana, Arial, Helvetica, sans-serif; }
- td,th,caption { font-size:14px; }
- h1, h2, h3, h4, h5, h6 { font-weight:normal; font-size:100%; }
- address, caption, cite, code, dfn, em, strong, th, var { font-style:normal; font-weight:normal;}
- a { color:#555; text-decoration:none; }
- a:hover { text-decoration:underline; }
- img { border:none; }
- ol,ul,li { list-style:none; }
- input, textarea, select, button { font:14px Verdana,Helvetica,Arial,sans-serif; }
- table { border-collapse:collapse; }
- html {overflow-y: scroll;}
- /* css common */
- .clearfix:after {content: "."; display: block; height:; clear:both; visibility: hidden;}
- .clearfix { *zoom:; }
下面是定义的一些常用的css基础样式:
- /**
- * css初始化样式及自定义样式封装
- * @author
- * @date 2016-07-14
- */
- @charset "UTF-8";
- * { margin:; padding:; }
- html { font-family: sans-serif; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); -webkit-text-size-adjust: none; -webkit-user-select: none; -moz-user-select: none; user-select: none; }
- html, body { font-family: Helvetica, Tahoma, Arial, "Microsoft YaHei", "微软雅黑", STXihei, "华文细黑", SimSun, "宋体", Heiti, "黑体", sans-serif; }
- article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section { display: block; }
- ol, ul { list-style: none; }
- table { border-collapse: collapse; border-spacing:; }
- input, button, textarea { -webkit-appearance: none; }
- /**
- * 定义预定义字体样式
- */
- ::-webkit-input-placeholder { color: #999; }
- :-moz-placeholder { color: #999; }
- ::-moz-placeholder { color: #999; }
- :-ms-input-placeholder { color: #999; }
- .placeholder { color: #999; }
- /**
- * 清除浮动
- */
- .f-cb:after, .f-cbli li:after { display: block; clear: both; visibility: hidden; height:; overflow: hidden; content: "."; }
- .f-cb, .f-cbli li { zoom:; }
- /**
- * 定义元素如何显示
- */
- .f-dib { display: inline-block; *display: inline; *zoom:; }
- .f-di { display: inline; }
- .f-dn { display: none; }
- .f-db { display: block; }
- .f-dt { display: table; }
- .f-dtr { display: table-row; }
- .f-dtc { display: table-cell; }
- /**
- * 定义浮动
- */
- .f-fl { float: left; }
- .f-fr { float: right; }
- .f-fn { float: none; }
- /**
- * 定义元素定位类型
- */
- .f-pr { position: relative; }
- .f-pa { position: absolute; }
- .f-pf { position: fixed; }
- /**
- * 定义元素超出隐藏
- */
- .f-oh { overflow: hidden; }
- /**
- * 定义字体相关样式
- */
- .f-tal { text-align: left; }
- .f-tac { text-align: center; }
- .f-tar { text-align: right; }
- .f-fwb { font-weight: bold; }
- .f-tdu, .f-tdu:hover { text-decoration: underline; }
- .f-tdn, .f-tdn:hover { text-decoration: none; }
- /**
- * 溢出单行文本显示省略号
- */
- .f-toe { overflow: hidden; word-wrap: normal; white-space: nowrap; text-overflow: ellipsis; -o-text-overflow: ellipsis; }
- /**
- * 溢出文本强制换行
- */
- .f-pre { overflow: hidden; text-align: left; white-space: pre-wrap; word-wrap: break-word; word-break: break-all; }
- /**
- * 定义鼠标悬浮样式
- */
- .f-csp { cursor: pointer; }
- /**
- * 定义子元素垂直显示样式
- */
- .f-vat, .f-vata * { vertical-align: top; }
- .f-vab, .f-vaba * { vertical-align: bottom; }
- .f-vam, .f-vama * { vertical-align: middle; }
- /**
- * 表格布局固定
- */
- .f-tlf { table-layout: fixed; }
- /**
- * 向右的小箭头
- */
- /**
- * 三角形
- */
.triangle {
width: 0;
height: 0;
border: 40px solid red;
border-top-color: black;
border-bottom: none;
border-left-color: transparent;
border-right-color: transparent;
}
css初始化样式代码的更多相关文章
- CSS初始化样式
为什么要初始化CSS? CSS初始化是指重设浏览器的样式.不同的浏览器默认的样式可能不尽相同,所以开发时的第一件事可能就是如何把它们统一.如果没对CSS初始化往往会出现浏览器之间的页面差异.每次新开发 ...
- CSS初始化示例代码
CSS初始化示例代码 /* css reset www.admin10000.com */ body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code, ...
- 常用css初始化样式(淘宝)
最简单粗暴的css初始化样式就是:*{padding:0:margin:0}(不推荐) 淘宝的样式初始化: body, h1, h2, h3, h4, h5, h6, hr, p, blockquot ...
- 一套常用的css初始化样式
@charset "UTF-8"; /*css 初始化 */ html, body, ul, li, ol, dl, dd, dt, p, h1, h2, h3, h4, h5, ...
- (转)雅虎工程师提供的css初始化示例代码
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,p,b ...
- css 初始化样式
@charset "UTF-8"; /* reset */ html,body,div,h1,h2,h3,h4,h5,h6,p,dl,dt,dd,ol,ul,li,fieldset ...
- 雅虎工程师提供的CSS初始化示例代码
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,p,b ...
- 免费CSS鼠标样式代码大全
原文发布时间为:2008-08-01 -- 来源于本人的百度文章 [由搬家工具导入] http://5211.91.tc/sb.htm
- CSS 初始化 代码
腾讯QQ官网 样式初始化 ;} body{font:12px"宋体","Arial Narrow",HELVETICA;background:#fff;-web ...
随机推荐
- 【leetcode】Min Stack -- python版
题目描述: Design a stack that supports push, pop, top, and retrieving the minimum element in constant ti ...
- Visual Studio 2015 前瞻 属性初始化赋值!
通常我们建立属性的时候如果带初始化值的时候我们经常会这样处理. class MyClass { private string _name = "hello world!"; pub ...
- BZOJ 1031: [JSOI2007]字符加密Cipher 后缀数组
1031: [JSOI2007]字符加密Cipher Time Limit: 10 Sec Memory Limit: 162 MBSubmit: 6014 Solved: 2503[Submit ...
- 【CentOS】文件与目录管理
一.文件与目录管理 0.cd--change directory cd - 返回上次的目录 cd ~ 返回到家目录 --对于root用户来说是/root,对于普通用户来说是/home/用户名 cd ...
- Hdu5093 Battle ships 二分图
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission( ...
- Eclipse中快速删除空行
1.在要编辑的文档中 "Ctrl"+"F",弹出搜索框: 2.在Find文本框中输入正则表达式:^\s*\n 3.勾选正则表达式选项: 4.Find和替换所有.
- jQuery学习之:Validation表单验证插件
http://polaris.blog.51cto.com/1146394/258781/ 最近由于公司决定使用AJAX + Struts2来重构项目,让我仔细研究一下这两个,然后集中给同事讲讲,让每 ...
- Leetcode Longest Palindromic Substring
Given a string S, find the longest palindromic substring in S. You may assume that the maximum lengt ...
- 堆排序 Heapsort
Prime + Heap 简直神了 时间优化好多,顺便就把Heapsort给撸了一发 具体看图 Heapsort利用完全二叉树+大(小)顶锥的结构每次将锥定元素和锥最末尾的元素交换 同时大(小)顶锥元 ...
- *HDU1142 最短路+记忆化dfs
A Walk Through the Forest Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Jav ...