前端样式代码块 原 发表于 2017-07-18 | 分类于 前端 , 代码块 | 浏览 次 瀑布流布局123456789101112131415161718192021222324252627282930313233343536373839404142434445464748.masonry { -webkit-column-count: 2; -moz-column-count: 2; column-count: 2; -webkit-column-gap: 0; -moz-column-gap: 0; column-gap: 0; counter-reset: item-counter; padding:10rpx;}.item { box-sizing: border-box; -webkit-column-break-inside: avoid; page-break-inside: avoid; break-inside: avoid; counter-increment: item-counter; padding:10rpx;}.item__content { position: relative; display: flex; -webkit-box-orient: vertical; -webkit-box-direction: normal; -ms-flex-direction: column; flex-direction: column; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; -webkit-box-align: center; -ms-flex-align: center; align-items: center; min-height: 100rpx; font-size: 24rpx; box-sizing: border-box; white-space: normal; word-break: break-all; padding:15rpx;}<view class="masonry "> <view class="item" wx:for="{{list}}" wx:key="id" wx:for-item="item"> <view class="item__content"> {{item.content}} </view> </view></view> 清除浮动1234567891011121314151617.clearfix:after { content: "."; display: block; clear: both; visibility: hidden; line-height: 0; height: 0;}.clearfix { display: inline-block;}html[xmlns] .clearfix { display: block;}* html .clearfix { height: 1%; } 1234.clearfix:before, .container:after { content: ""; display: table; }.clearfix:after { clear: both; }/* IE 6/7 */.clearfix { zoom: 1; } 样式重置12345678910111213141516171819202122html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video { margin: 0; padding: 0; border: 0; font-size: 100%; font: inherit; vertical-align: baseline; outline: none; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box;}html { height: 101%; }body { font-size: 62.5%; line-height: 1; font-family: Arial, Tahoma, sans-serif; }article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section { display: block; }ol, ul { list-style: none; }blockquote, q { quotes: none; }blockquote:before, blockquote:after, q:before, q:after { content: ''; content: none; }strong { font-weight: bold; }table { border-collapse: collapse; border-spacing: 0; }img { border: 0; max-width: 100%; }p { font-size: 1.2em; line-height: 1.0em; color: #333; }