<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>左边是图片,右边是个div</title>
<style>
body { margin:0px;
}
.all{ width:1000px;
height:700px;
}
.right { width:300px;
height:400px;
margin-top:10px;
float:left;
margin-left:10px;
padding-left:10px;
padding-right:10px;
}
</style>
</head>
<body>
<div class="all">
<img src="java达人2.JPG" style="float:left;"/>
<div class="right">
左边是图片,右边是个div,图片换成你自己的
<br />
<br />
你留意你的最外面的div宽度有没有小于你图片的宽度加上右边div的宽度,如果超过了,肯定是会跑去另一行
<br />
<br />
还有就是你有没有在图片上加上style="float:left;"的css样式?
<br />
<br />
为了测试,你可以把我的.all的width改成小于你图片的宽度加上右边div的宽度,你就看到效果了
</div>
</div>
</body>
</html>
拿这个代码去试试 有不明白问我 我在线