我有一个样式如下的 DIV 元素:
<div style='float: left; width: 100px; position: relative; top: +5px;'>
This is some text
</div>
当我将样式移动到外部样式表时,“top: +5px;”位未应用于文本,但样式的其余部分是:
div.textthumb {
float: left; width: 100px; position: relative; top: +5px;
}
...
<div class='textthumb'>
This is some text
</div>
请问我做错了什么?
最佳答案
您样式中的“+”是不必要的,只有在您要寻找负边距时才需要符号:
div.textthumb {
float:left; width:100px; position:relative; top:5px;
}
如果这不能解决您的问题,那么您可能需要寻找您指定的另一种样式来覆盖它。在 chrome 或 firebug 中使用开发者栏会帮助你。
关于css - 外部样式表中的样式与使用 style= 不同,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25891224/