有什么原因不能在周围放置边框吗?在使用 CSS 的 html 表中
我有一个表和一个 tr,其类设置为“underRow”。
在CSS中我有:
.underRow {
border-bottom-color: #7a26b9;
border-bottom-style: solid;
border-bottom-width: 1px;
}
但是行边框似乎根本没有改变。如果我将类属性向下移动到 td ,它就可以正常工作(但问题是我在单元格之间的填充中间有一个空格。我想避免这个空格并在行下方有一条直线。
是将 CSS 边框属性放在行 (tr) 元素上有什么问题吗?
以下是此表中的 CSS 其余部分以供参考:
.quantityTable {
border-radius: 5px 5px 5px 5px;
background-color: #d6b4E1;
padding: 5px;
margin-bottom: 5px;
width: 100%;
border-width: 2px;
border-color: #7a26b9;
border-style: solid;
}
I have a table and I have a tr with a class set to "underRow".
In CSS I have:
.underRow {
border-bottom-color: #7a26b9;
border-bottom-style: solid;
border-bottom-width: 1px;
}
but the row border doesn't seem to be changing at all. If I move the class attribute down to the td's it works fine (but the issue is that I get a space in the middle where the padding is between the cells. I want to avoid this space and have one straight line below the row.
Is there anything wrong with putting CSS border attributes on a row (tr) element?
Here is the rest of the CSS on this table for reference:
.quantityTable {
border-radius: 5px 5px 5px 5px;
background-color: #d6b4E1;
padding: 5px;
margin-bottom: 5px;
width: 100%;
border-width: 2px;
border-color: #7a26b9;
border-style: solid;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不,它应该有效。
请参阅: http://jsfiddle.net/jasongennaro/qCzrg/
折叠边框
也许您需要使用或其他样式 因为
TD
是最重要的,您可以显示更多代码吗?
根据您的编辑:
听起来你肯定需要
border-collapse
你应该将它添加到
table
的样式中。这里有更多关于它的信息: http://www.the-art-of-web.com/ css/bordercollapse/
编辑 2
基于新代码和以下注释:
我猜你想要像这样的
示例: http://jsfiddle.net/jasongennaro/ qCzrg/1/
注意
我把半径调大了,这样你就可以更容易看到它。
我还删除了表格本身的边框
No it should work.
See this: http://jsfiddle.net/jasongennaro/qCzrg/
Perhaps you need to collapse your borders with
Or maybe other styles for the
TD
is overridingCan you show some more code.
As per your edit:
Sounds like you definitely need
border-collapse
You should add it to the style of the
table
.Here's a bit more about it: http://www.the-art-of-web.com/css/bordercollapse/
EDIT 2
Based on the new code and the following comment:
I am guessing you want something like this
Example: http://jsfiddle.net/jasongennaro/qCzrg/1/
NOTE
I made the radius bigger so you could see it easier.
I also removed the border from the table itself
某些浏览器的某些版本不支持在
tr
元素上设置边框样式。您始终可以将它们设置在其
td
上。如果存在边框间距,您可能需要使用
border-collapse:collapse;
折叠表格边框。Some versions of some browsers don't take kindly to setting border styles on
tr
elements.You can always set them on their
td
s instead.If there is border spacing you may need to collapse your table borders using
border-collapse: collapse;
.