我正在制作我的网站,我正在使用带有图像的div,我希望保持图片的宽高比然后图片(当然)变得不那么高了。如何使div col_1调整到那个高度并且在宽度和高度上调整col_2? div行必须调整其高度以保持一切都关闭。
<div class=”row”>
<div class=”col_1”>
<img src=”some”>
</div>
<div class=”col_2”>
Text<br>
Text<br>
</div>
</div>
答案 0 :(得分:0)
我想你想要这样的东西:
Bootstrap用于以下代码段。
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<div class="col-md-6 text-center">
<img src="http://images.all-free-download.com/images/wallpapers_large/love_wallpaper_vector_3d_wallpaper_261.jpg">
</div>
<div class="col-md-6 text-center">
Text
<br>Text
<br>
</div>
</div>
</div>
</div>
答案 1 :(得分:0)
是否要将img的高度和宽度调整为父元素的高度和宽度?
如果是,请使用bootstrap class =&#34; img-responsive&#34;在你的img标签上。
<img src="someImage" class="img-responsive">
.img-responsive类将max-width:100%,height:auto和display:block应用于图像。
See more