<!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" xml:lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<title>网页标题</title>
<meta name="keywords" content="关键字列表" />
<meta name="description" content="网页描述" />
<link rel="stylesheet" type="text/css" href="" />
<style type="text/css">
/*利用类选择器:有class属性的标签*/
.now{
border:1px solid #f00;
height:200px;
width:300px;
background-color:#ff9933;
/*向左浮动*/
float:left;
}
.box{
border:1px solid #0f0;
width:500px;
height:300px;
/*利用外边距给盒子居中*/
margin-left:auto;
margin-right:auto;
}
img{
/*向右浮动*/
float:right;
}
/*清除浮动*/
.nos{
clear:both;
}
</style>
<script type="text/javascript"></script>
</head>
<body>
<div class='box'>
<div class='now'>接电话疯狂老师打哈了咖啡还撒了点</div>
<img src='jd2.png'/>
<!--清除浮动:设置一个空盒子-->
<div class='nos'><div>
</div>
</body>
</html>
![]()