我在网站上有一个联系部分,该部分应该包含列,因为该网站被分为12个,我使用了col-md-4,但在移动设备中,它只是一个放在另一个之上。
你好吗。
我正试图以这种方式离开它。
HTML
<section class="third-section">
<div class="container">
<div class="row">
<div class="col-md-4 d-flex justify-content-start">
<h4>Entre em contato com a gente:</h4>
</div>
<div class="col-md-4 phone">
<div class="d-flex align-items-center resd">
<p> 51 99999999</p>
</div>
<div class="d-flex align-items-center"><img src="img/iconwpp.png" alt="icone whatsapp">
<p>51 999999999</p>
</div>
<div class="d-flex align-items-center"><img src="img/iconwpp.png" alt="icone whatsapp">
<p>51 999999999</p>
</div>
</div>
<div class="col-md-4 address">
<p>Rua XXXXX</p>
<p>XXXXXXXX/RS</p>
<p>CEP xxxx-xxx</p>
</div>
</div>
</div>
CSS
.third-section{
margin-top: 10%;
margin-bottom: 5%;
padding-left: 35%;
padding-right: 30%;
.phone{
img{
margin-right: 3px;
margin-bottom: 20px;
height: 20px;
}
.resd{
margin-left: 23px;
}
}
h4{
font-size: 1.6em;
color: #77D3C2;
}
p{
font-size: 1.2em;
line-height: 1em;
color: #999999
}
}
答案 0 :(得分:0)
最简单的方法是通过在每个元素上添加.col-sm-4
来手动指定每个部分在较小的设备上占据四列。
但是请注意,由于在如此有限的空间中包含大量内容,因此这将导致示例中的水平重叠。为了解决这个问题,我将.third-section
的水平填充更改为3%
,但是您可能希望在实际布局中以不同的方式适应这种情况。
.third-section {
margin-top: 10%;
margin-bottom: 5%;
padding-left: 3%;
padding-right: 3%;
/*padding-left: 35%; */
/* padding-right: 30%; */
}
.third-section .phone img {
margin-right: 3px;
margin-bottom: 20px;
height: 20px;
}
.third-section .phone .resd {
margin-left: 23px;
}
.third-section h4 {
font-size: 1.6em;
color: #77D3C2;
}
.third-section p {
font-size: 1.2em;
line-height: 1em;
color: #999999;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<section class="third-section">
<div class="container">
<div class="row">
<div class="col-md-4 col-sm-4 d-flex justify-content-start">
<h4>Entre em contato com a gente:</h4>
</div>
<div class="col-md-4 col-sm-4 phone">
<div class="d-flex align-items-center resd">
<p> 51 99999999</p>
</div>
<div class="d-flex align-items-center"><img src="img/iconwpp.png" alt="icone whatsapp">
<p>51 999999999</p>
</div>
<div class="d-flex align-items-center"><img src="img/iconwpp.png" alt="icone whatsapp">
<p>51 999999999</p>
</div>
</div>
<div class="col-md-4 col-sm-4 address">
<p>Rua XXXXX</p>
<p>XXXXXXXX/RS</p>
<p>CEP xxxx-xxx</p>
</div>
</div>
</div>