Heim  >  Artikel  >  Web-Frontend  >  CSS重置标签默认样式_html/css_WEB-ITnose

CSS重置标签默认样式_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:31:261129Durchsuche

CSS重置标签默认样式:
建议:尽可能的手写代码,可以有效的提高学习效率和深度。
在默认情况下,很多标签都有自带的属性,例如body自带有margin、ul有自带的padding、h1-h6的字体大小各部相同、li前面带有的小圆圈等等。这些自带的默认属性会给实际的布局中带来不少的麻烦,我们可以再样式表的开始就重置这些默认的属性。实例如下:

<!DOCTYPE html><html><head><meta charset=" utf-8"><meta name="author" content="http://www.softwhy.com/" /><title>蚂蚁部落</title><style type="text/css">body, ul, li, h1, h2, h3, h4, h5, h6, p{  margin:0px;  padding:0px;  list-style:none;  font-size:12px;  font-weight:normal;}</style></head><body><h1>标题一</h1><h2>标题二</h2><h3>标题三</h3><h4>标题四</h4><h5>标题五</h5><h6>标题六</h6><ul>  <li>列表项一</li>  <li>列表项二</li></ul><p>我是一个段落</p></body></html>

原文地址是:http://www.softwhy.com/forum.php?mod=viewthread&tid=4736

更多内容可以参阅:http://www.softwhy.com/divcss/

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn