Two ways to adapt float height to multiple divs in CSS

高洛峰
Release: 2017-03-27 17:29:53
Original
2286 people have browsed it

css Multiple div floats are arranged side by side, and the heights are all adaptive (auto-increasing)

When using Div + CSS for three-column or two-column layout, the height of the two columns (or three columns) must be the same. It is easy to implement using Table, but it is more troublesome to use Div + CSS. According to the general practice, most of them use background image filling or JS script to make the height the same.

Two ways to adapt float height to multiple divs in CSS

Method 1: Pure CSS solution (method combining "hidden container overflow" and "positive inner patch" and "negative outer patch"):


Copy after login

Method 2: js solution (idea, this method is not recommended):

Copy after login

The above is the detailed content of Two ways to adapt float height to multiple divs in CSS. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!