Websites often display content in multiple columns (like a magazine or a newspaper).
See the Pen
HTML – Layout Elements and Techniques by Iampsp.com (@iampsp)
on CodePen.
HTML Layout Elements
HTML has several semantic elements that define the different parts of a web page:
HTML Layout Techniques
There are four different techniques to create multicolumn layouts. Each technique has its pros and cons:
- CSS framework
- CSS float property
- CSS flexbox
- CSS grid
CSS Frameworks
If you want to create your layout fast, you can use a CSS framework, like Bootstrap.
CSS Float Layout
It is common to do entire web layouts using the CSS
property. Float is easy to learn – you just need to remember how the
floatfloat
and
properties work. Disadvantages: Floating elements are tied to the document flow, which may harm the flexibility. Learn more about float in our CSS Float and Clear chapter.
clear
See the Pen
CSS Template by Iampsp.com (@iampsp)
on CodePen.
CSS Flexbox Layout
Use of flexbox ensures that elements behave predictably when the page layout must accommodate different screen sizes and different display devices.
See the Pen
CSS Flexbox Layout by Iampsp.com (@iampsp)
on CodePen.
CSS Grid Layout
The CSS Grid Layout Module offers a grid-based layout system, with rows and columns, making it easier to design web pages without having to use floats and positioning.