在 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 中起感召。
如需转载,请注明文章出处和来源网址:http://www.divcss5.com/rumen/r52812.shtml