css如何对某个div里的元素进行修饰比如:<h2>

html-css020

css如何对某个div里的元素进行修饰比如:<h2>,第1张

可以直接给H2加class或者id,也可以给div加calss,

<div calss="style">

<h2>one</h2>

</div>

<Style>

.style h2{样式}

</style>

<div class='a'>文字1</div>

<div class='a'>文字2</div>

css:

.a{

color:#f60

}

这样字体颜色就都变了,其他样式属性类推即可