【发布时间】:2015-09-05 13:46:14
【问题描述】:
我正在尝试在一个框中对齐两个相邻的 div。我正在使用 angularJS 动态生成输入框,我想在每个输入框旁边添加一个删除选项的图像。我使用了“显示:内联块”。但它不起作用。
我到现在的代码是:
<div class="contentBox box effectmission" ng-repeat="mission in missions">
<div class="boxheader">
<span style="font-size: large; font-family: monospace; font-weight: bold;">EDIT MISSION NAME</span><input id="{{mission.id}}" type="text" ng-model="mission.missionInfo" class="form-control" style="background-color: #e8e8e8">
</div>
<div style="padding-top: 10px;">
<span style="font-size: large; font-family: monospace; font-weight: bold; margin-left:5%;">EDIT MISSION POINTS</span><br />
</div>
<div style="padding-top: 10px;">
<ol style="float: left; width: 100%;">
<li id="missioncontent.id" ng-repeat="missioncontent in mission.missionContent" style="padding: 2px; width: 100%;">
<div>
<input id="{{missioncontent.id}}" type="text" ng-model="missioncontent.info" class="form-control" style="background-color: #e8e8e8; width: 80%;">
</div>
<div style="float: right; width: 20%; display: inline-block;">
<span>v</span>
</div>
</li>
</ol>
</div>
</div>
到目前为止,我所拥有的一切都是这样的。
我希望输入框和图像彼此正确对齐。(代替“v”,我将使用图像。)
【问题讨论】:
-
将同级 div 也设置为
float: left。
标签: javascript jquery html css angularjs