home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Ask a Tech Support Question (free)!

How do you get CSS DIV layout to look correct cross browser?

Reply
Get bargains at  »  Dealighted.com
 
Thread Tools Search this Thread
Currently Active Users: 1777
Discussions: 200,950, Posts: 2,379,452, Members: 246,312
Old April 4th, 2007, 08:44 PM   Digg it!   #1 (permalink)
Member
 
Join Date: Jun 2004
Posts: 178
How do you get CSS DIV layouts to look correct cross browser?

Hi

I'm building a new site, and tried doing it using CSS DIVs instead of tables, as I read it's a better practice.

I was testing it in IE7, and all was well. Then I tested it in Netscape and Firefox, and the DIVs were way out. Then I tested in IE6, and it's out in a different way. The site that I modeled mine on uses DIV layouts, and theirs is fine in all browsers.

It seems padding and margins are treated differently in the browsers, so how do you successfully use DIVs to layout your site?

The site is at www.bigbadroo.com.au/litecommerce - still very much under construction

Cheers

Shaun
__________________
I'm looking for a male vocalist to work with. Go to http://people.aapt.net.au/celebritymusic/s...ikingsmith.html to email me

Last edited by celebritymusic : April 4th, 2007 at 08:53 PM.
celebritymusic is offline   Reply With Quote
Old April 4th, 2007, 09:02 PM     #2 (permalink)
SoMuchAnime-SoLittleTime
 
EXreaction's Avatar
 
Join Date: Aug 2003
Location: Plymouth, WI
Posts: 14,983
Blog Entries: 1
Send a message via MSN to EXreaction
There is no reason to write your code only one way because some people say it is better.

What ever way works best is the way you should do it, not the way a bunch of kiddies say it "should" be done. If both can produce the same thing do whatever is easier.
__________________
My photography: Flickr

Lithium Studios - phpBB3, PHP, and Web Development
EXreaction is offline   Reply With Quote
Old April 4th, 2007, 09:26 PM     #3 (permalink)
ph34r t3h g04t
 
Whir's Avatar
 
Join Date: Oct 2001
Location: Kingsford, MI
Posts: 19,558
Blog Entries: 7
If by "kiddies," you mean W3C, then I would have to say that I disagree with you.


The only way to find the balance between IE rendering and everyone else is to experiment. I use an all <div> layout on 95% of my sites now, but figuring out how to get IE and Firefox to render them the same way was just tweaking until it worked.

I think I try to use padding and margin on the content more than the container, because it seems to work better for cross-browser compatibility. Obviously there are times when you simply have to put margin on the container, for spacing cells with borders for instance, otherwise...
Whir is offline   Reply With Quote
Old April 4th, 2007, 11:10 PM     #4 (permalink)
Member
 
Join Date: Jun 2004
Posts: 178
OK - I'm going through the site, cleaning it up bit by bit so it looks close enough to the same in both browsers.

I've got the top login header the same.

The next DIV down called wrapper is fine in Firefox, but it wants to sit about 20px down the page in IE. It only does this before the user has logged in, and then the page jumps up where it should be. I thought it might be one of the login widgets causing the problem, but can't see where.

Any ideas as to what might be going on? the top divs and wrapper div have margins of 0

Cheers

Shaun
celebritymusic is offline   Reply With Quote
Old April 4th, 2007, 11:29 PM     #5 (permalink)
ph34r t3h g04t
 
Whir's Avatar
 
Join Date: Oct 2001
Location: Kingsford, MI
Posts: 19,558
Blog Entries: 7
IIRC, IE and Firefox set up the space between div elements differently, that may be it. Or if it's a script login, it might be adding a space for some random reason from that.
Whir is offline   Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Similar Threads
Thread Thread Starter Forum Replies Last Post
CSS layout? Kphu Webmastering and Programming 12 March 20th, 2007 06:58 PM
Please help me with a little CSS layout celebritymusic Webmastering and Programming 1 March 1st, 2007 10:32 AM
How to make a DIV rest at the bottom of another DIV in CSS? celebritymusic Webmastering and Programming 1 March 1st, 2007 10:15 AM
CSS DIV Problems Cyberlore Webmastering and Programming 0 March 6th, 2004 03:49 AM
Cross Browser CSS Issues? Cyberlore Webmastering and Programming 6 January 14th, 2004 05:36 PM


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Most Active Discussions
The disrespect of Obama by Russian .. (36)
Is It Just Me? (2941)
Making Health Care Worse (177)
Wireless Televisions. (12)
CPU fan stops spinning randomly (8)
windows 7 problem (7)
Regular Build (7)
radeon x850xt platinum & shader.. (6)
Is the PSU I received dead? (12)
Print spooler problem (15)
windows vista security holes (10)
HIS HD5770 graphic card question (15)
Dept. of HS: NSA 'Helped' Develop V.. (16)
Install XP pro and a Vista laptop ?.. (11)
Recent Discussions
Dept. of HS: NSA 'Helped' Develop Vis.. (16)
EVGA 9800 gtx help with finding a goo.. (10)
Modern Warfare 2: Who Bought It? (62)
windows vista security holes (10)
Internet Lost (2)
Point and Shoot Camera Suggestions. (4)
Regular Build (7)
Multiple Restarts Required at Boot (2)
Ideal cheap graph card for PC-Gaming? (18)
radeon x850xt platinum & shader 3 (6)
Graphics Card Upgrade Question (4)
For Sale BFG GTX285 OC2 with 10 year .. (3)
How to convert MP3's (4)
Wireless Televisions. (12)
Laptop with wireless problem. (2)
Hp Artist Edition + Matching Bag (0)
My monitor won't turn on after instal.. (0)
Asus P4G8X Mobo (6)
Xbox 360 GTA: SA disk error (1)
Is the PSU I received dead? (12)
windows 7 internet problem (5)
BSOD On Startup (ntoskrnl.exe) (2)
Print spooler problem (15)
Have you switched yet? (86)
screen resolution vs monitor size (2)


All times are GMT -4. The time now is 12:48 AM.
TechIMO Copyright 2009 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28