问题
Instead of using a responsive table i managed to get 3 colums with bootstrap to display data, and with cells that got the same height, i tried to make it responsive, so the cells stay on the same line..i am not sure if my way using @media is clever and it seems not to work when its resized to super narrow. thanks
<!DOCTYPE html>
<html lang="en" class="no-js">
<head>
<link rel="stylesheet" href="css/bootstrap.min.css">
<style type="text/css">
@media (max-width: 3500px) {
.minh {
min-height: 250px;
background-color: blue;
}
}
@media (max-width: 1200px) {
.minh {
min-height: 320px;
background-color: red;
}
}
@media (max-width: 990px) {
.minh {
min-height: 500px;
background-color: blue;
}
}
@@media (max-width: 400px) {
.minh {
min-height: auto;
background-color: red;
}
}
</style>
</head>
<body>
<div class="container">
<!-- first item-->
<div class="col-md-4 col-sm-4 text-center">
<div class="overflow-hidden"><img src="http://placehold.it/350x150" alt=""></div>
<div class="text-center minh">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised </div>
<div class="text-center"><br>www.url.de</div>
</div>
<!-- second item-->
<div class="col-md-4 col-sm-4 text-center">
<div class="overflow-hidden"><img src="http://placehold.it/350x150" alt=""></div>
<div class="text-center minh">It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).</div>
<div class="text-center"><br>www.url.de</div>
</div>
<!-- third item-->
<div class="col-md-4 col-sm-4 text-center">
<div class="overflow-hidden"><img src="http://placehold.it/350x150" alt=""></div>
<div class="text-center minh">he standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested.</div>
<div class="text-center"><br>www.url.de</div>
</div>
</div>
</body>
</html>
回答1:
if you want to keep the three columns always in horizontal line, you should use:
<div class="col-xs-4 text-center">
The code
<div class="col-md-4 col-sm-4 text-center">
has not sense because when the screen md becomes sm, the column has size=4 again: no changes.
Also the images can be responsive with the class thumbnail:
<div class="thumbnail">
<img src="http://placehold.it/350x150" alt=""></div>
<div>
I made an example in jsfiddle: http://jsfiddle.net/linkita/bdvo05cg/
来源:https://stackoverflow.com/questions/34513608/instead-of-tables-i-managed-to-get-a-responsive-table-with-divs-and-bootstrap-bu