gpt4 book ai didi

css - 固定位置有问题。

转载 作者:行者123 更新时间:2023-11-28 08:25:37 25 4
gpt4 key购买 nike

我目前正在 build 一个网站,因为我已经完成了标题标签,所以我应用了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>

最佳答案

您可以使用

粘贴标题

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

header {
position: fixed;
}

几条评论后编辑:

请使用:

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

并从标签 nav 中删除此 css:

margin-left: auto; 

关于css - 固定位置有问题。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28537353/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com