Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 02-10-2010, 05:05 PM   #1
nico-t
emperor of my world
 
Join Date: Aug 2004
Location: nethalands
Posts: 29,903
IE8 div inside a div inside a div = white space.

I just love this about making a new site. Well here's the problem ive been struggling for the last hour.
In FF everything works as it should, ofcourse. IE8 adds about 10 pixels of space on top of the text. Here is the html:

<div id="main"> <!--div main starts-->
<div id="content"> <!--div content starts-->
<div id="insidecontent"> <!--div insidecontent starts-->
Text blablabla
</div> <!--div insidecontent ends-->
</div> <!--div content ends-->
</div> <!--div main ends-->

All divs in the css have:
margin: 0px;
padding: 0px;

So why does IE8 add this white space to the top of the text? When i put text in the first and second div there is no white space at all, but in the third div there is.
nico-t is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-10-2010, 05:19 PM   #2
pstation
Confirmed User
 
Join Date: Jul 2003
Location: chicago
Posts: 1,135
try putting the </div> at the end of the text without any newspace or newlines
pstation is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-10-2010, 05:29 PM   #3
nico-t
emperor of my world
 
Join Date: Aug 2004
Location: nethalands
Posts: 29,903
doesnt work
nico-t is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-10-2010, 05:38 PM   #4
HighEnergy
So Fucking Banned
 
Join Date: Apr 2007
Posts: 806
It helps (crossbrowser results) to include everything in the body tag first.
body {
font-size: whatever;
line-height: whatever;
letter-spacing: whatever;
etc
etc
etc
}

Also, for paragraph & header text, margin, padding
h1 {font-size: whatever; margin:whatever; padding: whatever;}
h2 {font-size: whatever; margin:whatever; padding: whatever;}
h3 {font-size: whatever; margin:whatever; padding: whatever;}
h4 {font-size: whatever; margin:whatever; padding: whatever;}

p {margin:whatever; padding: whatever;}

You'll get more predictable crossbrowser results getting in that habit.
HighEnergy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-10-2010, 05:40 PM   #5
The Truth Hurts
Hb17uaaldwM
 
The Truth Hurts's Avatar
 
Industry Role:
Join Date: Nov 2002
Location: In Your Skull
Posts: 15,144
i took your code exactly as you posted it and it's looks identical in EVERY browser.
so you've apparently got something else going on.
The Truth Hurts is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-10-2010, 05:48 PM   #6
JamesK
hi
 
Industry Role:
Join Date: Jun 2002
Posts: 16,731
I think the 10 pixels comes from the text inside the div. the P element (paragraph) is creating a margin. could be a heading (h1, h2 etc) aswell.

either add this to that element (p, h1 whatever):
Code:
style="margin-top:0;"
or this to your css file
Code:
.firstitem { margin-top: 0; }
AND this to the element
Code:
class="firstitem"
__________________
M3Server - NATS Hosting
JamesK is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-10-2010, 05:58 PM   #7
nico-t
emperor of my world
 
Join Date: Aug 2004
Location: nethalands
Posts: 29,903
yea the code posted wasnt the whole code, theres also a sidebar and that was screwing things up.. i made dozens of wordpress sites and didnt encounter this before so thats why i didnt post it.
Anyway, i put a 1px dot, line height 0px, in the first div like this:

<div id="main"><p class="smalldot">.</p><div id="content"><div id="insidecontent">

and this somehow aligns all divs and texts the right way. Thanks for your efforts peeps.
nico-t is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-10-2010, 06:09 PM   #8
CPimp
Confirmed User
 
CPimp's Avatar
 
Industry Role:
Join Date: Aug 2009
Posts: 2,346
Your beginning and end tags need to be on the same line if you dont want white space. IE8 appends an "Empty Text Node" in the source code if it detects line breaks that you use in your code, meaning when you use a plain text editor and try to keep your code clean and separate lines, it thinks there's an empty text line there. I bitched and bitched about it till I decided to tinker around with it, put ALL my div contents on one line, and it worked like a breeze.
__________________
three 997 three 55 three 1 ← That's my ICQ. Contact me there. Thanks.
CPimp is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-10-2010, 07:19 PM   #9
potter
Confirmed User
 
Industry Role:
Join Date: Dec 2004
Location: Denver
Posts: 6,559
I will guarantee it's either a line height issue, or it's simply the way the text is displayed on the other browser.

FYI: Text looks different on every browser. For example, 12px Verdana does NOT look exactly the same between all the browsers. Which could be what you are seeing.
__________________

potter is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.