html文件:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>box.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3" />
<meta http-equiv="description" content="this is my page" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="css/my.css" type="text/css"></link></head>
<body>
<div class="s1"><img src="image/1.jpg" />
</div>
</body>
</html>
css文件:
body{
border: 1px solid red;/*给Border指定了border的宽度,样式,颜色(顺序可以随意)*/
width: 800px;
height: 1000px;
margin: 0 auto; /*0表示上下为0 auto表示居中*/
}
.s1{
width: 100px;
height: 200px;
border: 2px solid blue;
margin-top: 10px;
margin-left: 10px;
}
.s1 img{
width: 40px;
margin-left: 50px;
margin-top: 50px;
}
为什么就是显示不出来div的Border框呢?这个和浏览器和用的html版本有关系吗?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>box.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3" />
<meta http-equiv="description" content="this is my page" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="css/my.css" type="text/css"></link></head>
<body>
<div class="s1"><img src="image/1.jpg" />
</div>
</body>
</html>
css文件:
body{
border: 1px solid red;/*给Border指定了border的宽度,样式,颜色(顺序可以随意)*/
width: 800px;
height: 1000px;
margin: 0 auto; /*0表示上下为0 auto表示居中*/
}
.s1{
width: 100px;
height: 200px;
border: 2px solid blue;
margin-top: 10px;
margin-left: 10px;
}
.s1 img{
width: 40px;
margin-left: 50px;
margin-top: 50px;
}
为什么就是显示不出来div的Border框呢?这个和浏览器和用的html版本有关系吗?
<meta http-equiv="description" content="this is my page" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
去掉这个就对了,这个是版本什么的原因,求解