Jump to content

Trouble Floating Text Over Image


buddhi225

Recommended Posts

Hi, I'm a bit of a CSS newbie so bear with me please.

 

I have a header graphic with navigation links. I want to float some more text links over the top right corner of this image. The image uses an image map so I can't use it as background image.

 

I'm able to place the text where I want in the image, the problem is that it pushes the image down on the page. I want this image to be at the very top of the page and the only way it doesn't move is if I use absolute for the positioning of the text, which I don't want to use.

 

<div id="topnav"> 
<div id="links"> 
<p><a href="#">Home </a>¦ <a href="#">Blog</a></p> 
</div> 
<img src="http://www.example.com/image.jpg" width="757" height="74" /></div>

 

#topnav { 
width: 757px; 
margin-top: 0px; 
margin-right: auto; 
margin-bottom: 0px; 
margin-left: auto; 
} 
#links { 
position: relative; 
top: 20px; 
left: 0px; 
width: auto; 
float: right; 
}

 

I've experimented with everything I can think of but can't seem to get it how I'd really like it.

 

Thanks for your time.

Link to comment
Share on other sites

well the only way you are going to get stuff to overlap is by using absolute positioning.  Perhaps you don't want to use absolute positioning because you are not using it within the context of the div? Setting the position to relative in #topnav will then make any positioning of things inside it relative to it, instead of the document.  So you can then use absolute positioning for #links and it will be relative to to #topnav

 

#topnav {
position: relative;
width: 757px;
margin-top: 0px;
margin-right: auto;
margin-bottom: 0px;
margin-left: auto;
}
#links {
position: absolute;
top: 20px;
right: 0px;
width: auto;
}

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.