求大神帮我看看啊

来源:3-4 企业网站制作之导航部分制作(一)

北条纱希

2015-07-13 10:47

@charset"UTF-8";
*
{
	margin: 0;
	padding: 0;
	font-size: 12px;
}
body
{
	background-color: #F5F5F5;
}
.top
{
	width: 100%;
	height:27px;
	background: url(../images/top_bg.jpg) repeat-x;
}
.top_content
{
	width: 1000px;
	margin: 0 auto;
}
.top_content li
{
	list-style-image:url(../images/li_bg.gif); 
	float: right;
	width: 70px;
	line-height: 27px;
}
.top_content a:link,.top_content a:visited
{
	color:gray;
	text-decoration: none;
}
.top_content a:hover,.top_content a:active
{
	color: red;
	text-decoration: none;
}

.wrap
{
	width: 1000px;
	margin: 0 auto;
}
.logo
{
	height: 80px;
	background-color: white;
}
.logo_left
{
	width: 200px;
	float: left;
}
.logo_right
{
	margin-top:30px; 
	width: 300px;
	float: right;
	color: gray;
}
.logo_right img
{
	vertical-align: middle;
	margin-right: 10px;
}
.tel
{
	font-family: "微软雅黑";
	font-size:16px;
	color: red;
}
.nav
{
	height: 40px;
}
.nav_left
{
	width: 10px;
	background: url(../Images/nav_left.jpg) no-repeat;
	float: left;
}
.nav_mid
{
	width: 980px;
	background: url(../Images/nav_bg.jpg) repeat-x;
	float: left;
}
.nav_right
{
	width: 10px;
	background: url(../Images/nav_right.jpg) no-repeat;
	float: left;
}

下面是HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
<link href="css/main.css" rel="stylesheet" type="text/css"/>
<script src="JS/setHomeSetFav.js" type="text/javascript" charset="gb2312"></script>
</head>
<body>
<div>
<div>
<ul>
<li><a href="http://www.bilibili.com/html/contact.html">联系我们</a></li>
<li><a href="#" onclick="AddFavorite(window.location,document.title)">加入收藏 </a></li>
<li><a href="#" onclick="SetHome(window.location)">设为首页</a></li>
</ul>
</div>
</div><!-- top结束 -->
<div>
<div>
<div>
<img src="Images/logo.jpg" alt="慕课网"/>
</div>
<div>
<img src="Images/tel.jpg" alt="服务热线"/>24小时服务热线:<span>123-456-7890</span>
</div>
</div><!-- logo结束 -->
</div><!-- wrap结束 -->
<div>
<div></div>
<div>
<div>
<ul>
<li><a href="#">首页</a></li>
<li><a href="list.html">关于慕课</a></li>
<li><a href="list.html">新闻动态</a></li>
<li><a href="list.html">课程中心</a></li>
<li><a href="list.html">在线课程</a></li>
<li><a href="list.html">人才招聘</a></li>
</ul>
</div>
<div></div>
</div><!-- nav_middle结束 -->
<div>
<form action=""method="post">
<input type="text"/>
</form>
</div>
</div><!-- nav结束 -->
</body>
</html>

在浏览器上的结果是http://img.mukewang.com/55a3268700015cf113660645.jpg

这是怎么回事?

写回答 关注

1回答

  • 北条纱希
    2015-07-13 15:26:12

    好吧我自己找出原因了。。。

    北条纱希 回复妖梦萌

    最前面改成<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 然后<form></form>这个元素应该放到<!-- nav_middle结束 -->这个DIV里面才对,至于原因嘛,应该是如果出了制定的DIV下面的CSS就对FORM这个元素不起作用了。

    2015-07-23 14:20:00

    共 2 条回复 >

企业网站综合布局实战

本课程重点介绍HTML/CSS实现常见企业网站布局的方法

157081 学习 · 2157 问题

查看课程

相似问题