移动锚标签?

时间:2015-02-12 17:39:57

标签: html css

enter image description here

如何移动"删除"锚定标记,以便与此行的其余控件更好地对齐?

以下是我的HTML:

    <strong><em>Items with an individual value less than $500 should be scheduled below.</em></strong>

<div class="dialogSection">
    <div style="float:left" class="first">
        <label for="unscheduledDescription" style="display:inline-block">
            Description of Equipment
        </label>
        <input id="unscheduledDescription" type="text" data-bind="value: coverage.unscheduledDescription" class="input input-lg" style="margin: 6px; padding: 5px;" />
    </div>
    <div style="float:left" class="first">
        <label for="unscheduledLimit" style="display:inline-block">
            Limit
        </label>
        <input id="unscheduledLimit" type="text" data-bind="value: coverage.unscheduledLimit" class="input input-number" style="margin: 6px; padding: 5px;" />
    </div>
    <div>
        <a href="#" data-bind="click: deleteUnscheduledCmd, clickBubble: false">
            delete
        </a>
    </div>
</div>

感谢您的帮助。

3 个答案:

答案 0 :(得分:1)

当我看到<a>被div包装时,只需在div中添加一个id并应用一些样式:

 <div id = "del">
        <a href="#" data-bind="click: deleteUnscheduledCmd, clickBubble: false">
            delete
        </a>
 </div>

CSS:

#del{
    padding-top:10px;
}

工作小提琴:http://jsfiddle.net/wgsrrbav/

如果我帮助,请告诉我们。)

答案 1 :(得分:1)

绝对 Ashish Mehtha的答案更好。另一个选项是你可以为div添加float:left和margin-top样式(对于margin-top样式而不是10px你可以在1%的位置添加一些东西以使其响应)

<div style="float:left; margin-top:10px;"> <a href="#" data-bind="click: deleteUnscheduledCmd, clickBubble: false"> delete </a> </div>

Jsfiddle

答案 2 :(得分:0)

.dialogSection > div {
  display: inline-block;
  }
 <strong><em>Items with an individual value less than $500 should be scheduled below.</em></strong>

<div class="dialogSection">
    <div class="first">
        <label for="unscheduledDescription" style="display:inline-block">
            Description of Equipment
        </label>
        <input id="unscheduledDescription" type="text" data-bind="value: coverage.unscheduledDescription" class="input input-lg" style="margin: 6px; padding: 5px;" />
    </div>
    <div class="first">
        <label for="unscheduledLimit" style="display:inline-block">
            Limit
        </label>
        <input id="unscheduledLimit" type="text" data-bind="value: coverage.unscheduledLimit" class="input input-number" style="margin: 6px; padding: 5px;" />
    </div>
    <div>
        <a href="#" data-bind="click: deleteUnscheduledCmd, clickBubble: false">
            delete
        </a>
    </div>
</div>

简单添加显示:内联块;内联div中的属性。无需将float:left属性添加到特定的Div。

.dialogSection > div {
    display: inline-block;
}