CSS .class 选择器
完整CSS选择器参考手册
实例
Select and style all elements with class="intro":
.intro
{
background-color:yellow;
}
尝试一下 »
定义和用法
The .class选择器是指定类的所有元素的样式。
Browser Support
![Internet Explorer Internet Explorer](https://file.ai100.com.cn/files/article-content/original/eaa8ba0c-0c39-4484-9719-e084d0e59156/compatible_ie.gif)
![Firefox Firefox](https://file.ai100.com.cn/files/article-content/original/47cbd4ff-cf9c-430e-be20-b9773127e574/compatible_firefox.gif)
![Opera Opera](https://file.ai100.com.cn/files/article-content/original/1230200f-a0d1-4798-8176-0db12afe2239/compatible_opera.gif)
![Google Chrome Google Chrome](https://file.ai100.com.cn/files/article-content/original/3f9d0da1-012f-4e02-8470-2911dcd22985/compatible_chrome.gif)
![Safari Safari](https://file.ai100.com.cn/files/article-content/original/f52dc10a-31b1-4eb7-8d47-eb09ff04c931/compatible_safari.gif)
所有主流浏览器都支持.class选择器
![Examples](https://wxt.sinaimg.cn/large/d1613165ly1g6rzncprmpg201401a0lf.jpg)
更多实例
实例
Style all <p> elements with class="hometown":
p.hometown
{
background-color:yellow;
}
尝试一下 »
完整CSS选择器参考手册
尊贵的董事大人
英文标题不为空时 视为本栏投稿
需要关键字 描述 英文标题