Jump to content

relative positioning?


michaellunsford

Recommended Posts

I have a grasp of CSS basics, but I'm still green. Just trying to migrate away from tables.

First step: 800x600 background image centered with CSS. Works great. Now, I want to position a div on top of the background image on a very specific spot. Since the background is centered, can I make something relative to center?
Link to comment
Share on other sites

Hi there,

You could do what moberemk suggested and use a div to surround everything else and use margin:auto You should also use text-align:center for it to work in IE. To make it show up 250 px right, i suppose you can set position:relative and set right:250px

The problem is the vertical-alignment. if i am not wrong, css at the moment still lacks support for vertical alignment of elements in a div. There are several workarounds for this which can be easily googled.

I have never liked these workarounds and hacks and so have, (sadly) returned to the table method once in a while.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.