tags:

views:

176

answers:

2

Using html and css for IE7, how do I position a html table at the very top of the screen without the top border that is automatically generated?

I am developing in vs2008.

+4  A: 

You are probably seeing the default margins of the document body. Set the margin to 0 on the body, preferably using css. I recommend using a reset css to set the default style for your pages in every browser, there are penty on the net. Sample:

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
    margin: 0;
    padding: 0;
    border: 0;
    outline: 0;
    font-size: 100%;
    vertical-align: baseline;
    background: transparent;
}
body {
    line-height: 1;
}
Ariel Popovsky
Setting margin, padding, border, and vertical-align of body to 0 individually and together did not remove the border on top.
Lill Lansey
Ok, found it. A Div containing the table had padding set. Thanks.
Lill Lansey
+1  A: 

Remove the border on your table.

CSS approach:

table / #id-of-your-table / .class-of-your-table { border: 0; }

Inline style approach:

<table style="border: 0;"> ... </table>
roosteronacid