我试图提高我的引导技能,我已经完成了xtra小而不知道如何根据这张照片做大中型,有人可以帮助这个人会欣赏,还应该有白色根据图片在盒子之间的空间,如何用margin / padding做到这一点?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
<style>
</style>
</head>
<body>
<div class="row">
<div class="col-xs-12 col-sm-6 col-lg-6 mg " style="background-color:red; height:200px;"></div>
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-6 mg" style="background-color:blue; height:200px;"></div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-6 mg" style="background-color:yellow; height:200px;"> </div>
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-6 mg " style="background-color:burlywood; height:200px;"></div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-6 mg" style="background-color:black; height:200px;"></div>
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-6 mg" style="background-color:orange; height:200px;"></div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-6 mg " style="background-color:burlywood; height:200px;"></div>
</div>
</body>
</html>
&#13;
答案 0 :(得分:1)
您需要将offset-lg-3
和offset-md-4
类用于抵消div。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
<style>
</style>
</head>
<body>
<div class="row">
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-3 offset-lg-3" style="background-color:red; height:200px;"></div>
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-3" style="background-color:blue; height:200px;"></div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-6" style="background-color:yellow; height:200px;"> </div>
<div class="col-xs-12 col-sm-6 col-md-4 offset-md-4 col-lg-3 offset-lg-3" style="background-color:burlywood; height:200px;"></div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-6 col-md-4 offset-md-4 col-lg-3 offset-lg-0" style="background-color:black; height:200px;"></div>
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-3 offset-lg-6" style="background-color:orange; height:200px;"></div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-6" style="background-color:burlywood; height:200px;"></div>
</div>
</body>
</html>