css外部样式表的书写(格式)规范代码?

如题所述

第1个回答  2013-04-23
如body{ margin:0px; padding:0px;}
#nav{ width:100%; height:auto;}
.main{ width:980px; height:auto; font-size:12px;}
还有有就是复合样式
.main li{ list-style:none; padding:0px; margin:0px;}等等本回答被网友采纳
第2个回答  2017-07-31
没有什么规范不规范的,如果你是初学者,可以做些缩进换行什么的。我习惯无缩进,只是每个选择换行,在优化角度考虑,这样能减少些容量。你也可以全部写好,用一些在线压缩css
第3个回答  2019-09-08
选择器{样式代码}
就这样,通常人们在完全把代码测试之后,确保完全稳定后用再用工具格式化代码的
第4个回答  2017-08-30

内部样式

<div style="width: 1600px; height: 800px; border: 1px solid #000; margin: 0 auto;" class="box"></div>

外部样式

<style>
  .banner{ height:459px; position:relative;}
  .banner ul{}
  .banner ul li{ position:absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 500;}
  .banner ul li img{ max-width:100%;}
  .left,.right{ position: absolute; width: 60px; height: 80px; background-color: #555555; opacity: 0.8; filter:alpha(opacity=80); z-index: 1000; top: 50%; margin-top: -40px; cursor: pointer; background-image: url(images/slider-arrow.png); background-repeat: no-repeat ;}
  .left{ left: 0; background-position: -150px -105px;}
  .right{ right: 0; background-position: -24px 0;}
  .xiaodian{ left: 0; bottom: 10px; text-align: center; z-index: 1500; width: 100%;}
  .xiaodian ol li{ display: inline-block; border-radius: 50%; width: 15px; height: 15px; background: #007c36; margin: 0 5px; cursor: pointer;}
  .xiaodian ol{ width: 100%;}
  .xiaodian ol li.current{ background: #fff;}
</style>

第5个回答  2013-04-23
先学元素选择
. 代表class
# 代表id
不写 代表标签名
例如:
.a{样式}
#{样式}
div{样式}
相似回答