【发布时间】:2019-01-21 17:29:53
【问题描述】:
我有这段代码,它连续显示 4 个项目。我已经给出了列边框,让您了解每列的大小。 在每一列内都有一个固定宽度和高度的包装器,用于显示图像和文本。现在是否可以减少大型设备的列之间的间隙? https://jsfiddle.net/3j6x1fou/
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<title>Hello, world!</title>
<style type="text/css">
.green {
border: 1px solid green;
}
.blue {
border: 1px solid blue;
}
.orange{
border: 1px solid orange;
}
.yellow {
border: 1px solid yellow;
}
.size {
}
.wrapper {
width: 180px;
height: 200px;
}
.inherit {
width: inherit;
height: inherit;
}
</style>
</head>
<body>
<div class="row">
<div class="col-sm-4 col-md-3 mt-5 mt-md-0 green">
<div class="wrapper" style="margin: 0 auto;">
<img class="img-fluid inherit" src="https://i.redd.it/dkcm8of8x9b01.jpg">
<div>Xtres Watch R007</div>
</div>
</div>
<div class="col-sm-4 col-md-3 mt-5 mt-md-0 blue">
<div class="wrapper" style="margin: 0 auto;">
<img class="img-fluid inherit" src="https://i.redd.it/dkcm8of8x9b01.jpg">
<div>Xtres Watch R007</div>
</div>
</div>
<div class="col-sm-4 col-md-3 mt-5 mt-md-0 orange">
<div class="wrapper" style="margin: 0 auto;">
<img class="img-fluid inherit" src="https://i.redd.it/dkcm8of8x9b01.jpg">
<div>Xtres Watch R007</div>
</div>
</div>
<div class="col-sm-4 col-md-3 mt-5 mt-md-0 yellow">
<div class="wrapper" style="margin: 0 auto;">
<img class="img-fluid inherit" src="https://i.redd.it/dkcm8of8x9b01.jpg">
<div>Xtres Watch R007</div>
</div>
</div>
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
</body>
</html>
【问题讨论】:
标签: css bootstrap-4