css使用技巧总结
2015-05-18 20:59
555 查看
1.css通用样式
2.减少Div中的html元素
常用的布局元素包括:div,h1,h2,h3,h4,h5,p,label,span,em,strong,ul,li;使用div作为主要的容器,其余元素填充div里面的内容
布局方式:
取代
3.Css Hark问题
1 @charset "gb2312"; 3 /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ global ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ 4 * { margin:0; padding:0;} 5 html,body { height:100%;} 6 body { background:#d4e3eb; font-family:"微软雅黑","宋体"; position:relative;} 7 ul li, ol li { list-style:none;} 8 h1,h2,h3,h4,h5,h6,em { font-weight:normal;} 9 table { border-collapse:collapse;border-spacing:0}} 10 fieldset,img { border:0; vertical-align:middle;} 11 a { color:#2f3b54; text-decoration:none;} 12 a:focus { outline:0;} 13 a:focus,a:hover { color:#c00;} 14 input,textarea { font-family:"微软雅黑","Arial";} 15 p{word-wrap:break-word} 16 /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ layout ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ 17 .clearfix { zoom:1;} /* 清除浮动 */ 18 .clearfix:after { content:"."; display:block; height:0; visibility:hidden; clear:both;} 19 .l { float:left;} 20 .r { float:right;} 21 .c { clear:both;} 22 .block { display:block;} 23 .none { display:none;}
2.减少Div中的html元素
常用的布局元素包括:div,h1,h2,h3,h4,h5,p,label,span,em,strong,ul,li;使用div作为主要的容器,其余元素填充div里面的内容
布局方式:
1 <div> 2 <h1></h1> 3 <p><span></span>xxx</p> 4 </div>
取代
<div> <div id="div1"/> <div id="div2"/> </div>
3.Css Hark问题
<head> <title></title> <!--IE条件注释法--> <!--[if IE 6]> <link type="text/css" href="#" rel="stylesheet"/> <![endif]--> <!--如果大于ie6--> <!--[if gt IE 6]> <link type="text/css" href="#" rel="stylesheet"/> <![endif]--> <style type="text/css"> .test{width:60px;height:50px;border:1px solid red;} /* ie6,7,8,9*/ /*选择符前缀法*/ *html .test{width:70px;} /* ie6*/ *+html .test{width:80px;} /*ie7*/ /*样式属性前缀法*/ .test1{width:60px;*width:70px;_width:80px;height:50px;border:1px solid green;} /* *ie6,ie7*/ /* _ie6*/ </style> </head> <body> <div class="test"></div> <div class="test1"></div> </body> </html> <!--[if IE 6]> <script type="text/javascript"> alert("test"); </script> <![endif]-->
相关文章推荐
- css使用技巧总结
- 微信小程序 css使用技巧总结
- 在实际项目中总结的一些CSS的使用技巧和重要知识点。
- 微信小程序 css使用技巧总结
- 使用python 爬虫抓站的一些技巧总结
- 对WPS表格的使用技巧的一些总结一
- python常用函数和使用技巧日常总结(不定期更新)
- css中遇到的技巧和坑儿——background-size使用transition失效
- css使用技巧
- CSS3阴影 box-shadow的使用和技巧总结
- CSS3伪类选择器:nth-child(n)及:nth-of-type(n)使用区别探究总结
- 使用 git 过程中总结的一些技巧分享
- Mac使用技巧总结
- CSS对图片的使用小技巧总结
- CSS技巧总结(一) 图形效果
- CSS技巧总结(二) 居中
- Mac使用技巧总结-如何独立设置Mac触摸板方向和鼠标滚轮方向?
- Markdown使用技巧总结——字体,颜色,字号,背景,首行缩进等
- Eclipse快捷键与使用技巧总结
- 前端使用console 进行 JS 调试技巧总结