masonry

纯CSS实现瀑布流布局

大憨熊 提交于 2019-12-02 15:06:57
瀑布流布局有一个专业的英文名称Masonry Layouts。瀑布流布局已经有好多年的历史了,我最早知道这个名词的时候大约是在2012年,当时Pinterest网站的布局就是使用的这种流式布局,简言之像Pinterest网站这样的布局就称之为瀑布流布局,也有人称之为Pinterest 布局。 瀑布流布局其核心是基于一个网格的布局,而且每行包含的项目列表高度是随机的(随着自己内容动态变化高度),同时每个项目列表呈堆栈形式排列,最为关键的是,堆栈之间彼此之间没有多余的间距差存大。还是上张图来看看我们说的瀑布流布局是什么样子。 当初要实现这样的布局都是依赖于JavaScript来实现,所以当时出现过很多实现瀑布流布局的插件。比如Masonry、Isotope等都是非常有名的插件。但使用纯CSS来实现,当时还是非常困难的,不管是使用float还是inline-block布局都无法很好的控制列表项目堆栈之间的间距。最终得到的效果就像下面这样:著作权归作者所有。 现在距离2012年已经过去了五个年头,CSS的技术更新也是日新月异,在这几年当中出现了很多新的布局方法,比如多列布局multi-columns、Flexbox布局以及今年浏览器支持有Grid布局。早前在《CSS布局的未来》一文中有对这些布局做过阐述。既然CSS的布局有这么多的变化,那么今天有没有不借助任何JavaScript

Bootstrap grid not displaying correctly

喜夏-厌秋 提交于 2019-12-02 09:01:25
how can I display correctly my grid without huge space, and look good? my photo My code: <div class="first"> <div class="container"> <div class="row"> <div class="col-md-6"> <img src="http://img.uefa.com/MultimediaFiles/Photo/competitions/General/02/35/49/87/2354987_w2.jpg" class="img-responsive"/> </div> <div class="col-md-3"> <img src="http://img.uefa.com/MultimediaFiles/Photo/competitions/Comp_Matches/01/83/81/26/1838126_s2.jpg" class="img-responsive"/> </div> <div class="col-md-3"> <img src="http://img.uefa.com/MultimediaFiles/Photo/competitions/Comp_Matches/02/36/89/27/2368927_s2.jpg"

iOS-Masonry布局UIScrollView

喜夏-厌秋 提交于 2019-11-30 10:06:38
前言 IOS自动布局有sb、xib自适应或者是纯代码编写frame布局,前者本人不太喜欢,后者计算太多也是比较繁琐,masonry这个第三方库,其实是封装了autolayout的约束,易于我们使用纯代码编写自适应布局。 (一)下面的这个例子是一个绑定手机号成功的页面布局; #import "BindSuccessViewController.h" #import <Masonry.h> #define SCREEN_WIDTH CGRectGetWidth([UIScreen mainScreen].bounds) @interface BindSuccessViewController () { UIImageView *imageView; UILabel *alertlabel; UIImageView *hfImageView; UIButton *sureButton; UIButton *cancelButton; UIScrollView *scrollView; UIView *layoutView; } @end @implementation BindSuccessViewController - (void)viewDidLoad { [super viewDidLoad]; self.navigationItem.title = @"修改手机号"; self

读懂正则表达式就这么简单

浪子不回头ぞ 提交于 2019-11-29 19:24:59
一 前言   前段时间一直在了解关于Http相关的知识,然后园子里时不时有园友发关于采集网页信息的文章,然后自己也想试试如何做网页的数据采集,便开始在网找查找相关资料, 方法有很多种,如 用开源的框架忘了叫什么名了,或者用.net Framework自带的HttpwebRequest对象与HttpwebResponse对象,当然也还有其它对象也可以做到如 WebClient 等,而我选择用HttpwebRequest 与HttpWebResponse来处理。   经过几个晚上的不断折腾终于把这东西折腾出来了,我的定位就只是用来练手所以不免会有BUG,这个小工具有两个BUG 一个在无限滚动这里,都以经按插件的参数配置了,可它就是不听使唤,老是会自动触发加载事件,不得以我来个限定最多只加载10页的数据。如果有熟悉这个插件的朋友,下载源码后帮忙修改下,我拿它真没折了.......先谢过了~~ 第二个BUG 在构造Http请求时有时正常,有时却出现请求超时 比如我在家里测试时,都可以正常运行,而同样的代码放到公司时却出现请求超时 ,这个问题真心不知道是什么原因引起的, 这是我写的第二个小工具 第一个在这里 文件夹管理工具(MVC+zTree+layer)(附源码) 本项目地址在这里 采集博客园文章工具 文章还涉及到正则表达示,我总结了一篇相关的文章 在这里  读懂正则表达式就这么简单 二

Bootstrap grid with collapsed container in between

守給你的承諾、 提交于 2019-11-28 04:50:48
问题 It's my very first question here and i hope you can help me. I'm trying to set up a product-overview page with the bootstrap grid. I have got 4 products in a row for large screen sizes. For smaller screen sizes i'd like to have 2 products per row. The trick is, i want to have the product details in a collapsed container between the rows, that opens up, when i click on a product. It's working for the large screen sizes with 4 products. But how to achieve that the collapsed container is showing

Horizontal masonry layout with flexbox CSS only [duplicate]

最后都变了- 提交于 2019-11-27 11:56:24
This question already has an answer here: Set flexbox children to have different heights to use up available space 1 answer I'm trying to create a horizontal masonry layout using only CSS and flexbox. The problem I'm having is there are vertical gaps between the elements, without using align-left: stretch; is it possible to close the gaps? .card-container { display: flex; flex-direction: row; flex-wrap: wrap; align-items: flex-start; } .card { width: 25%; flex: 1 0 auto; } full codepen here Here is one option using wrapped columns, but it requires a fixed height. .card-container { display:

How to create the masonry effects with just bootstrap 3 grid system and css

好久不见. 提交于 2019-11-27 04:41:45
My issue is that i want to display data in a block format using the bootstrap 3 grid system however i dont want the annoying whitespace gaps that happen from the height being constrained to the above row. For example, If i do: <div class="row"> <div class="col-lg-4">post</div> <div class="col-lg-4">longer post that is going to take more height than the others</div> <div class="col-lg-4">post</div> </div> <div class="row"> <div class="col-lg-4">post</div> <div class="col-lg-4">post</div> <div class="col-lg-4">post</div> </div> then i will be left with whitespace between the two rows, what i am

Horizontal masonry layout with flexbox CSS only [duplicate]

那年仲夏 提交于 2019-11-26 15:48:29
问题 This question already has an answer here: Set flexbox children to have different heights to use up available space 1 answer I'm trying to create a horizontal masonry layout using only CSS and flexbox. The problem I'm having is there are vertical gaps between the elements, without using align-left: stretch; is it possible to close the gaps? .card-container { display: flex; flex-direction: row; flex-wrap: wrap; align-items: flex-start; } .card { width: 25%; flex: 1 0 auto; } full codepen here

How to create the masonry effects with just bootstrap 3 grid system and css

烈酒焚心 提交于 2019-11-26 09:50:28
问题 My issue is that i want to display data in a block format using the bootstrap 3 grid system however i dont want the annoying whitespace gaps that happen from the height being constrained to the above row. For example, If i do: <div class=\"row\"> <div class=\"col-lg-4\">post</div> <div class=\"col-lg-4\">longer post that is going to take more height than the others</div> <div class=\"col-lg-4\">post</div> </div> <div class=\"row\"> <div class=\"col-lg-4\">post</div> <div class=\"col-lg-4\"