Html 如何将卡与引导4垂直对齐? 塞尔卡奥拉里奥酒店 我在里塞尔卡的营地里编译了一个分类。 {{alert_message}} &时代; 类别: 古典音乐 Docenti 里塞卡: 塞尔卡
我尝试使用Bootstrap 4垂直对齐一张卡,但我得到的是: 卡片没有居中。 我怎样才能解决这个问题?我在网上搜索了一个解决方案,但没有成功。 我试过了,但没用Html 如何将卡与引导4垂直对齐? 塞尔卡奥拉里奥酒店 我在里塞尔卡的营地里编译了一个分类。 {{alert_message}} &时代; 类别: 古典音乐 Docenti 里塞卡: 塞尔卡,html,css,bootstrap-4,Html,Css,Bootstrap 4,我尝试使用Bootstrap 4垂直对齐一张卡,但我得到的是: 卡片没有居中。 我怎样才能解决这个问题?我在网上搜索了一个解决方案,但没有成功。 我试过了,但没用 提前感谢。正如您在共享的链接中所指出的,“如果您试图居中的图元的父图元没有定义的高度,则任何垂直居中解决方案都不起作用!” 您只需要将style='height:100vh'分配给带有类容器的div。。。如下图所示: 塞尔卡奥拉里奥酒店 我在里塞尔卡的营地里编译了一个分类。 {{alert_message}} &时代; 类别:
提前感谢。正如您在共享的链接中所指出的,“如果您试图居中的图元的父图元没有定义的高度,则任何垂直居中解决方案都不起作用!” 您只需要将
style='height:100vh'
分配给带有类容器的div。。。如下图所示:
塞尔卡奥拉里奥酒店
我在里塞尔卡的营地里编译了一个分类。
{{alert_message}}
&时代;
类别:
古典音乐
Docenti
里塞卡:
塞尔卡
“我试过了,但没用”如果你读了答案,实际上效果很好。如果容器没有定义的高度,则h-100不起作用。
<div class="container">
<div class="row align-items-center h-100">
<div class="col-6 mx-auto">
<div class="card bg-white mx-auto" id="maincard">
<div class="card-body">
<h3 class="card-title text-center">Cerca un orario</h3>
<h6 class="card-subtitle mb-2 text-muted text-center">Scegli la categoria e compila il campo di ricerca.</h6>
<hr>
<div class="alert alert-danger alert-dismissible fade show" role="alert" style="display: {{none if not show_alert else block}}">
{{alert_message}}
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<form method="post" action="">
<div class="form-group">
<label for="category">Categoria:</label>
<select class="form-control" id="category" name="type" onchange="modifyText()">
<option value="classes">Classi</option>
<option value="teachers">Docenti</option>
</select>
</div>
<div class="form-group">
<label for="user_input">Ricerca:</label>
<input type="text" class="form-control" name="user_input" placeholder="Es. 2DM" autofocus id="user_input" list="classes" autocomplete="off">
</div>
<br>
<div class="container">
<div class="row">
<div class="col text-center">
<button type="submit" class="btn btn-secondary" style="width: 120px;">Cerca</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>