Style Multiple Elements with a CSS Class


你可以在 HTML 元素的开始标记中通过使用class="your-class-here"来将 class 附加到相关元素中。

CSS 类选择器必须添加.为前缀,如下:

.blue-text {
  color: blue;
}

但在HTML中class属性的值不需要添加.为前缀,如下:

<h2 class="blue-text">CatPhotoApp</h2>

red-text类应用到h2p元素中。


CSS 类选择器应用到多元素中

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-03-07
  • 2022-02-03
  • 2021-10-30
  • 2021-12-28
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-06
  • 2022-12-23
  • 2021-11-13
  • 2021-12-19
  • 2021-12-27
相关资源
相似解决方案