如何在Bootstrap警报上应用文本对齐方式

时间:2014-12-02 04:10:17

标签: twitter-bootstrap

我想问一下如何在Bootstrap警报中证明(左右对齐)文本。我尝试将类text-justify与alert类一起使用,但无法使文本合理化。代码如下:

<div class="alert alert-danger alert-error text-justify">
    <a href="#" class="close" data-dismiss="alert">&times;</a>
    <span class="glyphicon glyphicon-remove-circle"></span> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque scelerisque enim non dolor blandit lobortis. Aenean risus elit, porta eu consectetur vel, mollis ut risus
</div>.

到目前为止,我的输出如下:

enter image description here

由于

1 个答案:

答案 0 :(得分:0)

链接到bootply http://www.bootply.com/d3oeN9GlOg

像这样更改你的代码并查看。

<div class="alert alert-danger alert-error text-justify">
  <div class="container">
    <div class="row">
      <a href="#" class="close" data-dismiss="alert">&times;</a>
    </div>
    <span class="glyphicon glyphicon-remove-circle"></span> 
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque scelerisque enim       non dolor blandit lobortis. Aenean risus elit, porta eu consectetur vel, mollis ut risus
  </div>
</div>

容器 div是可选的。

如果您不想要容器并希望关闭按钮和其他元素在同一行中,请改用此代码。

<div class="alert alert-danger alert-error text-justify">
  <div class="row">
    <div class="col-xs-11">
      <span class="glyphicon glyphicon-remove-circle"></span> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque scelerisque enim non dolor blandit lobortis. Aenean risus elit, porta eu consectetur vel, mollis ut risus 
    </div>
    <div class="col-xs-1">
      <a href="#" class="close" data-dismiss="alert">×</a>
    </div>
   </div>
</div>

请参阅更新后的bootply:http://www.bootply.com/tyrOuAN0x0