
1)
<style type="text/CSS">.block .Title {color:red}.anotherBlock .Title {color:blue}</style>...<div > <h3 >SomeTitle</h3></div><div > <h3 >anotherTitle</h3> </div> ... 2)
<style type="text/CSS">.blockTitle {color:red}.anotherBlockTitle {color:blue}</style>...<div > <h3 >SomeTitle</h3></div><div > <h3 >anotherTitle</h3> </div> ... 第一个代码看起来更干净,但它可以让某人认为h3标签将具有相同的样式属性.
解决方法<style type="text/CSS">.block h3 {color:red}.anotherBlock h3 {color:blue}</style>...<div > <h3>SomeTitle</h3></div><div > <h3>anotherTitle</h3> </div> 为什么?因为它与您的示例一样可读,但写入的代码较少=在用户浏览器中渲染的时间较少
总结以上是内存溢出为你收集整理的html – 具体类名称与类层次结构全部内容,希望文章能够帮你解决html – 具体类名称与类层次结构所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)