[英]how to align elements using css in angular typeahead
http://plnkr.co/edit/LmMwgy2gig11nQXzCt1I?p=preview
我希望最终结果看起来像这样:
CSS应该如何设置,以便搜索按钮与搜索输入对齐并在搜索输入旁边?
像这样:
<div>
<div style="width: 300px; float: left; height: 40px;"></div>
<div style="width: 80px; float: left; height: 40px;"></div>
<div style="clear: both"></div>
</div>
然后将按钮放置在第二个div内,将输入放置在第一个div内。
使周围的元素()位置相对。
将输入位置设为绝对,然后定位。
对于mag图标,只需使用背景图片,确保将显示设置为“阻止”并设置正确的宽度和高度即可。 删除字体为:0;的搜索文本。
看这个演示
<div class="srch">
<input type="text" ng-model="selected" typeahead="state for state in states | filter:$viewValue | limitTo:8">
<button>search</button>
</div>
.srch button {
float: right position: absolute;
margin-left: -56px;
display: table-cell;
background: #08c;
color: #fff;
height: 30px;
border: none;
}
.srch input {
float: left;
padding-right: 60px;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.