带 Bootstrap 的 HTML 新行

Gri*_*zly 3 html css twitter-bootstrap

使用此参考和红色警报选项。这里是:

<div class="alert alert-dismissible alert-danger">
    <button type="button" class="close" data-dismiss="alert">&times;</button>
    <strong>Oh snap!</strong> <a href="#" class="alert-link">Change a few things up</a> and try submitting again.
</div>
Run Code Online (Sandbox Code Playgroud)

在他们的示例中,try之后有一个换行符.. 仅仅是因为宽度吗?

我的版本:

<div class="alert alert-dismissable alert-danger" style="float:right;">
    <button type="button" class="close" data-dissmiss="alert">&times;</button>
    <strong>Leave blank if there is already a Record for today!&#13;&#10; This will auto-calculate based on the previous Record.</strong>
</div>
Run Code Online (Sandbox Code Playgroud)

现在我的没有任何换行符,但我也没有弄乱 CSS .. 但我想知道是否有办法在内<strong>联中放置换行符?我尝试使用this,但我想那是严格用于<textarea>'s 的。

任何帮助表示赞赏。

Wow*_*wsk 6

只需br在您想要换行的地方放置一个标签。请注意下面示例中记录后的新行,因为插入了<br>.

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">

<div class="alert alert-dismissable alert-danger" style="float:right;">
    <button type="button" class="close" data-dissmiss="alert">&times;</button>
    <strong>Leave blank if there is already a Record<br>for today!&#13;&#10; This will auto-calculate based on the previous Record.</strong>
</div>
Run Code Online (Sandbox Code Playgroud)

  • 请注意,`&lt;br/&gt;` 不应用于所有情况。仅用于分解文本。当您希望整个元素在自己的行上时,请在 CSS 中使用 `display: block`。 (3认同)