【发布时间】:2019-11-23 05:27:14
【问题描述】:
尽管我阅读了如此多的在线资源,但我仍在努力完全理解 css/html 盒子模型。特别是我正在尝试创建一些比例为 3*2 的部分,其中 3 是宽度,2 是高度。
我尝试使用 scss 变量是徒劳的:
.boxProject{
width: 90%;
height: calc((width/3) *2);
background: purple;
box-shadow: 0 4px 30px rgba(0,0,0,.5);
border-radius: 6px;
}
另外,Bootstrap 网格对我来说毫无意义,因为如果我插入 h-100 类,那么网格会溢出它的 div 容器,我还没有找到一种方法来使 div '可调整大小'特别是在较小的屏幕上,内容显示在另一个下方,导致宽度窄但高度长。
.projectSection{
width: 100%;
height: 100%;
}
#section4 h1 {
margin:auto;
background-image: linear-gradient(to right, #62daf5, #59c8f4, #52aef9, #4586f7);
-webkit-text-fill-color: transparent;
-webkit-background-clip: text;
font-family: 'Rubik', sans-serif;
font-weight: bold;
}
.boxProject{
width: 90%;
height: calc((width/3) *2);
background: purple;
box-shadow: 0 4px 30px rgba(0,0,0,.5);
border-radius: 6px;
}
#section4{
background-color: black;
width: 100%;
height:100%;
}
<div class="container-fluid" id="section4">
<div class="row mt-5">
<div class="col-12">
<h1> My Projects. </h1>
</div>
</div>
<div class="row h-75 w-100 mt-4">
<div class="col-6 col-md-6 col-lg-4 col-xl-4">
<div class="boxProject"> </div>
</div>
<div class="col-6 col-md-6 col-lg-4 col-xl-4">
<div class="boxProject"> </div>
</div>
<div class="col-6 col-md-6 col-lg-4 col-xl-4">
<div class="boxProject"> </div>
</div>
<div class="col-6 col-md-6 col-lg-4 col-xl-4">
<div class="boxProject"> </div>
</div>
<div class="col-6 col-md-6 col-lg-4 col-xl-4">
<div class="boxProject"> </div>
</div>
<div class="col-6 col-md-6 col-lg-4 col-xl-4">
<div class="boxProject"> </div>
</div>
</div>
</div>
【问题讨论】:
标签: html css twitter-bootstrap sass