在 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 中起感召。