高度百分比不适用于任何浏览器(使用引导程序) [英] Height in percentage is not working in any browser (using bootstrap)
本文介绍了高度百分比不适用于任何浏览器(使用引导程序)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
下面有我的代码.如何使用以%为单位的高度
Below I have my code. How to use the height in %
<div class="container" >
<div class="row">
<div class="col-" id="t1"></div>
</div>
</div>
Css
body{
background-color:aquamarine;
}
#t1{
height:100%;
border:1px solid brown;
}
当我使用height:100px;
时,它可以正常工作,但是当我使用height:100%;
时,则不起作用.
When I use height:100px;
It works fine but when I use height:100%;
It doesn't work.
如何使用引导程序为每个div给出身高的百分比?
How to give the height in percentage using bootstrap for each div?
推荐答案
您可以尝试添加类似style="min-height: 70vh;
"vh"代表视口高度.因此,"70vh"表示视口高度的70%.
"vh" stands for viewport height. So, "70vh" means 70% of the viewport height.
还有其他几种使用Bootstrap类控制高度的方法:
Here are a few other ways to control the height using Bootstrap classes:
https://getbootstrap.com/docs/4.0/utilities/sizing/
这篇关于高度百分比不适用于任何浏览器(使用引导程序)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文