Div标签会导致其他标签移位

时间:2014-10-12 14:37:55

标签: html formatting dreamweaver

我正在Dreamweaver课程中完成我的最终项目,显然我没有像我想象的那样掌握Div标签。我有一个包含4个div标签的页面。一个是容量为1280 x 720的容器。第二个div是1280 x 60 px的菜单,相对位于距离顶部670 px的位置,它位于页面的底部。接下来的两个标签左右对齐。当我添加左侧div时,菜单向下移动到页面。 我有点急需帮助,所以如果有人可以帮忙,我会很感激。



@charset "utf-8";
body {
	background-color: #000;
}
#container {
	width: 1280px;
	height: 720px;
	position: relative;
	margin-left: auto;
	margin-right: auto;
	background-image: url(images/mushuonlog.jpg);
}
#navigation ul li {
	float: left;
	list-style-type: none;
}
#navigation ul li a {
	text-decoration: none;
	color: #fff;
	white-space: nowrap;
	padding-top: 8px;
	padding-bottom: 8px;
	padding-left: 15px;
	padding-right: 15px;
	display: block;
	font-family: abril-fatface;
	font-style: normal;
	font-weight: 300;
	font-size: 30px;
	border-top: thick solid rgba(0,0,0,1.00);
}
#navigation ul {
	margin-top: 0px;
	padding-top: 0px;

}
#navigation {
	width: 1280px;
	height: 60px;
	position: relative;
	top: 670px;
	background-image: -webkit-linear-gradient(270deg,rgba(0,0,0,1.00) 0%,rgba(0,0,0,0.62) 51.30%,rgba(0,0,0,1.00) 100%);
	background-image: -moz-linear-gradient(270deg,rgba(0,0,0,1.00) 0%,rgba(0,0,0,0.62) 51.30%,rgba(0,0,0,1.00) 100%);
	background-image: -o-linear-gradient(270deg,rgba(0,0,0,1.00) 0%,rgba(0,0,0,0.62) 51.30%,rgba(0,0,0,1.00) 100%);
	background-image: linear-gradient(180deg,rgba(0,0,0,1.00) 0%,rgba(0,0,0,0.62) 51.30%,rgba(0,0,0,1.00) 100%);
}
#sidebar {
	width: 300px;
	height: 600px;
	background-image: -webkit-linear-gradient(270deg,rgba(0,0,0,0.62) 0%,rgba(0,0,0,0.62) 48.70%,rgba(0,0,0,0.62) 100%);
	background-image: -moz-linear-gradient(270deg,rgba(0,0,0,0.62) 0%,rgba(0,0,0,0.62) 48.70%,rgba(0,0,0,0.62) 100%);
	background-image: -o-linear-gradient(270deg,rgba(0,0,0,0.62) 0%,rgba(0,0,0,0.62) 48.70%,rgba(0,0,0,0.62) 100%);
	background-image: linear-gradient(180deg,rgba(0,0,0,0.62) 0%,rgba(0,0,0,0.62) 48.70%,rgba(0,0,0,0.62) 100%);
	position: relative;
	float: right;
	margin-top: 30px;
	margin-right: 30px;
}
#sidebar p {
	color: #DFDFDF;
	font-family: Gotham, "Helvetica Neue", Helvetica, Arial, sans-serif;
	margin-left: 15px;
	margin-right: 15px;
}
#sidebar h1 {
	color: #dfdfdf;
	font-family: abril-fatface;
	font-style: normal;
	font-weight: 500;
	text-align: center;
	text-decoration: underline;
	font-size: 35px;
}
#navigation a:hover {
	border-top: thick solid #8B4513;
}
#container-housing {
	width: 1280px;
	height: 720px;
	margin-right: auto;
	margin-left: auto;
	background-image: url(images/terrarium.jpg);
}
#container #logo {
	width: 156px;
	height: 178px;
	margin-left: 15px;
	margin-top: 15px;
	position: absolute;
	left: -2px;
	top: -2px;
}
#sidebar-housing {
	width: 300px;
	height: 600px;
	margin-top: 30px;
	margin-right: 30px;
	position: relative;
	float: right;
	background-image: -webkit-linear-gradient(270deg,rgba(0,0,0,0.62) 0%,rgba(0,0,0,0.62) 100%);
	background-image: -moz-linear-gradient(270deg,rgba(0,0,0,0.62) 0%,rgba(0,0,0,0.62) 100%);
	background-image: -o-linear-gradient(270deg,rgba(0,0,0,0.62) 0%,rgba(0,0,0,0.62) 100%);
	background-image: linear-gradient(180deg,rgba(0,0,0,0.62) 0%,rgba(0,0,0,0.62) 100%);
}
#sidebar-housing h1 {
	color: #dfdfdf;
	font-family: abril-fatface;
	font-style: normal;
	font-weight: 500;
	font-size: 35px;
	text-align: center;
	text-decoration: underline;
}
#sidebar-housing p {
	color: #dfdfdf;
	font-family: Gotham, "Helvetica Neue", Helvetica, Arial, sans-serif;
	margin-left: 15px;
	margin-right: 15px;
}
#container-care {
	width: 1280px;
	height: 720px;
	margin-left: auto;
	margin-right: auto;
	position: relative;
	background-image: url(images/tegucare.jpg);
}
#sidebar-care {
	width: 300px;
	height: 600px;
	float: right;
	margin-top: 30px;
	margin-right: 30px;
	background-color: rgba(0,0,0,0.62);
}
h1 {
	color: #dfdfdf;
	font-family: abril-fatface;
	font-style: normal;
	font-weight: 500;
	text-align: center;
	text-decoration: underline;
}
p {
	color: #dfdfdf;
	font-family: Gotham, "Helvetica Neue", Helvetica, Arial, sans-serif;
	margin-left: 15px;
	margin-right: 15px;
}
#Accordion1 {
	width: 400px;
	margin-left: 30px;
	font-size: small;
	height: 400px;
	position: absolute;
	margin-top: 30px;
	left: 1px;
	top: -1px;
}
#container-media {
	width: 1280px;
	height: 720px;
	margin-left: auto;
	margin-right: auto;
	background-image: url(images/media.jpg);
}
#sidebar-media {
	width: 300px;
	height: 450px;
	position: relative;
	float: right;
	margin-top: 30px;
	margin-right: 30px;
	background-color: rgba(0,0,0,0.62);
}
#media {
	width: 600px;
	height: 600px;
	margin-top: 30px;
	margin-left: 30px;
}
#container-contact {
	width: 1280px;
	height: 720px;
	margin-left: auto;
	margin-right: auto;
	background-image: url(images/mushu-contact.jpg);
	clear: both;
}
#sidebar-contact {
	width: 300px;
	height: 400px;
	position: relative;
	float: right;
	margin-right: 30px;
	margin-top: 30px;
	background-color: rgba(0,0,0,0.62);
	clear: right;
}
#contact-form {
	width: 300px;
	height: 0400px;
	margin-left: 30px;
	margin-top: 30px;
	position: relative;
}

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Contact</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>

<body>
<div id="container-contact">
  <div id="sidebar-contact">
    <p>Mushu Loves Email</p>
    <p>Have something to say? We'd love to hear your comments, stories, and questions.</p>
    <p>Do you have pictures of your pet lizard you'd like to share or an experience with your tegu that you think was cool? Did you just get a tegu or are you thinking about getting a tegu? Have questions about husbandry or care that we haven't covered on this site? Do you just want to shoot the breeze?</p>
    <p>Just use the contact form to the right to send us an email. We'd love to hear from you.</p>
  </div>
  <div id="contact-form">
    <div id="navigation">
      <ul>
        <li><a href="index.html">home</a></li>
        <li><a href="housing.html">housing</a></li>
        <li><a href="care.html">care</a></li>
        <li><a href="media.html">media</a></li>
        <li><a href="contact.html">contact</a></li>
        <li><a href="about.html">about us</a></li>
      </ul>
    </div>
  </div>
</div>
</body>
</html>
&#13;
&#13;
&#13;

0 个答案:

没有答案