...

View Full Version : Placing image correctly on css built site



rvchuck
10-09-2007, 04:02 PM
I have a site based on css. When placing an image on a page it is fine until you get to 1280 x 1024 resolution than the image covers some text.
A minor issue but I would like to clear it up. Here's the site http://www.virtualwebvideo.com/contact.html
You can view source on the page and here's the code on the css for this image.
#locator { position:absolute;
visibility:show; left: 720px; top: 290px; z-index:2
}
Can I code another way than using the pixel locations?
Thanks in advance.

vtjustinb
10-09-2007, 04:23 PM
Firstly that code is pretty messy--there's lots of presentational <BR>s (with incorrect html 4.0 syntax) and orphaned tags. You'll definitely want to clean that up.

Secondly you don't want to position that image absolutely. If the user resizes their browser at all it'll break the layout, not to mention appear really distracting.

What you want is something like this:

<div id="contact">
<img src="thatgirl.jpg" alt="" width="" height="" />
<p>Contact stuff</p>
<p>contact stuff</p>
<p>Contact stuff</p>
<div style="clear: right"><!-- --></div>
</div>

And float #contact img { float: right; }. This will let the image sit beside the contact text as you have it now, but it will expand and reposition with the layout instead of relying on a pixel placement.

rvchuck
10-09-2007, 05:46 PM
That worked. Thank You.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum