有固定位置的问题。

时间:2015-02-16 08:35:43

标签: css header position

我目前正在建立一个网站,因为我已经完成了标题标记,我应用了position:fixed;怎么会敲掉我的标题,我不知道为什么我在css中尝试调试整个标题标记。

任何帮助将不胜感激:

$(document).ready(function(){
	$('#login-trigger').click(function(){
		$(this).next('#login-content').slideToggle();
		$(this).toggleClass('active');					
					
		if ($(this).hasClass('active')) $(this).find('span').html('▲')
		else $(this).find('span').html('▼')
	})
});


function f_p(){
	document.getElementById('forgot_pwd').style.display='block';
	document.getElementById('userlogin').style.display='none';
}
function p_f(){
	document.getElementById('forgot_pwd').style.display='none';
	document.getElementById('userlogin').style.display='block';
}
@charset "utf-8";
/* CSS Document */

article, aside, details, figcaption, figure,footer, header, hgroup, menu, nav, section {display: block;}
fieldset{margin: 0;padding: 0;border: 0;}
input:focus,textarea:focus {outline: none;}
		
/*----------------------*/
		
body{background: #000; font-family: Arial, Helvetica, sans-serif;color: #444;margin: 0;font-size: 1.2em;}     
#logo{border: none; float: left;height: 50px;margin: -5px 5px 0px 0px;width: 130px;}
#navmenu {color: #FFF;font-size:18px;list-style: outside none none;margin: 20px 5px 5px 5px;text-decoration: none;}
input.searchbox {-webkit-border-radius: 10px;-moz-border-radius: 10px;background-color: #af5354;border: 1px solid #af5354;background-color: #AF5354;border: 1px solid #AF5354;border-radius: 5px;color: #FFF;float: left;height: 19px;margin-left: 0.5em;margin-top: 1.3em;outline: 0px none;padding-left: 0.5em;padding-top: 0.3em;text-align: left;width: 170px;}
input.searchbox:focus {background: #e87476;background: -moz-linear-gradient(top, #e87476 0%, #e87476 20%);background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #e87476), color-stop(20%, #e87476));    outline: 0;color: #FFF;}
*::-webkit-input-placeholder { color: #FFF; }
*:-moz-placeholder { color: #FFF; }
*::-moz-placeholder { color: #FFF; }
*:-ms-input-placeholder { color: #FFF; }
input.button {padding: 0px;margin: 15px 0px 0px -28px;width: 38px;height: 28px;border: 0;float: left;border: none;background: url("../../assets/images/sprite.png") -142px -7px;overflow: hidden;}
input.button:hover {border: 0;padding: 0;margin: 15px 0px 0px -28px;width: 38px;height: 28px;background: url("../../assets/images/sprite.png") -142px -47px;float: left;border: none;}
input[type=search] { -webkit-appearance: none; }
#navmenu a{color:#FFF;text-decoration:none;}	
#navmenu a:hover {text-decoration:none;}

/*----------------------*/
		
.cf:before, .cf:after {content:"";display:table;}
.cf:after {clear:both;}
.cf {zoom:1;}
		  
/*----------------------*/
		
header {
	padding: 8px 10%;
	background-color: #8C080A;
	background-image: -webkit-gradient(linear, left top, left bottom, from(#a8090c), to(#8c080a));
	background-image: -webkit-linear-gradient(top, #a8090c, #8c080a);
	background-image: -moz-linear-gradient(top, #a8090c, #8c080a);
	background-image: -ms-linear-gradient(top, #a8090c, #8c080a);
	background-image: -o-linear-gradient(top, #a8090c, #8c080a);
	background-image: linear-gradient(top, #a8090c, #8c080a);
	-moz-box-shadow: 0 -3px 3px rgba(0,0,0,.5) inset;
	-webkit-box-shadow: 0 -3px 3px rgba(0,0,0,.5) inset;
	box-shadow: 0 -3px 3px rgba(0,0,0,.5) inset;
	height: 50px;
}
		
/*----------------------*/
		
nav {font-size: 16px;font-weight: bold;margin-left: auto;margin-right: auto;width: 1024px; }
nav ul {margin: 20px 0px 0px;padding: 0;list-style: none;position: relative;float: right;background: from(#a8090c), to(#8c080a);-moz-border-radius: 3px;-webkit-border-radius: 3px;border-radius: 3px;}
nav li {float: left;}
nav #login { border-right: 1px solid #fff;-moz-box-shadow: 1px 0 0 #fff;-webkit-box-shadow: 1px 0 0 #fff;box-shadow: 1px 0 0 #fff; }
nav #login-trigger, nav #signup a {	display: inline-block; *display: inline; *zoom: 1; height: 25px; line-height: 25px;  font-weight: bold; padding: 0 8px; text-decoration: none; color: #FFF; }
nav #signup a {	-moz-border-radius: 0 3px 3px 0; -webkit-border-radius: 0 3px 3px 0; border-radius: 0 3px 3px 0; }
nav #login-trigger { -moz-border-radius: 3px 0 0 3px; -webkit-border-radius: 3px 0 0 3px; border-radius: 3px 0 0 3px; }
		
nav #login-trigger:hover, nav #login .active, nav #signup a:hover {	background: from(#a8090c), to(#8c080a); }
		
nav #login-content {
	display: none;
	position: absolute;
	top: 35px;
	right: 0;
	z-index: 999;    
	background: #444343;
	background-image: -webkit-gradient(linear, left top, left bottom, from(#444343), to(#444343));
	background-image: -webkit-linear-gradient(top, #444343, #444343);
	background-image: -moz-linear-gradient(top, #444343, #444343);
	background-image: -ms-linear-gradient(top, #444343, #444343);
	background-image: -o-linear-gradient(top, #444343, #444343);
	background-image: linear-gradient(top, #444343, #444343);  
	padding: 15px;
	-moz-box-shadow: 0 2px 2px -1px rgba(0,0,0,.9);
	-webkit-box-shadow: 0 2px 2px -1px rgba(0,0,0,.9);
	box-shadow: 0 2px 2px -1px rgba(0,0,0,.9);
	-moz-border-radius: 3px 0 3px 3px;
	-webkit-border-radius: 3px 0 3px 3px;
	border-radius: 3px 0 3px 3px;
}
		
nav li #login-content {
	right: 0;
	width: 250px;  
}
		
/*--------------------*/
		
		#inputs input {
		  background: #7c7c7c;
		  padding: 6px 5px;
		  margin: 0 0 5px 0;
		  width: 238px;
		  border: 1px solid #ccc;
		  -moz-border-radius: 3px;
		  -webkit-border-radius: 3px;
		  border-radius: 3px;
		  -moz-box-shadow: 0 1px 1px #ccc inset;
		  -webkit-box-shadow: 0 1px 1px #ccc inset;
		  box-shadow: 0 1px 1px #ccc inset;
		  color: #FFF;
		}
		
		#inputs input:focus {
		  background-color: #7c7c7c;
		  border-color: #e8c291;
		  outline: none;
		  -moz-box-shadow: 0 0 0 1px #e8c291 inset;
		  -webkit-box-shadow: 0 0 0 1px #e8c291 inset;
		  box-shadow: 0 0 0 1px #e8c291 inset;
		}
		
	#inputs input {
		background: #7c7c7c;
		padding: 6px 5px;
		margin: 0 0 5px 0;
		width: 238px;
		border: 1px solid #ccc;
		-moz-border-radius: 3px;
		-webkit-border-radius: 3px;
		border-radius: 3px;
		-moz-box-shadow: 0 1px 1px #ccc inset;
		-webkit-box-shadow: 0 1px 1px #ccc inset;
		box-shadow: 0 1px 1px #ccc inset;
		color: #FFF;
	}
		
		#inputs input:focus {
		  background-color: #7c7c7c;
		  border-color: #e8c291;
		  outline: none;
		  -moz-box-shadow: 0 0 0 1px #e8c291 inset;
		  -webkit-box-shadow: 0 0 0 1px #e8c291 inset;
		  box-shadow: 0 0 0 1px #e8c291 inset;
		}
		
		/*--------------------*/
		
		#login #actions {
		  margin: 10px 0 0 0;
		}
/* ----- START ----- LOGIN BUTTON ----- START -----*/		
		#login #submit {		
		  background-color: #d14545;
		  background-image: -webkit-gradient(linear, left top, left bottom, from(#e97171), to(#d14545));
		  background-image: -webkit-linear-gradient(top, #e97171, #d14545);
		  background-image: -moz-linear-gradient(top, #e97171, #d14545);
		  background-image: -ms-linear-gradient(top, #e97171, #d14545);
		  background-image: -o-linear-gradient(top, #e97171, #d14545);
		  background-image: linear-gradient(top, #e97171, #d14545);
		  -moz-border-radius: 3px;
		  -webkit-border-radius: 3px;
		  border-radius: 3px;
		  text-shadow: 0 1px 0 rgba(0,0,0,.5);
		  -moz-box-shadow: 0 0 1px rgba(0, 0, 0, 0.3), 0 1px 0 rgba(255, 255, 255, 0.3) inset;
		  -webkit-box-shadow: 0 0 1px rgba(0, 0, 0, 0.3), 0 1px 0 rgba(255, 255, 255, 0.3) inset;
		  box-shadow: 0 0 1px rgba(0, 0, 0, 0.3), 0 1px 0 rgba(255, 255, 255, 0.3) inset;    
		  border: 1px solid #7e1515;
		  float: left;
		  height: 30px;
		  padding: 0;
		  width: 100px;
		  cursor: pointer;
		  font: bold 14px Arial, Helvetica;
		  color: #fff;
		  margin-right: 3px;
		}
		
		#login #submit:hover,
		#login #submit:focus {		
		  background-color: #e97171;
		  background-image: -webkit-gradient(linear, left top, left bottom, from(#d14545), to(#e97171));
		  background-image: -webkit-linear-gradient(top, #d14545, #e97171);
		  background-image: -moz-linear-gradient(top, #d14545, #e97171);
		  background-image: -ms-linear-gradient(top, #d14545, #e97171);
		  background-image: -o-linear-gradient(top, #d14545, #e97171);
		  background-image: linear-gradient(top, #d14545, #e97171);
		}
		
		#login #submit:active {		
		  outline: none;
		  -moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5) inset;
		  -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5) inset;
		  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5) inset;		
		}
		
		#login #submit::-moz-focus-inner {
		  border: none;
		}
/* ----- END ----- LOGIN BUTTON ----- END -----*/		

/* ----- START ----- FORGOT BUTTON ----- START -----*/
		
		#login #forgot {		
		  background-color: #d14545;
		  background-image: -webkit-gradient(linear, left top, left bottom, from(#e97171), to(#d14545));
		  background-image: -webkit-linear-gradient(top, #e97171, #d14545);
		  background-image: -moz-linear-gradient(top, #e97171, #d14545);
		  background-image: -ms-linear-gradient(top, #e97171, #d14545);
		  background-image: -o-linear-gradient(top, #e97171, #d14545);
		  background-image: linear-gradient(top, #e97171, #d14545);
		  -moz-border-radius: 3px;
		  -webkit-border-radius: 3px;
		  border-radius: 3px;
		  text-shadow: 0 1px 0 rgba(0,0,0,.5);
		  -moz-box-shadow: 0 0 1px rgba(0, 0, 0, 0.3), 0 1px 0 rgba(255, 255, 255, 0.3) inset;
		  -webkit-box-shadow: 0 0 1px rgba(0, 0, 0, 0.3), 0 1px 0 rgba(255, 255, 255, 0.3) inset;
		  box-shadow: 0 0 1px rgba(0, 0, 0, 0.3), 0 1px 0 rgba(255, 255, 255, 0.3) inset;    
		  border: 1px solid #7e1515;
		  float: left;
		  height: 30px;
		  padding: 0;
		  width: 144px;
		  cursor: pointer;
		  font: bold 14px Arial, Helvetica;
		  color: #fff;
		  margin-left: 3px;
		}
		
		#login #forgot:hover,
		#login #forgot:focus {		
		  background-color: #e97171;
		  background-image: -webkit-gradient(linear, left top, left bottom, from(#d14545), to(#e97171));
		  background-image: -webkit-linear-gradient(top, #d14545, #e97171);
		  background-image: -moz-linear-gradient(top, #d14545, #e97171);
		  background-image: -ms-linear-gradient(top, #d14545, #e97171);
		  background-image: -o-linear-gradient(top, #d14545, #e97171);
		  background-image: linear-gradient(top, #d14545, #e97171);
		}
		
		#login #forgot:active {		
		  outline: none;
		  -moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5) inset;
		  -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5) inset;
		  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5) inset;		
		}
		
		#login #forgot::-moz-focus-inner {
		  border: none;
		}
/* ----- END ----- FORGOT BUTTON ----- END -----*/

/* ----- START ----- FORGOT BUTTON ----- START -----*/
		
		#login #passwordbtn {		
		  background-color: #d14545;
		  background-image: -webkit-gradient(linear, left top, left bottom, from(#e97171), to(#d14545));
		  background-image: -webkit-linear-gradient(top, #e97171, #d14545);
		  background-image: -moz-linear-gradient(top, #e97171, #d14545);
		  background-image: -ms-linear-gradient(top, #e97171, #d14545);
		  background-image: -o-linear-gradient(top, #e97171, #d14545);
		  background-image: linear-gradient(top, #e97171, #d14545);
		  -moz-border-radius: 3px;
		  -webkit-border-radius: 3px;
		  border-radius: 3px;
		  text-shadow: 0 1px 0 rgba(0,0,0,.5);
		  -moz-box-shadow: 0 0 1px rgba(0, 0, 0, 0.3), 0 1px 0 rgba(255, 255, 255, 0.3) inset;
		  -webkit-box-shadow: 0 0 1px rgba(0, 0, 0, 0.3), 0 1px 0 rgba(255, 255, 255, 0.3) inset;
		  box-shadow: 0 0 1px rgba(0, 0, 0, 0.3), 0 1px 0 rgba(255, 255, 255, 0.3) inset;    
		  border: 1px solid #7e1515;
		  float: left;
		  height: 30px;
		  padding: 0;
		  width: 144px;
		  cursor: pointer;
		  font: bold 14px Arial, Helvetica;
		  color: #fff;
		  margin-right: 3px;
		}
		
		#login #passwordbtn:hover,
		#login #passwordbtn:focus {		
		  background-color: #e97171;
		  background-image: -webkit-gradient(linear, left top, left bottom, from(#d14545), to(#e97171));
		  background-image: -webkit-linear-gradient(top, #d14545, #e97171);
		  background-image: -moz-linear-gradient(top, #d14545, #e97171);
		  background-image: -ms-linear-gradient(top, #d14545, #e97171);
		  background-image: -o-linear-gradient(top, #d14545, #e97171);
		  background-image: linear-gradient(top, #d14545, #e97171);
		}
		
		#login #passwordbtn:active {		
		  outline: none;
		  -moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5) inset;
		  -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5) inset;
		  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5) inset;		
		}
		
		#login #passwordbtn::-moz-focus-inner {
		  border: none;
		}
/* ----- END ----- FORGOT BUTTON ----- END -----*/

		#login label {
			color: #fff;
			float: left;
			line-height: 30px;
		}
		
		#login label input {
		  position: relative;
		  top: 2px;
		  right: 2px;
		}
		
		/*--------------------*/
		
		#about {
			margin: 15px;
		}
		
		#about a {
			color: #555;
		}
		
.content { background: #000; height: 2000px; margin: 0px auto; width: 1024px; border: solid 1px white; }
<!DOCTYPE html>
<html>
<head>
<title>Welcome to Spout TV</title>
<link rel=stylesheet type="text/css" href="scripts/css/spouttv.css">
	<!--[if lt IE 9]>
		<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
	<![endif]-->		
	<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
	<script src="scripts/js/login.js"></script>
<script src="scripts/js/functions.js"></script>
</head>

<body>
<header>
	<nav>
        <a href="http://www.spouttv.com/"><img src="assets/images/logo.png" id="logo" alt="Spout TV"></a>
        <li id="navmenu"><a href="#">TV Shows</a></li>
        <li id="navmenu"><a href="#">Movies</a></li>
        <li id="navmenu"><a href="#">Documentaries</a></li>
        <li id="navmenu"><a href="#">Kids Shows</a></li>
        <li id="navmenu"><a href="#">Favourites</a></li>
        <form id=header-search>
            <input class=searchbox placeholder="Search Spout TV">
            <input type=submit class=button value=""/>
        </form>
        <ul>
            <li id="login">
                <a id="login-trigger" href="#">
                    Log in <span>&#x25BC;</span>
                </a>
                <div id="login-content">
                    <form id='userlogin' role="search" method="get" class="input-group" action="login.php" onSubmit="dologin(document.getElementById('user').value, document.getElementById('pass').value); return false;">
                        <fieldset id="inputs">
                            <label>Email:</label>
                            <input id="username" type="email" name="Email" placeholder="Your Email address" required>
                            <label>Password:</label>
                            <input id="password" type="password" name="Password" placeholder="Password" required>
                        </fieldset>
                        <fieldset id="actions">
                            <input type="submit" id="submit" value="Log in"><input type="button" onClick="f_p();" id="forgot" value="Forgot Password">
                            <label><input type="checkbox" checked="checked"> Keep me signed in</label>
                        </fieldset>
                    </form>
                    
                    <form method='post' style='display:none;' name='forgot_pwd' id='forgot_pwd' action='forgot_password.php'>
                        <fieldset id="inputs">	
                            <label>Enter Email address:</label>
                            <input id="username" type="email" name="Email" placeholder="Your Email address" required>
                        </fieldset>
                        <fieldset id="actions">
                            <input type="submit" id="passwordbtn" name="for_pwd" value="Send Password" />
                            <input type="button" onclick='p_f();' id="submit" value='Back'/>
                        </fieldset>
                    </form>
                </div>                     
            </li>
            <li id="signup">
                <a href="registration.html">Sign Up</a>
            </li>
        </ul>
    </nav>
</header>
<div class="clear"></div>
<div class="content">
	<p id="about">Back to <a href="/simple-and-effective-dropdown-login-box">article</a> / Drop me a message on <a href="http://twitter.com/catalinred">Twitter</a>!</p>
</div>
</body>
</html>

2 个答案:

答案 0 :(得分:0)

我添加了

 header{
position: fixed;/*added*/
z-index: 1;/*added*/
padding: 8px 0;/*changed*/
}

.content{
position: relative;/*added*/
top: 66px;/*added*/
}

&#13;
&#13;
$(document).ready(function(){
	$('#login-trigger').click(function(){
		$(this).next('#login-content').slideToggle();
		$(this).toggleClass('active');					
					
		if ($(this).hasClass('active')) $(this).find('span').html('&#x25B2;')
		else $(this).find('span').html('&#x25BC;')
	})
});


function f_p(){
	document.getElementById('forgot_pwd').style.display='block';
	document.getElementById('userlogin').style.display='none';
}
function p_f(){
	document.getElementById('forgot_pwd').style.display='none';
	document.getElementById('userlogin').style.display='block';
}
&#13;
@charset "utf-8";
/* CSS Document */

article, aside, details, figcaption, figure,footer, header, hgroup, menu, nav, section {display: block;}
fieldset{margin: 0;padding: 0;border: 0;}
input:focus,textarea:focus {outline: none;}
		
/*----------------------*/
		
body{background: #000; font-family: Arial, Helvetica, sans-serif;color: #444;margin: 0;font-size: 1.2em;}     
#logo{border: none; float: left;height: 50px;margin: -5px 5px 0px 0px;width: 130px;}
#navmenu {color: #FFF;font-size:18px;list-style: outside none none;margin: 20px 5px 5px 5px;text-decoration: none;}
input.searchbox {-webkit-border-radius: 10px;-moz-border-radius: 10px;background-color: #af5354;border: 1px solid #af5354;background-color: #AF5354;border: 1px solid #AF5354;border-radius: 5px;color: #FFF;float: left;height: 19px;margin-left: 0.5em;margin-top: 1.3em;outline: 0px none;padding-left: 0.5em;padding-top: 0.3em;text-align: left;width: 170px;}
input.searchbox:focus {background: #e87476;background: -moz-linear-gradient(top, #e87476 0%, #e87476 20%);background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #e87476), color-stop(20%, #e87476));    outline: 0;color: #FFF;}
*::-webkit-input-placeholder { color: #FFF; }
*:-moz-placeholder { color: #FFF; }
*::-moz-placeholder { color: #FFF; }
*:-ms-input-placeholder { color: #FFF; }
input.button {padding: 0px;margin: 15px 0px 0px -28px;width: 38px;height: 28px;border: 0;float: left;border: none;background: url("../../assets/images/sprite.png") -142px -7px;overflow: hidden;}
input.button:hover {border: 0;padding: 0;margin: 15px 0px 0px -28px;width: 38px;height: 28px;background: url("../../assets/images/sprite.png") -142px -47px;float: left;border: none;}
input[type=search] { -webkit-appearance: none; }
#navmenu a{color:#FFF;text-decoration:none;}	
#navmenu a:hover {text-decoration:none;}

/*----------------------*/
		
.cf:before, .cf:after {content:"";display:table;}
.cf:after {clear:both;}
.cf {zoom:1;}
		  
/*----------------------*/
		
header {
    width:100%;
    position:fixed;/*added*/
    z-index:1;/*added*/
	padding: 8px 0;/* changed */
	background-color: #8C080A;
	background-image: -webkit-gradient(linear, left top, left bottom, from(#a8090c), to(#8c080a));
	background-image: -webkit-linear-gradient(top, #a8090c, #8c080a);
	background-image: -moz-linear-gradient(top, #a8090c, #8c080a);
	background-image: -ms-linear-gradient(top, #a8090c, #8c080a);
	background-image: -o-linear-gradient(top, #a8090c, #8c080a);
	background-image: linear-gradient(top, #a8090c, #8c080a);
	-moz-box-shadow: 0 -3px 3px rgba(0,0,0,.5) inset;
	-webkit-box-shadow: 0 -3px 3px rgba(0,0,0,.5) inset;
	box-shadow: 0 -3px 3px rgba(0,0,0,.5) inset;
	height: 50px;
}
		
/*----------------------*/
		
nav {font-size: 16px;font-weight: bold;margin-left: auto;margin-right: auto;width: 1024px; }
nav ul {margin: 20px 0px 0px;padding: 0;list-style: none;position: relative;float: right;background: from(#a8090c), to(#8c080a);-moz-border-radius: 3px;-webkit-border-radius: 3px;border-radius: 3px;}
nav li {float: left;}
nav #login { border-right: 1px solid #fff;-moz-box-shadow: 1px 0 0 #fff;-webkit-box-shadow: 1px 0 0 #fff;box-shadow: 1px 0 0 #fff; }
nav #login-trigger, nav #signup a {	display: inline-block; *display: inline; *zoom: 1; height: 25px; line-height: 25px;  font-weight: bold; padding: 0 8px; text-decoration: none; color: #FFF; }
nav #signup a {	-moz-border-radius: 0 3px 3px 0; -webkit-border-radius: 0 3px 3px 0; border-radius: 0 3px 3px 0; }
nav #login-trigger { -moz-border-radius: 3px 0 0 3px; -webkit-border-radius: 3px 0 0 3px; border-radius: 3px 0 0 3px; }
		
nav #login-trigger:hover, nav #login .active, nav #signup a:hover {	background: from(#a8090c), to(#8c080a); }
		
nav #login-content {
	display: none;
	position: absolute;
	top: 35px;
	right: 0;
	z-index: 999;    
	background: #444343;
	background-image: -webkit-gradient(linear, left top, left bottom, from(#444343), to(#444343));
	background-image: -webkit-linear-gradient(top, #444343, #444343);
	background-image: -moz-linear-gradient(top, #444343, #444343);
	background-image: -ms-linear-gradient(top, #444343, #444343);
	background-image: -o-linear-gradient(top, #444343, #444343);
	background-image: linear-gradient(top, #444343, #444343);  
	padding: 15px;
	-moz-box-shadow: 0 2px 2px -1px rgba(0,0,0,.9);
	-webkit-box-shadow: 0 2px 2px -1px rgba(0,0,0,.9);
	box-shadow: 0 2px 2px -1px rgba(0,0,0,.9);
	-moz-border-radius: 3px 0 3px 3px;
	-webkit-border-radius: 3px 0 3px 3px;
	border-radius: 3px 0 3px 3px;
}
		
nav li #login-content {
	right: 0;
	width: 250px;  
}
		
/*--------------------*/
		
		#inputs input {
		  background: #7c7c7c;
		  padding: 6px 5px;
		  margin: 0 0 5px 0;
		  width: 238px;
		  border: 1px solid #ccc;
		  -moz-border-radius: 3px;
		  -webkit-border-radius: 3px;
		  border-radius: 3px;
		  -moz-box-shadow: 0 1px 1px #ccc inset;
		  -webkit-box-shadow: 0 1px 1px #ccc inset;
		  box-shadow: 0 1px 1px #ccc inset;
		  color: #FFF;
		}
		
		#inputs input:focus {
		  background-color: #7c7c7c;
		  border-color: #e8c291;
		  outline: none;
		  -moz-box-shadow: 0 0 0 1px #e8c291 inset;
		  -webkit-box-shadow: 0 0 0 1px #e8c291 inset;
		  box-shadow: 0 0 0 1px #e8c291 inset;
		}
		
	#inputs input {
		background: #7c7c7c;
		padding: 6px 5px;
		margin: 0 0 5px 0;
		width: 238px;
		border: 1px solid #ccc;
		-moz-border-radius: 3px;
		-webkit-border-radius: 3px;
		border-radius: 3px;
		-moz-box-shadow: 0 1px 1px #ccc inset;
		-webkit-box-shadow: 0 1px 1px #ccc inset;
		box-shadow: 0 1px 1px #ccc inset;
		color: #FFF;
	}
		
		#inputs input:focus {
		  background-color: #7c7c7c;
		  border-color: #e8c291;
		  outline: none;
		  -moz-box-shadow: 0 0 0 1px #e8c291 inset;
		  -webkit-box-shadow: 0 0 0 1px #e8c291 inset;
		  box-shadow: 0 0 0 1px #e8c291 inset;
		}
		
		/*--------------------*/
		
		#login #actions {
		  margin: 10px 0 0 0;
		}
/* ----- START ----- LOGIN BUTTON ----- START -----*/		
		#login #submit {		
		  background-color: #d14545;
		  background-image: -webkit-gradient(linear, left top, left bottom, from(#e97171), to(#d14545));
		  background-image: -webkit-linear-gradient(top, #e97171, #d14545);
		  background-image: -moz-linear-gradient(top, #e97171, #d14545);
		  background-image: -ms-linear-gradient(top, #e97171, #d14545);
		  background-image: -o-linear-gradient(top, #e97171, #d14545);
		  background-image: linear-gradient(top, #e97171, #d14545);
		  -moz-border-radius: 3px;
		  -webkit-border-radius: 3px;
		  border-radius: 3px;
		  text-shadow: 0 1px 0 rgba(0,0,0,.5);
		  -moz-box-shadow: 0 0 1px rgba(0, 0, 0, 0.3), 0 1px 0 rgba(255, 255, 255, 0.3) inset;
		  -webkit-box-shadow: 0 0 1px rgba(0, 0, 0, 0.3), 0 1px 0 rgba(255, 255, 255, 0.3) inset;
		  box-shadow: 0 0 1px rgba(0, 0, 0, 0.3), 0 1px 0 rgba(255, 255, 255, 0.3) inset;    
		  border: 1px solid #7e1515;
		  float: left;
		  height: 30px;
		  padding: 0;
		  width: 100px;
		  cursor: pointer;
		  font: bold 14px Arial, Helvetica;
		  color: #fff;
		  margin-right: 3px;
		}
		
		#login #submit:hover,
		#login #submit:focus {		
		  background-color: #e97171;
		  background-image: -webkit-gradient(linear, left top, left bottom, from(#d14545), to(#e97171));
		  background-image: -webkit-linear-gradient(top, #d14545, #e97171);
		  background-image: -moz-linear-gradient(top, #d14545, #e97171);
		  background-image: -ms-linear-gradient(top, #d14545, #e97171);
		  background-image: -o-linear-gradient(top, #d14545, #e97171);
		  background-image: linear-gradient(top, #d14545, #e97171);
		}
		
		#login #submit:active {		
		  outline: none;
		  -moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5) inset;
		  -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5) inset;
		  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5) inset;		
		}
		
		#login #submit::-moz-focus-inner {
		  border: none;
		}
/* ----- END ----- LOGIN BUTTON ----- END -----*/		

/* ----- START ----- FORGOT BUTTON ----- START -----*/
		
		#login #forgot {		
		  background-color: #d14545;
		  background-image: -webkit-gradient(linear, left top, left bottom, from(#e97171), to(#d14545));
		  background-image: -webkit-linear-gradient(top, #e97171, #d14545);
		  background-image: -moz-linear-gradient(top, #e97171, #d14545);
		  background-image: -ms-linear-gradient(top, #e97171, #d14545);
		  background-image: -o-linear-gradient(top, #e97171, #d14545);
		  background-image: linear-gradient(top, #e97171, #d14545);
		  -moz-border-radius: 3px;
		  -webkit-border-radius: 3px;
		  border-radius: 3px;
		  text-shadow: 0 1px 0 rgba(0,0,0,.5);
		  -moz-box-shadow: 0 0 1px rgba(0, 0, 0, 0.3), 0 1px 0 rgba(255, 255, 255, 0.3) inset;
		  -webkit-box-shadow: 0 0 1px rgba(0, 0, 0, 0.3), 0 1px 0 rgba(255, 255, 255, 0.3) inset;
		  box-shadow: 0 0 1px rgba(0, 0, 0, 0.3), 0 1px 0 rgba(255, 255, 255, 0.3) inset;    
		  border: 1px solid #7e1515;
		  float: left;
		  height: 30px;
		  padding: 0;
		  width: 144px;
		  cursor: pointer;
		  font: bold 14px Arial, Helvetica;
		  color: #fff;
		  margin-left: 3px;
		}
		
		#login #forgot:hover,
		#login #forgot:focus {		
		  background-color: #e97171;
		  background-image: -webkit-gradient(linear, left top, left bottom, from(#d14545), to(#e97171));
		  background-image: -webkit-linear-gradient(top, #d14545, #e97171);
		  background-image: -moz-linear-gradient(top, #d14545, #e97171);
		  background-image: -ms-linear-gradient(top, #d14545, #e97171);
		  background-image: -o-linear-gradient(top, #d14545, #e97171);
		  background-image: linear-gradient(top, #d14545, #e97171);
		}
		
		#login #forgot:active {		
		  outline: none;
		  -moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5) inset;
		  -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5) inset;
		  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5) inset;		
		}
		
		#login #forgot::-moz-focus-inner {
		  border: none;
		}
/* ----- END ----- FORGOT BUTTON ----- END -----*/

/* ----- START ----- FORGOT BUTTON ----- START -----*/
		
		#login #passwordbtn {		
		  background-color: #d14545;
		  background-image: -webkit-gradient(linear, left top, left bottom, from(#e97171), to(#d14545));
		  background-image: -webkit-linear-gradient(top, #e97171, #d14545);
		  background-image: -moz-linear-gradient(top, #e97171, #d14545);
		  background-image: -ms-linear-gradient(top, #e97171, #d14545);
		  background-image: -o-linear-gradient(top, #e97171, #d14545);
		  background-image: linear-gradient(top, #e97171, #d14545);
		  -moz-border-radius: 3px;
		  -webkit-border-radius: 3px;
		  border-radius: 3px;
		  text-shadow: 0 1px 0 rgba(0,0,0,.5);
		  -moz-box-shadow: 0 0 1px rgba(0, 0, 0, 0.3), 0 1px 0 rgba(255, 255, 255, 0.3) inset;
		  -webkit-box-shadow: 0 0 1px rgba(0, 0, 0, 0.3), 0 1px 0 rgba(255, 255, 255, 0.3) inset;
		  box-shadow: 0 0 1px rgba(0, 0, 0, 0.3), 0 1px 0 rgba(255, 255, 255, 0.3) inset;    
		  border: 1px solid #7e1515;
		  float: left;
		  height: 30px;
		  padding: 0;
		  width: 144px;
		  cursor: pointer;
		  font: bold 14px Arial, Helvetica;
		  color: #fff;
		  margin-right: 3px;
		}
		
		#login #passwordbtn:hover,
		#login #passwordbtn:focus {		
		  background-color: #e97171;
		  background-image: -webkit-gradient(linear, left top, left bottom, from(#d14545), to(#e97171));
		  background-image: -webkit-linear-gradient(top, #d14545, #e97171);
		  background-image: -moz-linear-gradient(top, #d14545, #e97171);
		  background-image: -ms-linear-gradient(top, #d14545, #e97171);
		  background-image: -o-linear-gradient(top, #d14545, #e97171);
		  background-image: linear-gradient(top, #d14545, #e97171);
		}
		
		#login #passwordbtn:active {		
		  outline: none;
		  -moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5) inset;
		  -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5) inset;
		  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5) inset;		
		}
		
		#login #passwordbtn::-moz-focus-inner {
		  border: none;
		}
/* ----- END ----- FORGOT BUTTON ----- END -----*/

		#login label {
			color: #fff;
			float: left;
			line-height: 30px;
		}
		
		#login label input {
		  position: relative;
		  top: 2px;
		  right: 2px;
		}
		
		/*--------------------*/
		
		#about {
			margin: 15px;
		}
		
		#about a {
			color: #555;
		}
		
.content { background: #000; height: 2000px; margin: 0px auto; width: 1024px; border: solid 1px white; position:relative;/*added*/ top:66px;/*added*/}
&#13;
<!DOCTYPE html>
<html>
<head>
<title>Welcome to Spout TV</title>
<link rel=stylesheet type="text/css" href="scripts/css/spouttv.css">
	<!--[if lt IE 9]>
		<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
	<![endif]-->		
	<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
	<script src="scripts/js/login.js"></script>
<script src="scripts/js/functions.js"></script>
</head>

<body>
<header>
	<nav>
        <a href="http://www.spouttv.com/"><img src="assets/images/logo.png" id="logo" alt="Spout TV"></a>
        <li id="navmenu"><a href="#">TV Shows</a></li>
        <li id="navmenu"><a href="#">Movies</a></li>
        <li id="navmenu"><a href="#">Documentaries</a></li>
        <li id="navmenu"><a href="#">Kids Shows</a></li>
        <li id="navmenu"><a href="#">Favourites</a></li>
        <form id=header-search>
            <input class=searchbox placeholder="Search Spout TV">
            <input type=submit class=button value=""/>
        </form>
        <ul>
            <li id="login">
                <a id="login-trigger" href="#">
                    Log in <span>&#x25BC;</span>
                </a>
                <div id="login-content">
                    <form id='userlogin' role="search" method="get" class="input-group" action="login.php" onSubmit="dologin(document.getElementById('user').value, document.getElementById('pass').value); return false;">
                        <fieldset id="inputs">
                            <label>Email:</label>
                            <input id="username" type="email" name="Email" placeholder="Your Email address" required>
                            <label>Password:</label>
                            <input id="password" type="password" name="Password" placeholder="Password" required>
                        </fieldset>
                        <fieldset id="actions">
                            <input type="submit" id="submit" value="Log in"><input type="button" onClick="f_p();" id="forgot" value="Forgot Password">
                            <label><input type="checkbox" checked="checked"> Keep me signed in</label>
                        </fieldset>
                    </form>
                    
                    <form method='post' style='display:none;' name='forgot_pwd' id='forgot_pwd' action='forgot_password.php'>
                        <fieldset id="inputs">	
                            <label>Enter Email address:</label>
                            <input id="username" type="email" name="Email" placeholder="Your Email address" required>
                        </fieldset>
                        <fieldset id="actions">
                            <input type="submit" id="passwordbtn" name="for_pwd" value="Send Password" />
                            <input type="button" onclick='p_f();' id="submit" value='Back'/>
                        </fieldset>
                    </form>
                </div>                     
            </li>
            <li id="signup">
                <a href="registration.html">Sign Up</a>
            </li>
        </ul>
    </nav>
</header>
<div class="clear"></div>
<div class="content">
	<p id="about">Back to <a href="/simple-and-effective-dropdown-login-box">article</a> / Drop me a message on <a href="http://twitter.com/catalinred">Twitter</a>!</p>
</div>
</body>
</html>
&#13;
&#13;
&#13;

答案 1 :(得分:0)

您可以使用

粘贴标题

此处示例:http://jsfiddle.net/vey2ea1t/

header {
position: fixed;
}

在几条评论之后编辑:

请使用:

<header style="position: fixed !important; width: 100%;">

并从标记nav中移除此css:

margin-left: auto;