我在项目中使用了这段代码。我希望卡片在其正常断点之前就被打破。我尝试在窗口大小为700px时打破卡片。但是它仍然一样,该怎么做?谁能帮我?
在此先感谢您的帮助:)
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.2/css/bootstrap.min.css" integrity="sha384-y3tfxAZXuh4HwSYylfB+J125MxIs6mR5FOHamPBG064zB+AFeWH94NdvaCBm8qnd" crossorigin="anonymous">
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" />
<link href="https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,500,500i,700,700i" rel="stylesheet">
<!--jQuery library-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<!--Latest compiled and minified JavaScript-->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<style type="text/css">
.card-body {
padding: 0 !important;
}
.card-content {
padding: 1.25rem;
}
</style>
</head>
<body>
<div class="row my-4">
<div class="col">
<div class="container-fluid">
<div class="row">
<div class="col-sm d-flex">
<div class="card card-body flex-fill">
<div class="card-header"><center>Education</center></div>
<div class="card-content">
<h5 class="card-title">● hello hello hello hello hello 2019</h5>
<p class="card-text"><br>blah blah blah blah blah blah blah</p>
<h5 class="card-title"> ●hello hello hello hello helooo</h5>
<p class="card-text">something...................................................</p>
<h5 class="card-title"> ● hello hello hello hello hello</h5>
<p class="card-text">sometthing here........................</p>
</div>
</div>
</div>
<div class="col-sm d-flex">
<div class="card card-body flex-fill">
<div class="card-header"><center>Traings & Online Courses</center></div>
<div class="card-content">
<h5 class="card-title">TRAINING</h5>
<p class="card-text">● .........................................................<br> ● ..............................................</p>
<h5 class="card-title">ONLINE COURSE 2015</h5>
<p class="card-text">● blah blah blah blah..... <br>
●blah blah blah blah blah.</p>
<h5 class="card-title">ONLINE COURSE 2015</h5>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
最佳答案
看看这个
.card-body {
padding: 0 !important;
}
.card-content {
padding: 1.25rem;
}
@media only screen and (max-width: 992px) {
#edu1 .card {width:700px;height:700px;background:red;}
}
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.2/css/bootstrap.min.css" integrity="sha384-y3tfxAZXuh4HwSYylfB+J125MxIs6mR5FOHamPBG064zB+AFeWH94NdvaCBm8qnd" crossorigin="anonymous">
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" />
<link href="https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,500,500i,700,700i" rel="stylesheet">
<!--jQuery library-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<!--Latest compiled and minified JavaScript-->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<style type="text/css">
.card-body {
padding: 0 !important;
}
.card-content {
padding: 1.25rem;
}
</style>
</head>
<body>
<div class="row my-4">
<div class="col">
<div class="container-fluid">
<div class="row">
<div class="col-sm d-flex " id="edu1">
<div class="card card-body flex-fill">
<div class="card-header"><center>Education</center></div>
<div class="card-content">
<h5 class="card-title">● hello hello hello hello hello 2019</h5>
<p class="card-text"><br>blah blah blah blah blah blah blah</p>
<h5 class="card-title"> ●hello hello hello hello helooo</h5>
<p class="card-text">something...................................................</p>
<h5 class="card-title"> ● hello hello hello hello hello</h5>
<p class="card-text">sometthing here........................</p>
</div>
</div>
</div>
<div class="col-sm d-flex" id="edu2">
<div class="card card-body flex-fill">
<div class="card-header"><center>Traings & Online Courses</center></div>
<div class="card-content">
<h5 class="card-title">TRAINING</h5>
<p class="card-text">● .........................................................<br> ● ..............................................</p>
<h5 class="card-title">ONLINE COURSE 2015</h5>
<p class="card-text">● blah blah blah blah..... <br>
●blah blah blah blah blah.</p>
<h5 class="card-title">ONLINE COURSE 2015</h5>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
关于html - 如何通过媒体查询尽早打破专栏?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/55361009/