Forum Moderators: open

Message Too Old, No Replies

the white bit

Can I get rid of the gap at the top?

         

Feralsteve

1:42 pm on May 18, 2002 (gmt 0)



Hiyas,
I have been trying to help out a friend with his site and would like to know if there is a way I can remove the gap above a table I have at the very top of the page?
The way he had it was with a background image to produce a coloured margin down the left side of the page with text links in it....
This looks great in 800x600 but any other res the page gets screwed up.
I was thinking you could have the same effect with using background colours in tables, but the gap at the top of the page above the table looks yuk...
Can anyone please help us out here??
Thanks in advance
Steve

gsx

1:46 pm on May 18, 2002 (gmt 0)

10+ Year Member



Make sure you do not have any newline between <body> and <table>.

The newline character will be treated as a space. You should use:

<body><table>

rather than:

<body>
<table>

You would think it to be the same, but it is not.

tbear

2:29 pm on May 18, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Perhaps this will work for you.
<body topmargin="0">
you can do the same for left, right margins too....

nwilson

2:38 pm on May 18, 2002 (gmt 0)



or in you css

body {
margin-top: 0;
}

Nick

brotherhood of LAN

2:49 pm on May 18, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Nice one folks

Since this thread is on the subject....does anyone have any reasoning behind having/not having the margins? For one, yeah, you get a teeny bit more space to play with....but is there anything else involved here? (im sure someone has a list of reasons as to why they chose a nomargin site) :)

papabaer

4:08 pm on May 18, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It's an issue of layout and presentation control.

Back in the "old days" where where content was laid out as a simple document, browsers provided default spacing so headings and paragraphs did not "butt-up" flush against the sides of the display window.

It was when Web developers moved from simple document creation to "desktop publishing" that the ability to control margins became an issue. Logos, images, colored tables and contrasting table cells were the hot new toys. Add the today's popular <div> and throw in some DHTML, and margin control gains even greater importance.

The default "padding" that browsers once inserted as a "nicety" now became an annoyance.... to those developers from the "design school" of Web site creation.

Also consider FRAMES, at times, Internet Explorer will obscure content on the right "margin" of a content frame that invokes a scrollbar AND relies on default margins. The scrollbar does not "push" the content to the left, it simply covers it up. This "problem" is easily overcome through the use of margins or padding.

There are enough exceptions and variations to more than justify the need for margin control if a Web document will include "side-hugging" design elements or trigger scrollbars.

For most applications, margins (the defined space outside of an element's default boundry) and padding (the defined space between and element's default boundry and the content within) are mostly interchangeable. It is important however to know the differences between the two, especially if you "sidle over" into the realm of CSS-P! ;)