Div Layering Secret (Advanced)

HTML Tutorials


Click on thumbnailed images to enlarge

You should already know about div layering before you attempt this.

A while ago (actually a long time ago), a friend of mine taught me a little secret when it comes to div layering that some of you may or may not know.

This is basically a little thing to toy around with for those of you that have experienced positioning issues with IE or FF when attempting to position in one browser without it coming out right in the other.

<div style="position:absolute; overflow:auto; width:#px; height:#px; margin-top:#px; margin-left:#px; _margin-top:#px; _margin-left:#px;">

Now, do you see the "margin-top" and "_margin-top"?

I'm using the property "margin-top" as an example.

To explain this: certain browsers read certain things. The underscore you see (_margin-top:#px;) means that ONLY IE will read it. You can position the regular "margin-top" as you see it fit in FF.

Hope this helps! :)

Tutorial Comments

Showing latest 10 of 39 comments

please can u help me with DIV layouts
im new to this stuff
thats y I signed up to
this website but i dont get
any of this stuff u__u

By mm27 on Aug 16, 2009 1:22 pm

i could kiss you, if this weren't the internet! thx for the tip!

By ingodwerust on Aug 11, 2009 12:40 am

Haha, holy crap, WOW!!

By lesliewelcomesyou on Jul 22, 2009 4:31 pm

So many visitor complaints about using IE with website layouts.

I will never have to read another one again.


By diningwiththeenemy on May 8, 2009 9:18 am

Somewhat helpful if I even care what others see if there not using my browser. but hey. NEAT!

By JenniferCecelia on Mar 5, 2009 5:22 pm

Hey, Im new & i was wondering if you could show me how to make a DIV layout. Im like COMPLETELY LOST. lol. I know basic HTML but I know nothing about layouts

By amazinq-dori on Jan 25, 2009 4:23 pm

I want to know how to make a div if you could please show me thanks (:

By kara2013 on Nov 30, 2008 2:07 pm

will someone PLEASE show me HOW to make a div to start with?

i'd LOVE to learn how.


By synshadowsvengeance on Nov 17, 2008 12:36 am

wow. thanks~
i'll remember to use this when i make a web layout.

By ChauVu93 on Nov 8, 2008 1:39 pm

hey. thanks for the tip.
I used it and it works beautifully. I can't get in lined up in Safari- any tips?

By flukedflautist on Sep 22, 2008 4:36 pm
View all »

Tutorial Details

Author ScarletNight View profile
Submitted on Feb 24, 2007
Page views 71,077
Favorites 119
Comments 39

Tutorial Tags