文本未显示在导航菜单下方

时间:2014-12-09 21:57:52

标签: javascript html css text navigation

所有。我在使用CSS和HTML方面遇到了更多麻烦。我不确定我做错了什么,但我的h1文字不希望显示在导航菜单栏下方。我尝试设置像素越多,移动得越多,带有导航菜单栏。我对这一切都很陌生,你们有什么建议给我的吗?



*{
	margin:0px;
	padding:0px;
	}
body{ 
	background:url(../images/background.jpg);
	height:100%; 
	width:100%;
	}
#container{
	margin-top:10px;
	margin-left:710px;
	}
.menu{
	list-style:none;
	}
.menu li{
	display:block;
	height:50px;
	width:125px;
	float:left;
	background: rbackground: #ffffff; /* Old browsers */
	background: -moz-linear-gradient(top,  #ffffff 0%, #f1f1f1 50%, #e1e1e1 51%, #f6f6f6 100%); /* FF3.6+ */
	background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(50%,#f1f1f1), color-stop(51%,#e1e1e1), color-stop(100%,#f6f6f6)); /* Chrome,Safari4+ 

*/
	background: -webkit-linear-gradient(top,  #ffffff 0%,#f1f1f1 50%,#e1e1e1 51%,#f6f6f6 100%); /* Chrome10+,Safari5.1+ */
	background: -o-linear-gradient(top,  #ffffff 0%,#f1f1f1 50%,#e1e1e1 51%,#f6f6f6 100%); /* Opera 11.10+ */
	background: -ms-linear-gradient(top,  #ffffff 0%,#f1f1f1 50%,#e1e1e1 51%,#f6f6f6 100%); /* IE10+ */
	background: linear-gradient(to bottom,  #ffffff 0%,#f1f1f1 50%,#e1e1e1 51%,#f6f6f6 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#f6f6f6',GradientType=0 ); /* IE6-9 */
	line-height:50px;
	text-align:center;
	border-right:1px solid #000;
	font-family: 'Francois One', sans-serif;
	}
.child{
	border-bottom-left-radius:50px;
	border-top-left-radius:50px;
	}
.child1{
	border-bottom-right-radius:50px;
	border-top-right-radius:50px;
	}
.menu li:hover{
	background:background: #ffffff; /* Old browsers */
	background: -moz-radial-gradient(center, ellipse cover,  #ffffff 0%, #e5e5e5 100%); /* FF3.6+ */
	background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%,#ffffff), color-stop(100%,#e5e5e5)); /* Chrome,Safari4+ */
	background: -webkit-radial-gradient(center, ellipse cover,  #ffffff 0%,#e5e5e5 100%); /* Chrome10+,Safari5.1+ */
	background: -o-radial-gradient(center, ellipse cover,  #ffffff 0%,#e5e5e5 100%); /* Opera 12+ */
	background: -ms-radial-gradient(center, ellipse cover,  #ffffff 0%,#e5e5e5 100%); /* IE10+ */
	background: radial-gradient(ellipse at center,  #ffffff 0%,#e5e5e5 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#e5e5e5',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */
color:#FDD017
	}
h1{
	font-family:'Francois One', sans-serif;
	font-size:72px;
	display:block;
	text-align: center;
	color: white;
	text-shadow: 0 0 20px #fefcc9, 10px -10px 30px #feec85, -20px -20px 40px #ffae34, 20px -40px 50px #ec760c, -20px -60px 60px #cd4606, 0 -80px 70px #973716, 10px -90px 80px #451b0e;
	}
A.class1 {color:black;}
A.class1:link  {text-decoration: none; color: black;}
A.class1:visited {text-decoration: none; color: none;}
A.class1:hover {text-decoration: underline; color: orange;}
A.class1:active {text-decoration: none; color: orange;}

<!DOCTYPE html>
<html>	
	<head><meta charset="UTF-8" />

		<title>Home</title>
		<link href='http://fonts.googleapis.com/css?		family=Francois+One' rel='stylesheet' type='text/css'>
		<link href="css/style.css" rel="stylesheet" 		type="text/css" />
			<style type="text/css">
			</style>

	</head>
<body>
<div id="container">
<ul class="menu">
<li class="child"><a href="index.html" class="class1">HOME</a></li>
<li><a href="about_me/about_me.html" class="class1">ABOUT ME</a></li>
<li><a href="inspiration/inspiration.html" class="class1">INSPIRATION</a></li>
<li class="child1"><a href="contact_me/contact_me.html" class="class1">CONTACT ME</a></li>
</ul>
</div>
<h1>Welcome to Justin Sanchez's Lair!</h1>
</body>

</html>
&#13;
&#13;
&#13;

*{
    margin:0px;
    padding:0px;
    }
body{ 
    background:url(../images/background.jpg);
    height:100%; 
    width:100%;
    }
#container{
    margin-top:10px;
    margin-left:710px;
    }
.menu{
    list-style:none;
    }
.menu li{
    display:block;
    height:50px;
    width:125px;
    float:left;
    background: rbackground: #ffffff; /* Old browsers */
    background: -moz-linear-gradient(top,  #ffffff 0%, #f1f1f1 50%, #e1e1e1 51%, #f6f6f6 100%); /* FF3.6+ */
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(50%,#f1f1f1), color-stop(51%,#e1e1e1), color-stop(100%,#f6f6f6)); /* Chrome,Safari4+ 

*/
    background: -webkit-linear-gradient(top,  #ffffff 0%,#f1f1f1 50%,#e1e1e1 51%,#f6f6f6 100%); /* Chrome10+,Safari5.1+ */
    background: -o-linear-gradient(top,  #ffffff 0%,#f1f1f1 50%,#e1e1e1 51%,#f6f6f6 100%); /* Opera 11.10+ */
    background: -ms-linear-gradient(top,  #ffffff 0%,#f1f1f1 50%,#e1e1e1 51%,#f6f6f6 100%); /* IE10+ */
    background: linear-gradient(to bottom,  #ffffff 0%,#f1f1f1 50%,#e1e1e1 51%,#f6f6f6 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#f6f6f6',GradientType=0 ); /* IE6-9 */
    line-height:50px;
    text-align:center;
    border-right:1px solid #000;
    font-family: 'Francois One', sans-serif;
    }
.child{
    border-bottom-left-radius:50px;
    border-top-left-radius:50px;
    }
.child1{
    border-bottom-right-radius:50px;
    border-top-right-radius:50px;
    }
.menu li:hover{
    background:background: #ffffff; /* Old browsers */
    background: -moz-radial-gradient(center, ellipse cover,  #ffffff 0%, #e5e5e5 100%); /* FF3.6+ */
    background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%,#ffffff), color-stop(100%,#e5e5e5)); /* Chrome,Safari4+ */
    background: -webkit-radial-gradient(center, ellipse cover,  #ffffff 0%,#e5e5e5 100%); /* Chrome10+,Safari5.1+ */
    background: -o-radial-gradient(center, ellipse cover,  #ffffff 0%,#e5e5e5 100%); /* Opera 12+ */
    background: -ms-radial-gradient(center, ellipse cover,  #ffffff 0%,#e5e5e5 100%); /* IE10+ */
    background: radial-gradient(ellipse at center,  #ffffff 0%,#e5e5e5 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#e5e5e5',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */
color:#FDD017
    }
h1{
    font-family:'Francois One', sans-serif;
    font-size:72px;
    display:block;
    text-align: center;
    color: white;
    text-shadow: 0 0 20px #fefcc9, 10px -10px 30px #feec85, -20px -20px 40px #ffae34, 20px -40px 50px #ec760c, -20px -60px 60px #cd4606, 0 -80px 70px #973716, 10px -90px 80px #451b0e;
    }
A.class1 {color:black;}
A.class1:link  {text-decoration: none; color: black;}
A.class1:visited {text-decoration: none; color: none;}
A.class1:hover {text-decoration: underline; color: orange;}
A.class1:active {text-decoration: none; color: orange;}

2 个答案:

答案 0 :(得分:0)

我相信这就是你想要的。

html:

<div id="container">
<span><!--place menu in a span to align it with h1 tag-->
 <ul class="menu">
<li class="child"><a href="index.html" class="class1">HOME</a></li>
<li><a href="about_me/about_me.html" class="class1">ABOUT ME</a></li>
<li><a href="inspiration/inspiration.html" class="class1">INSPIRATION</a></li>
<li class="child1"><a href="contact_me/contact_me.html" class="class1">CONTACT ME</a></li>
</ul>
    </span>
    <div id="spacer"></div><!--used to provide spacing between menu-->


    <span id="title"><!-- enclosed h1 tag to align it below ul list above-->
        <h1>Welcome to Justin Sanchez's Lair!</h1>
    </span>
</div>

的CSS:

     /*used to place space between menu and h1 text*/
     #spacer{

    height:300px;


}

body{ 
    background:url(../images/background.jpg);
    height:100%; 
    width:100%;
    }
#container{
    margin-top:10px;
    margin-left:710px;

    }
.menu{
    list-style:none;
    }
.menu li{
    display:block;
    height:50px;
    width:125px;
    float:left;
    background: rbackground: #ffffff; /* Old browsers */
    background: -moz-linear-gradient(top,  #ffffff 0%, #f1f1f1 50%, #e1e1e1 51%, #f6f6f6 100%); /* FF3.6+ */
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(50%,#f1f1f1), color-stop(51%,#e1e1e1), color-stop(100%,#f6f6f6)); /* Chrome,Safari4+ 

*/
    background: -webkit-linear-gradient(top,  #ffffff 0%,#f1f1f1 50%,#e1e1e1 51%,#f6f6f6 100%); /* Chrome10+,Safari5.1+ */
    background: -o-linear-gradient(top,  #ffffff 0%,#f1f1f1 50%,#e1e1e1 51%,#f6f6f6 100%); /* Opera 11.10+ */
    background: -ms-linear-gradient(top,  #ffffff 0%,#f1f1f1 50%,#e1e1e1 51%,#f6f6f6 100%); /* IE10+ */
    background: linear-gradient(to bottom,  #ffffff 0%,#f1f1f1 50%,#e1e1e1 51%,#f6f6f6 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#f6f6f6',GradientType=0 ); /* IE6-9 */
    line-height:50px;
    text-align:center;
    border-right:1px solid #000;
    font-family: 'Francois One', sans-serif;
    }
.child{
    border-bottom-left-radius:50px;
    border-top-left-radius:50px;
    }
.child1{
    border-bottom-right-radius:50px;
    border-top-right-radius:50px;
    }
.menu li:hover{
    background:background: #ffffff; /* Old browsers */
    background: -moz-radial-gradient(center, ellipse cover,  #ffffff 0%, #e5e5e5 100%); /* FF3.6+ */
    background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%,#ffffff), color-stop(100%,#e5e5e5)); /* Chrome,Safari4+ */
    background: -webkit-radial-gradient(center, ellipse cover,  #ffffff 0%,#e5e5e5 100%); /* Chrome10+,Safari5.1+ */
    background: -o-radial-gradient(center, ellipse cover,  #ffffff 0%,#e5e5e5 100%); /* Opera 12+ */
    background: -ms-radial-gradient(center, ellipse cover,  #ffffff 0%,#e5e5e5 100%); /* IE10+ */
    background: radial-gradient(ellipse at center,  #ffffff 0%,#e5e5e5 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#e5e5e5',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */
color:#FDD017
    }
h1{

    font-family:'Francois One', sans-serif;
    font-size:72px;
    display:block;
    text-align: center;
    color: white;
    text-shadow: 0 0 20px #fefcc9, 10px -10px 30px #feec85, -20px -20px 40px #ffae34, 20px -40px 50px #ec760c, -20px -60px 60px #cd4606, 0 -80px 70px #973716, 10px -90px 80px #451b0e;
    }
A.class1 {color:black;}
A.class1:link  {text-decoration: none; color: black;}
A.class1:visited {text-decoration: none; color: none;}
A.class1:hover {text-decoration: underline; color: orange;}
A.class1:active {text-decoration: none; color: orange;}

答案 1 :(得分:0)

&#13;
&#13;
*{
	margin:0px;
	padding:0px;
	}
body{ 
	background:url(../images/background.jpg);
	height:100%; 
	width:100%;
	}
#container {
   float:left;
   width:100%;
   overflow:hidden;
   position:relative;
}
#container ul {
   clear:left;
   float:left;
   list-style:none;
   margin:0;
   padding:0;
   position:relative;
   left:50%;
   text-align:center;
}
#container ul li {
   display:block;
   float:left;
   list-style:none;
   margin:0;
   padding:0;
   position:relative;
   right:50%;
}
#container ul li a {
   display:block;
   margin:0 0 0 1px;
   padding:3px 10px;
   text-decoration:none;
   line-height:1.3em;
}


.menu{
	list-style:none;
	}
.menu li{
	display:block;
	height:50px;
	width:125px;
	float:left;
	background: rbackground: #ffffff; /* Old browsers */
	background: -moz-linear-gradient(top,  #ffffff 0%, #f1f1f1 50%, #e1e1e1 51%, #f6f6f6 100%); /* FF3.6+ */
	background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(50%,#f1f1f1), color-stop(51%,#e1e1e1), color-stop(100%,#f6f6f6)); /* Chrome,Safari4+ 

*/
	background: -webkit-linear-gradient(top,  #ffffff 0%,#f1f1f1 50%,#e1e1e1 51%,#f6f6f6 100%); /* Chrome10+,Safari5.1+ */
	background: -o-linear-gradient(top,  #ffffff 0%,#f1f1f1 50%,#e1e1e1 51%,#f6f6f6 100%); /* Opera 11.10+ */
	background: -ms-linear-gradient(top,  #ffffff 0%,#f1f1f1 50%,#e1e1e1 51%,#f6f6f6 100%); /* IE10+ */
	background: linear-gradient(to bottom,  #ffffff 0%,#f1f1f1 50%,#e1e1e1 51%,#f6f6f6 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#f6f6f6',GradientType=0 ); /* IE6-9 */
	line-height:50px;
	text-align:center;
	border-right:1px solid #000;
	font-family: 'Francois One', sans-serif;
	}
.child{
	border-bottom-left-radius:50px;
	border-top-left-radius:50px;
	}
.child1{
	border-bottom-right-radius:50px;
	border-top-right-radius:50px;
	}
.menu li:hover{
	background:background: #ffffff; /* Old browsers */
	background: -moz-radial-gradient(center, ellipse cover,  #ffffff 0%, #e5e5e5 100%); /* FF3.6+ */
	background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%,#ffffff), color-stop(100%,#e5e5e5)); /* Chrome,Safari4+ */
	background: -webkit-radial-gradient(center, ellipse cover,  #ffffff 0%,#e5e5e5 100%); /* Chrome10+,Safari5.1+ */
	background: -o-radial-gradient(center, ellipse cover,  #ffffff 0%,#e5e5e5 100%); /* Opera 12+ */
	background: -ms-radial-gradient(center, ellipse cover,  #ffffff 0%,#e5e5e5 100%); /* IE10+ */
	background: radial-gradient(ellipse at center,  #ffffff 0%,#e5e5e5 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#e5e5e5',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */
color:#FDD017
	}
h1{
	font-family:'Francois One', sans-serif;
	font-size:72px;
	display:block;
	text-align: center;
	color: white;
	text-shadow: 0 0 20px #fefcc9, 10px -10px 30px #feec85, -20px -20px 40px #ffae34, 20px -40px 50px #ec760c, -20px -60px 60px #cd4606, 0 -80px 70px #973716, 10px -90px 80px #451b0e;
	}
A.class1 {color:black;}
A.class1:link  {text-decoration: none; color: black;}
A.class1:visited {text-decoration: none; color: none;}
A.class1:hover {text-decoration: underline; color: orange;}
A.class1:active {text-decoration: none; color: orange;}
&#13;
<!DOCTYPE html>
<html>	
	<head><meta charset="UTF-8" />

		<title>Home</title>
		<link href='http://fonts.googleapis.com/css? family=Francois+One' rel='stylesheet' type='text/css'>
		<link href="css/style.css" rel="stylesheet" type="text/css" />
			<style type="text/css">
			</style>

	</head>
<body>
<div id="container">
<ul class="menu">
<li class="child"><a href="index.html" class="class1">HOME</a></li>
<li><a href="about_me/about_me.html" class="class1">ABOUT ME</a></li>
<li><a href="inspiration/inspiration.html" class="class1">INSPIRATION</a></li>
<li class="child1"><a href="contact_me/contact_me.html" class="class1">CONTACT ME</a></li>
</ul>
</div>

<h1>Welcome to Justin Sanchez's Lair!</h1>
</body>

</html>
&#13;
&#13;
&#13;