将div文本对齐到右边

时间:2015-05-12 16:33:23

标签: html css

这个小提琴中心在页面上对齐内容:

http://jsfiddle.net/jbk7e0we/5/

如何对齐此内容,以便“输​​入文本”与“文本的大条目”右对齐。我已尝试使用align=right但无效。

小提琴代码:

<div class="center">
<div style="display:inline-block; width:200px; align=right">Enter text</div>
<div style="display:inline-block; width:200px;"><input type = "text" size = "15"/></div>

    <div style="block"></div>
<div style="display:inline-block; width:200px; align=right">Big entry for text</div>
<div style="display:inline-block; width:200px;"><input type = "text" size = "15"/></div>
</div>

.center {
    margin-left: auto;
    margin-right: auto;
    width: 800px;
}

4 个答案:

答案 0 :(得分:1)

将内联样式更改为text-align:right;您的代码显示为

<div class="center">
<div style="display:inline-block; width:200px; text-align:right;">Enter text</div>
<div style="display:inline-block; width:200px;"><input type = "text" size = "15"/></div>

    <div style="block"></div>
<div style="display:inline-block; width:200px; text-align:right;">Big entry for text</div>
<div style="display:inline-block; width:200px;"><input type = "text" size = "15"/></div>
</div>

.center {
    margin-left: auto;
    margin-right: auto;
    width: 800px;
}

答案 1 :(得分:0)

变化:

RedirectToAction("Pay","Payment", model.Payment)

为:

JButton myButton = new JButton("<html>Compute b<sup>-1</sup> (mod a)</html>");

<强> jsFiddle example

答案 2 :(得分:0)

您需要更改

align=right

text-align: right;

示例:

.center {
  margin-left: auto;
  margin-right: auto;
  width: 800px;
}
<div class="center">
  <div style="display:inline-block; width:200px; text-align: right;">Enter text</div>
  <div style="display:inline-block; width:200px;">
    <input type="text" size="15" />
  </div>

  <div style="block"></div>
  <div style="display:inline-block; width:200px; text-align: right;">Big entry for text</div>
  <div style="display:inline-block; width:200px;">
    <input type="text" size="15" />
  </div>
</div>

JSFiddle

答案 3 :(得分:-1)

使用text-align: right;而不是align: right