[英]Trouble styling TD elements from external stylesheet
I'm trying to port code over from using inline css to using a stylesheet and as I'm pretty much a total css noob I'm having trouble. 我正在尝试将代码从使用内联css移植到使用样式表,由于我几乎是一个整体css noob,我遇到了麻烦。
Most of the things I've moved over to external have worked fine, but I can't seem to get TD elements to use styles defined in the stylesheet. 我移到外部的大多数东西都工作正常,但是我似乎无法让TD元素使用样式表中定义的样式。 Here's an example:
这是一个例子:
<td class="text_right">...</td>
.text_right {
text-align: right;
}
Why doesn't that work? 为什么不起作用?
<td class="text_right"><a>...</a></td>
.text_right {
text-align: right;
width: 300px;
}
that should work , put you text in <a>
tags 应该起作用,将文本放在
<a>
标记中
Try using !important . 尝试使用!important。 Like this ;
像这样 ;
.text_right {
text-align: right !important;
}
if you still see it not aligned please check css for that element overridden rules (with chrome or opera) by right click and investigate 如果您仍然看到它未对齐,请通过右键单击检查该元素的CSS覆盖规则(使用Chrome或Opera)并进行调查
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.