在 CSS 中,类选择器以一个点号显示
2019年11月30日
作者:佚名
在 CSS 中,类决意器以一个点号透露表现:
.center {text-align: center}
在下面的例子中,所有领有 center 类的 HTML 元素均为居中。
鄙人面的 HTML 代码中,h1 与 p 元素都有 center 类。这意味着两者都将听命 ".center" 决意器中的规则。
<h1 class="center"> This heading will be center-aligned </h1> <p class="center"> This paragraph will also be center-aligned. </p>
属意:类名的第一个字符不克不及使用数字!它无奈在 Mozilla 或 Firefox 中起劝化。