Html 如何使用display:flex实现正确且响应迅速的图像网格视图
我对如何获得这样的响应性图像网格的Html 如何使用display:flex实现正确且响应迅速的图像网格视图,html,css,grid,css-float,flexbox,Html,Css,Grid,Css Float,Flexbox,我对如何获得这样的响应性图像网格的display:flex感到非常困惑 提前谢谢。我试过很多答案,但都不起作用 现在我有这样的布局 但我希望我的布局像这样。。。 Html代码: <div class="makeExploreCenter"> <div class="explorePost"> <img src="skyline-buildings-new-york-skyscrapers.jpg" /> <di
display:flex
感到非常困惑
提前谢谢。我试过很多答案,但都不起作用
现在我有这样的布局
但我希望我的布局像这样。。。
Html代码:
<div class="makeExploreCenter">
<div class="explorePost">
<img src="skyline-buildings-new-york-skyscrapers.jpg" />
<div class="likesdetails">
<div class="propicthumnail">
</div>
</div>
</div>
<div class="explorePost">
<img src="url.jpg" />
<div class="likesdetails">
<div class="propicthumnail">
</div>
</div>
</div>
<div class="explorePost">
<img src="ymbpp1l.jpg" />
<div class="likesdetails">
<div class="propicthumnail">
</div>
</div>
</div>
<div class="explorePost">
<img src="skyline-buildings-new-york-skyscrapers.jpg" />
<div class="likesdetails">
<div class="propicthumnail">
</div>
</div>
</div>
<div class="explorePost">
<img src="url.jpg" />
<div class="likesdetails">
<div class="propicthumnail">
</div>
</div>
</div>
<div class="explorePost">
<img src="ymbpp1l.jpg" />
<div class="likesdetails">
<div class="propicthumnail">
</div>
</div>
</div>
</div>
使用像bootstrap这样的框架将使生活更轻松
引导网格系统可以很容易地实现这一点。您可以使用
flex diretion:column
属性来实现这一效果。请参见以下示例:
.grid{
显示器:flex;
弯曲方向:立柱;
柔性包装:包装;
宽度:400px;
高度:400px;
列表样式:无;
}
img{
宽度:100px;
高度:自动;
显示:块;
}
您可以使用浮点值进行操作
示例:
---- first div ---- ---- second div --- -------AND-----
4G3Y5B6GBY3G7W10P-- ----5G5W5E6B10P10W- ----SO---------
Picture------------ ----Picture-------- -------ON------
------------------- ------------------- --MORE PICTURES
The text related to Content related to- --MORE TEXT----
this--------------- this--------------- ----MORE SPACE-
----Another picture ----Another picture ---Another-----
3B6G6B7GYB3G7W10P-- ----6B7B8B7WBG10YP- ---content-----
Picture------------ ---Picture--------- Modern content-
------------------- ------------------- ---------------
The text related to Related to picture- ---------------
the another picture above-------------- Whatever-------
-- end first div -- -- end second div-- ---------------
真实示例:
CSS:
HTML:
将文本添加到图片编号1.0
将文本添加到图片编号1.1
将文本添加到图片编号2.0
将文本添加到图片编号2.1
将文本添加到图片编号3.1
将文本添加到图片编号3.1
No@NingJi我想学这些东西……不工作!!!它给我总的网格对齐vartically@Nane您使用的浏览器是什么?Flex box由Chrome从版本29(2013)开始支持。您可以发布任何示例吗?很好,您有@Nane
---- first div ---- ---- second div --- -------AND-----
4G3Y5B6GBY3G7W10P-- ----5G5W5E6B10P10W- ----SO---------
Picture------------ ----Picture-------- -------ON------
------------------- ------------------- --MORE PICTURES
The text related to Content related to- --MORE TEXT----
this--------------- this--------------- ----MORE SPACE-
----Another picture ----Another picture ---Another-----
3B6G6B7GYB3G7W10P-- ----6B7B8B7WBG10YP- ---content-----
Picture------------ ---Picture--------- Modern content-
------------------- ------------------- ---------------
The text related to Related to picture- ---------------
the another picture above-------------- Whatever-------
-- end first div -- -- end second div-- ---------------
.grid0, .grid1{float:left;margin-right:30px;}
<div class='maingrid'>
<div class='grid0'>
<img src='http://lorempixel.com/100/140/' style='width:100px; height:100px;' /><br>
The text to the picture number 1.0<br>
<img src='http://lorempixel.com/100/140/' style='width:100px;height:100px;' /><br>
The text to the picture number 1.1
</div>
<div class='grid1'>
<img src='http://lorempixel.com/100/150/' style='width:100px;height:100px;' /><br>
The text to the picture number 2.0<br>
<img src='http://lorempixel.com/100/140/' style='width:100px;height:100px;' /><br>
The text to the picture number 2.1
</div>
<div class='grid2'>
<img src='http://lorempixel.com/100/125/' style='width:100px;height:100px;' /><br>
The text to the picture number 3.1<br>
<img src='http://lorempixel.com/100/140/' style='width:100px;height:100px;' /><br>
The text to the picture number 3.1
</div>
</div>