您现在的位置是:网站首页> 编程资料编程资料
CSS样式重置和清除(让不同浏览器显示效果一致)_心得技巧_网页制作_
2023-11-08
411人已围观
简介 CSS样式清除和重置是前端开发必需要做的事情,结合了前辈们的经验整理了一份CSS重置样式代码不敢独享特此与大家分享下,感兴趣的朋友可不要错过了哈
为了让页面在各不同浏览器之间显示效果一致,CSS样式清除和重置是前端开发必需要做的事情,结合前车之鉴,整理了份CSS重置样式代码供参考。
@charset "utf-8";
body, h1, h2, h3, h4, h5, h6, hr, p, blockquote, pre,
dl, dt, dd, ul, ol, li, th, td, div, span, img,
fieldset, lengend, button, input, select, textarea{margin: 0;padding: 0;}
/* color & background */
html{color:#000; background:#FFF;}
/* font */
body, button, input, select, textarea { /* for ie */
font: 12px/18px Arial, Verdana, Microsoft YaHei;
}
/* fix center */
html,body {height: 100%;margin: 0 auto;}
/* h1~h6 */
h1 {font-size: 18px;}
h2 {font-size: 16px;}
h3 {font-size: 14px;}
h4, h5, h6 {font-size: 100%;}
/* a */
a { text-decoration: none; }
a:hover { text-decoration: underline; }
/* list */
ul,ol {list-style: none;}
/* img border */
fieldset,img{border: 0}
/* table */
table {border-collapse: collapse;border-spacing: 0;font:inherit;}
/* margin */
.alpha {margin-left: 0;}
.omega {margin-right: 0;}
/* float & clear */
.left{float:left;}
.right{float:right;}
.clear {clear: both;display: block;}
/* clearfix */
.clearfix:after{content:".";display:block;}
.clearfix{display:inline-table;}
/* Hides from IE-mac */
* html .clearfix{height:1%;}
.clearfix{display:block;}
/* End hide from IE-mac */
*+html .clearfix{min-height:1%;}/* IE7 */
复制代码
代码如下:@charset "utf-8";
body, h1, h2, h3, h4, h5, h6, hr, p, blockquote, pre,
dl, dt, dd, ul, ol, li, th, td, div, span, img,
fieldset, lengend, button, input, select, textarea{margin: 0;padding: 0;}
/* color & background */
html{color:#000; background:#FFF;}
/* font */
body, button, input, select, textarea { /* for ie */
font: 12px/18px Arial, Verdana, Microsoft YaHei;
}
/* fix center */
html,body {height: 100%;margin: 0 auto;}
/* h1~h6 */
h1 {font-size: 18px;}
h2 {font-size: 16px;}
h3 {font-size: 14px;}
h4, h5, h6 {font-size: 100%;}
/* a */
a { text-decoration: none; }
a:hover { text-decoration: underline; }
/* list */
ul,ol {list-style: none;}
/* img border */
fieldset,img{border: 0}
/* table */
table {border-collapse: collapse;border-spacing: 0;font:inherit;}
/* margin */
.alpha {margin-left: 0;}
.omega {margin-right: 0;}
/* float & clear */
.left{float:left;}
.right{float:right;}
.clear {clear: both;display: block;}
/* clearfix */
.clearfix:after{content:".";display:block;}
.clearfix{display:inline-table;}
/* Hides from IE-mac */
* html .clearfix{height:1%;}
.clearfix{display:block;}
/* End hide from IE-mac */
*+html .clearfix{min-height:1%;}/* IE7 */
相关内容
- IE5.0之后的htc组件的定义概述_心得技巧_网页制作_
- 谈谈对css属性margin的理解_心得技巧_网页制作_
- 10个非常不错的CSS技巧收集整理分享_心得技巧_网页制作_
- 不规则图片 瀑布流原理的分析应用_心得技巧_网页制作_
- 去除在FireFox中点击链接时,出现虚线边框的解决办法_心得技巧_网页制作_
- Web实现点击图片弹出上传文件窗口代码_心得技巧_网页制作_
- 对html制作新手以及菜鸟的一些建议,大牛可以忽略_心得技巧_网页制作_
- 设置网页图片热点链接以及坐标值示例代码_心得技巧_网页制作_
- 7款拥有超酷设计灵感的动态网站设计_心得技巧_网页制作_
- 全民小镇辅助刷金币修改爱心攻略 bug刷钻石不封号教程_手机游戏_游戏攻略_
