1
我搜索了这个,但没有找到解决方案。 我有一个文本锚点。中心对齐在一个div内的锚文本
锚点的高度和宽度由JS上的DOM负载设置 我需要垂直和水平居中的锚内文本。
遵循许多有关居中元素的教程。他们都没有工作。
这里是我的html
<a href="#" class="wpsc_category_grid_item" title="Category1">
<span>Category1</span>
</a>
我的CSS
.wpsc_category_grid_item {
background: #000;
margin:1px;
float:left;
text-align: center;
display:table;
}
.wpsc_category_grid_item span{
display: table-cell;
vertical-align: middle;
width:100%;
height:100%;
color:#fff;
text-align: center;
font-weight: bold;
text-decoration: none;
}
我需要这些文本,垂直居中以及..
纵横中心页面上或者一些其他元素里面? –
不是以什么浏览器为中心?它在Firefox和Chrome中显示为我居中http://jsfiddle.net/fYpub/ – Duopixel