【发布时间】:2013-12-18 16:48:43
【问题描述】:
我无法弄清楚为什么我在标签之间的图像没有与中心对齐,即使我已经声明了 css inline ,但优先级不起作用。
我已经在 <style> 标签中声明 text-align 为左对齐,但我只希望这个特定标签居中对齐,而不是其他标签。
这是我的html,
<td class="ospy_td" style="background-color:#ddd;border-bottom-left-radius:5px;style=text-align:center">
<label class="ospy_lab" style="text-align:center">
<img id="bt" src="img/bt.png" width="30" height="29" />
</label>
</td>
这是我的 CSS,在同一个 html 页面的标签中定义,
.ospy_td, label {
text-align: left;
vertical-align: middle;
cursor: default;
font-weight:normal;
color:#0066c0;
};
【问题讨论】:
-
您介意清理您的代码(从字符串连接中删除引号等)还是至少在此处复制并粘贴页面源代码?
-
是的,抱歉
-
你错过了还是在源代码中真的是这样?
<\/label> -
您不能在样式中嵌套样式:style=text-align:center 在您的样式属性中。
-
您的
<img/>需要display: inline或display: inline-block才能使text-align产生任何影响。
标签: html css css-float stylesheet