How can I have an image float next to a centered div?
How can I make a image float next to a centered box? What would be the correct HTML/CSS-code? Here's a outline of what I'm trying to make:
Tha开发者_开发知识库nks in advance.
Place your image inside the centered div. Give the centered div position:relative
. Now give the image position:absolute
and left:-XXpx
where XX is the width of your image.
Place the image inside of a floating div and then put the floating div anywhere you want.
Here's some HTML to create the div and an image placeholder... Simply change the top and left values in the #layer1 css code below to position the div...
It would probably be in your interest to wrap most page elements in their own divs so you can layout the page without using a table.
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
#Layer1 {
position:absolute;
width:200px;
height:115px;
z-index:1;
left: 475px;
top: 291px;
} -->
<body>
<div id="Layer1"><img src="" alt="" name="someimage" width="32" height="32" id="someimage" /></div>
</body>
</html>
Good Luck,
Rodney Barbati
精彩评论