Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 如何垂直对齐中间警报解除按钮?_Css_Twitter Bootstrap 3 - Fatal编程技术网

Css 如何垂直对齐中间警报解除按钮?

Css 如何垂直对齐中间警报解除按钮?,css,twitter-bootstrap-3,Css,Twitter Bootstrap 3,如何垂直对齐中间引导警报解除按钮 <div class="alert alert-dismissible alert-info" role="alert"> <div class="alert-message"> Multi<br> Line<br> Alert </div> <button type="button" class="close" data-dismiss="alert" aria-label="Close">

如何垂直对齐中间引导警报解除按钮

<div class="alert alert-dismissible alert-info" role="alert">
<div class="alert-message">
Multi<br>
Line<br>
Alert
</div>
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
</div>

多重

警觉的 &时代;
小提琴:


div警报消息之所以存在,是因为我正在使用jQuery.html更新其中的内容…

您可以将文本包装在

标记中,然后设置
文本对齐:居中在他们身上


这能解决您的问题吗?

如果您想对齐它。在中间垂直,你可以用你当前的HTML做类似的事情。
.alert-message {
   text-align: center;


button{

   display: inline-block;

}  
在警报消息类中,将文本与中心对齐,然后可以使其显示为内联(垂直)


请参见

对于垂直中间,您可以这样做。 将父div添加到位置:相对; 请参阅此处的演示链接

<div class="alert alert-dismissible alert-info" role="alert">
<div class="alert-message">
Multi<br>
Line<br>
Alert
</div>
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
</div>
.alert-info {
  background-color: #d9edf7;
  border-color: #bce8f1;
  color: #31708f;
  left: 50%;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  text-align: center;
}