这应该是一个相对容易的问题。虽然我还没有找到解决方案,因为我是初学者。我想做的就是将搜索框放在中心位置。 html如下:
<div class="colums">
<li class="share"> <a target="_blank" href="#"></a>
</li>
<div id='search-box'>
<form action='/search' id='search-form' method='get' target='_top'>
<input onwebkitspeechchange="voiceInputOver(this.value)" x-webkit-speechname='q'
placeholder='Search Contrabang...' type='text' />
</form>
</div>
</div>
<div class="colums">
<div class="cntratop">
<ul>
<li class="live"> <a target="_blank" href="#">+Contrabang</a>
</li>
<li><a target="_blank" href="#">Blog</a>
</li>
<li><a target="_blank" href="#">Events</a>
</li>
<li><a target="_blank" href="#">About</a>
</li>
<li><a target="_blank" href="#">Contact</a>
</li>
</ul>
</div>
</div>
<div class="columa">
<div id="text-display"> <span>Your Daily Dose of Contrabang</span>
</div>
</div>
CSS如下:
.columa {
background:transparent;
width: 960px;
height: 500px;
margin-left: auto;
margin-right: auto;
text-align: center;
padding: 0px;
}
.colums {
background:transparent;
width: 960px;
margin-left: auto;
margin-right: auto;
text-align: center;
padding: 0px;
}
.cntratop {
font-family: sans-serif;
font-size: 14px;
}
.cntratop ul {
list-style:none;
margin-top:12px;
background:;
width:760px;
padding:0px 0px 0px 0px;
margin-left: auto;
margin-right: auto;
}
.cntratop li {
display:inline-block;
}
.cntratop li:first-child {
margin-left:0px;
}
/*navbar text*/
.cntratop a {
display:inline;
margin-left: -9px;
padding:15px;
text-decoration:none;
color:#999;
cursor:pointer;
}
.cntratop a:hover,
/*
.cntratopli.live*/
a {
font-weight:bold;
color:#E94F78;
}
#search-box {
list-style-type: none;
display: inline;
margin-left: 0px;
margin-right:0px;
}
#search-form {
width:0px;
background-color: transparent;
position: relative;
margin-top: -23px;
}
#search-box input[type="text"] {
width: 760px;
font-family:Georgia;
font-style: italic;
font-size: 90.0%;
padding: 3px 2 2px 10px;
color: #999;
outline: none;
}
#search-text {
font-size: 13px;
font-family:Georgia;
font-style: italic;
border-width: 0;
background: transparent;
}
#search-button {
position: absolute;
top: 0;
right: 0;
height: 32px;
width: 80px;
font-size: 13px;
color: #fff;
text-align: center;
line-height: 0px;
border-width: 0;
background-color: #3d3d3d;
cursor: pointer;
}
#text-display {
background-color:#E94F78;
}
#text-display {
top:;
position: relative;
display:inline-block;
padding:5px 10px;
font-family: sans-serif;
font-weight:bold;
font-size:50px;
color: white;
text-align: center;
line-height: 1.2em;
margin:50px;
}
答案 0 :(得分:3)
#search-form {
/* width:0px; */
background-color: transparent;
position: relative;
margin-top: -23px;
}
从width:0px
中删除#search-form
可以解决此问题。 text-align:center
类中的.colums
样式似乎可以控制搜索输入的对齐方式。
希望有所帮助:)