尝试了一切..这只是没有让步。这个论坛帖子是我最后的选择。已经有3天时间搞乱了大量的CSS设置组合,检查JS是否有问题,而且一般都会失去我的头发。
请帮我解决这个问题。我真的不想放弃整个项目,因为某个地方有一条愚蠢的代码。
问题:popover框加载flush到屏幕顶部,我尝试在bootstrap.css和删除/添加div元素的每个容器中添加边距帮助解决这个......什么都没有!
HTML :
<a href="#" type="submit" name="login" data-placement="left" data-toggle="popover" data-target="#login-popover" class="glyphicon glyphicon-user" style="float: right; text-decoration: none;"></a>
<div id="login-popover" role="dialog" aria-labelledby="myPopoverLabel" aria-hidden="true" style="display: none;">
<div class="loginpopover-container">
<h1>Login to Your Account</h1>
<br>
<form method="post" >
<input type="text" name="username" placeholder="Username">
<input type="password" name="password" placeholder="Password">
<input type="submit" name="login" class="login loginpopover-submit" value="Login">
</form>
<div class="login-help"> <a href="#">Register</a><a href="#" style="float: right">Forgot Password</a> </div>
<div class="form-group">
<div class="col-sm-10 col-sm-offset-2"> <?php echo $usernameErr; ?> <?php echo $passwordErr; ?> </div>
</div>
</div>
</div>
&#13;
LOGINBOX.CSS :
@import url(http://fonts.googleapis.com/css?family=Roboto);
/****** LOGIN POPOVER ******/
.loginpopover-container {
padding: 10px;
max-width: 300px;
width: 100% !important;
overflow: hidden;
font-family: roboto;
}
.loginpopover-container h1 {
text-align: center;
font-size: 1.8em;
font-family: roboto;
}
.loginpopover-container input[type=submit] {
width: 100%;
display: block;
margin-bottom: 10px;
position: relative;
}
.loginpopover-container input[type=text], input[type=password] {
height: 44px;
font-size: 16px;
width: 100%;
margin-bottom: 10px;
-webkit-appearance: none;
background: #fff;
border: 1px solid #d9d9d9;
border-top: 1px solid #c0c0c0;
/* border-radius: 2px; */
padding: 0 8px;
box-sizing: border-box;
-moz-box-sizing: border-box;
}
.loginpopover-container input[type=text]:hover, input[type=password]:hover {
border: 1px solid #b9b9b9;
border-top: 1px solid #a0a0a0;
-moz-box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
-webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}
.login-popover {
text-align: center;
font-size: 14px;
font-family: 'Arial', sans-serif;
font-weight: 700;
height: 36px;
/* border-radius: 3px; */
/* -webkit-user-select: none;
user-select: none; */
}
.loginpopover-submit {
/* border: 1px solid #3079ed; */
border: 0px;
color: #fff;
text-shadow: 0 1px rgba(0,0,0,0.1);
background-color: #4d90fe;
padding: 17px 0px;
font-family: roboto;
font-size: 14px;
/* background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#4d90fe), to(#4787ed)); */
}
.loginpopover-submit:hover {
/* border: 1px solid #2f5bb7; */
border: 0px;
text-shadow: 0 1px rgba(0,0,0,0.3);
background-color: #357ae8;
/* background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#4d90fe), to(#357ae8)); */
}
.loginpopover-container a {
text-decoration: none;
color: #666;
font-weight: 400;
text-align: center;
display: inline-block;
opacity: 0.6;
transition: opacity ease 0.5s;
}
.login-help{
font-size: 12px;
}
JAVASCRIPT :
<script>
$('[data-toggle=popover]').popover({
html: true,
content: function () {
var targetId = $(this).attr('data-target');
return $(targetId).html();
}
});
</script>
在我的辩护中,我之所以如此恼火,是因为我尽我所能,所以我不必把它推给你们。我竭尽全力 - 这个过程严重地考验了我的耐心。
无论如何,任何帮助一如既往地表示赞赏。 (悲伤的鲸鱼脸-_____-)