HTML LAYOUTS

a couple of years ago

A web page layout is crucial to give a better look and feel to your website. In this tutorial, we will learn various tags which HTML5 provides to make look and feel of a website better.

HTML5 offers new semantic elements that define the different parts of a web page:

  • <header> – Defines a header for a document or a section
  • <nav> – Defines a container for navigation links
  • <section> – Defines a section in a document
  • <article> – Defines an independent self-contained article
  • <aside> – Defines content aside from the content (like a sidebar)
  • <footer> – Defines a footer for a document or a section
  • <details> – Defines additional details
  • <summary> – Defines a heading for the <details> element

layout

We will discuss three techniques to create layouts.

  1. HTML tables
  2. CSS float property
  3. CSS framework

1. HTML tables:

The simplest and most popular way of creating layouts is using HTML <table> tag. These tables are arranged in columns and rows, so you can utilise these rows and columns in whatever way you like.

For example, the following HTML layout example is achieved using a table with 3 rows and 2 columns but the header and footer column spans both columns using the colspan attribute:

using tables for layout

Similarly, you can create a layout of your choice.

NOTE:The <table> element although commonly used is not designed to be a layout tool. So, do not use tables for your page layout! They will bring a mess into your code.

2. CSS Frameworks

If you want to create your layout fast, you can use a framework, like W3.CSS or Bootstrap.

3.CSS Floats

It is common to do entire web layouts using the CSS float property. In this we use the <div> and <span> tags.

We will make a code achieve same result using <div> tag along with CSS, as we got in the previous example using <table>.

Note: Floating elements are tied to the document flow, which may harm the flexibility.

PS: For any questions, queries, feedback and comments feel free to write us at support@qatechhub.com and amruta@qatechhub.com

Amruta Somani

About the Author

Amruta Somani

Leave a Comment: