Jump to content
Killersites Forums

CSS Positioning


virtual
 Share

Recommended Posts

I just read an article where the author states

When you have odd issues between browsers where elements vanish, don?t show or are a few pixels out of alignment, it?s normally because you are guilty of using margin and padding for positioning your elements. This is wrong because margin and padding were not designed to do that.

Positioning comes in 4 flavours: static, relative, absolute and fixed.

 

I was rather surprised that he didn't mentioned floats as I regularly use static position (undeclared) and floats and very rarely the others. I usually don't have major problems with positioning, except for the usual IE bugs, and I just wondered what sort of positioning you guys use on a regular basis? Is there a prefered method or is it just a matter of personal choice?

Link to comment
Share on other sites

Same here; I start by styling divs without any position, using floats and margins and often the whole page can be like that.

 

I only use position: relative where I have to use position: absolute elements inside for some reason (perhaps layering over something else) and they need to relate to the top left corner of the position: relative parent, and also where I need something like a drop down menu to show over a flash or javascript image and position: relative plus a z-index is necessary.

Link to comment
Share on other sites

@Wickham and Jim

 

Thanks for the insight, that's exactly how I code too.

 

I have been helping out on another forum, the article I read was from one of the mods, and I noticed that most of the CSS questions are problems due to the relative positioning and of course lack of validation.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...