div tags
daherrera
Status: New User - Welcome
Joined: 09 Jan 2008
Posts: 1
Reply Quote
I am new at this and I encountered a problem using div tags.
When I preview my website in Internet Explorer it works good but when i preview it in firefox my divs move all the way to the left. I dont see what can be the problem.
If someone can help this noob it would be great
Back to top
erikZ
Status: Contributor
Joined: 30 May 2004
Posts: 148
Reply Quote
First, since Microsoft internet explorer has very buggy css handling, you need to develop in a good browser, then debug your stuff for MSIE.

Trying to debug buggy code in the first place is very hard, it's much easier to debug good code to make it work in a buggy browser like MSIE

Minimum browsers to test on: opera, www.opera.com
firefox: www.mozilla.com

Your problem sounds like you tried implementing floats to position your divs, and your math is slightly off.

To solve float issues like this, try setting the widths when added up to = 99.8%, not 100.00%. There are some strange little bugs with how browsers, and browser themes, calculate, and influence, the actul pixel available widths.

Also keep in mind the CSS box model (and here), where container total width is the highly unintuitive sum of: declared css width + padding width + border width.

And also this will depend on if you made the page with a doctype or not. Having no doctype triggers what's known as 'quirks mode', which then results in unpredictable handling of things like widths.

So always use a doctype (and here), choose the simplest for your needs, usually html 4.01 transitional is what works best for new users since it's the least demanding.

replace <html> with
:: Code ::
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

Using xhtml is pointless unless you actually understand how, why, when, and where, to use it. Error filled XHTML is the stupidest thing you can really do in my opinion, it defeats the entire purpose of xhtml in the first place.
Back to top
Display posts from previous:   

All times are GMT - 8 Hours