当前位置: 首页 > 工具软件 > Stupid Table > 使用案例 >

css width 100% 火狐,html - CSS: table {width:100%; display:block;} not working in Firefox - Stack Over...

窦彦君
2023-12-01

I have an html table within a div of a specific size. I want the table to apply margin collapse and be 100% wide. Here is my code. It renders how I want it to in IE8 and incorrectly in Firefox. Firefox may be doing the spec correctly, but whatever. How do I fix my css to work in both browsers?

Untitled 1

table

{

border-collapse: collapse;

border-spacing: 0;

}

table

{

margin: 10px 0;

width: 100%;

display: block;

}

p

{

margin: 10px 0;

}

td, th

{

border: 1px solid #000000;

}

Some text at the top. Notice that the margin collapse does not work unless display:block.

Header 1Header 2Header 3
Label 11.A1.B1.c
Label 22.A2.B2.c

Some text at the bottom. Notice that the margin collapse does not work unless display:block. Its stupid.

I need the display:block for margin collapsing to work in Firefox. If you remove the display:block, you should notice that the spacing between the

tags widens from 10px to 20px.

This is also an edit to this question that I posted earlier, but it won't let me edit for some reason. I've been messing around with my internet cache so I probably messed up a cookie.

 类似资料: