简体   繁体   English

如何使表格边框适用于所有浏览器?

[英]How can I make a table border work on all browsers?

I have a table with a border.我有一张带边框的桌子。 Right now, the border works on Brave browser.现在,边框可以在 Brave 浏览器上使用。 On Chrome and Safari, the border extends out too far.在 Chrome 和 Safari 上,边框延伸得太远。 If I make it smaller, the border ends before the <td> .如果我把它变小,边框会在<td>之前结束。 Is there a way to make it so that it is only as long as the <td> ?有没有办法让它和<td>一样长? Sorry if this is really obvious I'm kind of new to this and couldn't find any information online.抱歉,如果这真的很明显,我对此很陌生,无法在网上找到任何信息。 Right now I have:现在我有:

 /* not much to show but this is what happens in Chrome/Safari */ table { display: block; text-align: center; font-family: 'Jost', sans-serif; border: 7px solid red; border-radius: 13px; width: auto; margin-right: 8%; margin-left: 8%; border-spacing: 3px; } td { background-color: yellow
 <table> <tr> <td>text</td> <td>text</td> <td>text</td> <td>text</td> <td>text</td> </tr> </table>

From W3: Block - Displays an element as a block element (like来自 W3:块 - 将元素显示为块元素(如

). ). It starts on a new line, and takes up the whole width .它从一个新行开始,占据整个宽度

Remove the display type: https://www.w3schools.com/cssref/pr_class_display.asp去掉显示类型: https://www.w3schools.com/cssref/pr_class_display.asp

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM