文本对齐:-webkit-center与文本对齐:中心 [英] text-align: -webkit-center vs text-align: center
问题描述
有人知道为什么text-align:center和text-align:-webkit-center之间有区别吗?例如,如果您有:
Does anyone know why there is a difference between text-align: center and , text-align:-webkit-center ? For example if you have :
<section>
<h1>Title<h1>
<div class="image"></div>
</section>
// CSS与text-align:center;
// CSS with text-align: center;
section{
text-align: center;
}
这将使文本居中
//带有文本对齐方式的CSS:-webkit-center
// CSS with text-align: -webkit-center
section{
text-align: -webkit-center;
}
这将使文本和图像居中。
This will center the text and the image.
对于文本对齐也是如此:-moz-center;
Same goes for text-align: -moz-center;
推荐答案
来自Mozilla开发人员网络:
From the Mozilla Developer Network:
WebKit和Gecko都支持left,center和right的前缀版本,这不仅适用于内联内容,而且适用于block元素。这用于在
表
元素和< center> <上实现旧式
align
属性/ code>。请勿在生产网站上使用它们。
Both WebKit and Gecko support a prefixed version of left, center, and right, that applies not only to inline content but also to block elements. This is used to implement the legacy
align
attributes ontable
elements and<center>
. Do not use these on production Web sites.
- MDN关于 text-align
的文档。
这篇关于文本对齐:-webkit-center与文本对齐:中心的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!