Reputation: 693
I have a html table for displaying data. I have the typical width="100%"; but it did not work. Here is what my page looks like and my CSS/HTML styling. How can I fix it to auto fit the screen?
Code:
<table style="border: medium solid #FFFFFF; background-color: #000000; position: fixed;"
border="3" width="100%";>
Upvotes: 3
Views: 46461
Reputation: 34177
You have 100% width plus a border. This is greater than 100%.
HTML
<table class="tbl" cellspacing="0" cellpadding="0">
CSS
.tbl{
position:fixed;
width:100%;
border:3px solid #fff;
background:#000;
box-sizing:border-box; /* causes item size to include border and padding */
-moz-box-sizing:border-box; /*for browser compatibility*/
}
Upvotes: 0
Reputation: 29285
Add this CSS:
body {
margin: 0
}
Because the default margin for body
element in not 0
Upvotes: 1
Reputation: 71150
Make sure your body
element has padding
and margin
set to 0
Without setting this vs when this is set
html, body{
height:100%;
width:100%;
padding:0;
margin:0;
}
Upvotes: 8