PDA

View Full Version : Need help with div tags



Mccall101
Mar 17th, 2009, 02:37 AM
Alright so I had placed my first image in my page and it showed up. Then i went to put my other header in that goes directly below it. It went below it but there was a white space in between. What kinda of div tag do I put so that they connect?

Also im in need of some web designer buddys.

BoldUlysses
Mar 17th, 2009, 02:45 AM
What you're seeing is most likely the default margin/padding put in between the divs by the browser. Every browser's defaults are a little bit different, hence reason for what's called a CSS reset (http://meyerweb.com/eric/tools/css/reset/).

If that is indeed the problem, you have a couple of options to fix it. The first is just to zero out the margins/padding on all your divs, e.g.:


div {
/* other attributes, etc... */
margin:0;
padding:0;
}

Or, the other option is just to zero out the margins and padding on every element. This is what most web designers do at the beginning of their CSS. As mentioned above, every browser's defaults are a little bit different, contributing to cross-browser appearance differences. Zeroing out margins and padding up front, among other things, helps "level out the playing field" so that a page in Firefox stands a much better chance of looking the same in IE.

To do this, a quick and easy way is to use the "universal reset."


* {
margin:0;
padding:0;
}

The * simply means "everything."