【发布时间】:2017-08-13 14:15:42
【问题描述】:
.panel-heading 在引导程序中具有 15 像素左右的填充。我希望输入字段在.panel-heading 内扩展 100%。我尝试了负边距:
input.form-control {
text-align:center;
border: 5px solid #ccc;
height: 40px;
margin-left: -15px;
margin-right: -15px;
}
但只有左侧在工作。我怎样才能让右侧也能正常工作?
.col-xs-12 {
padding-left: 0;
padding-right: 0;
}
.panel-heading {
position: -webkit-sticky;
position: -moz-sticky;
position: -ms-sticky;
position: -o-sticky;
position: sticky;
width: 100%;
z-index: 99999;
top: 0;
}
.glyphicon-arrow-left {
margin-top: 5px;
}
.panel-heading h1 {
padding-bottom: 0.65em;
color: #3399ff;
font-weight: bold;
}
.panel-body {
padding: 0;
}
input.form-control {
text-align:center;
border: 5px solid #ccc;
height: 40px;
margin-left: -15px;
margin-right: -15px;
}
.users {
list-style-type: none;
margin: 0;
padding: 0;
}
.users li {
border-bottom: 2px solid #eee;
color: #000;
}
.users li .username {
margin-left: 10px;
}
.users li:last-child {
border-bottom: none;
}
.users a {
display: block;
height: 45px;
padding: 15px 0;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class='container'>
<div class='row'>
<div class='col-sm-6 col-xs-12 col-centered'>
<div class='panel panel-default'>
<div class='panel-heading sticky'>
<div class='back pull-left'><a href='chats.php'><span class='glyphicon glyphicon-arrow-left'></a></span></div>
<h1 class='panel-title text-center'>New Chat</h1>
<input class='form-control' id='searchUser' type='text' placeholder='Search'>
</div>
<div class='panel-body'>
<ul class='users'>
<li class='user text-center'>
<a href='#'><span class='glyphicon glyphicon-user'></span><strong class='username'>John Appleseed</strong></a>
</li>
</ul>
</div>
</div>
</div><!--end column-->
</div><!--end row 1-->
</div><!--end container-->
【问题讨论】:
标签: html css twitter-bootstrap