如下代码:
<style>
.greenfont {color: green; font-size: 14 pt;}
</style>
引用:
<p class="greenfont ">好用的样式</p>其中引用的class是起什么作用的啊!!!
<style>
.greenfont {color: green; font-size: 14 pt;}
</style>
引用:
<p class="greenfont ">好用的样式</p>其中引用的class是起什么作用的啊!!!
.greenfont {color: green; font-size: 14 pt;} 怎么能关联到“好用的样式”上呢?体会一下
.greenfont {color: green; font-size: 14 pt;}
</style>
引用:
<p class="greenfont ">好用的样式</p>运行结果跟 <p style="color: green; font-size: 14 pt;">好用的样式</p> 一样
把 .greenfont 在<style></style>标记里面写有利于代码的重用
如果你的样式表里面定义好了各个样式
那么在页面中就可以直接引用了
就如:class="这里写你已经定义好的样式:如greenfont"