CSS Website Layout

CSS Website Layout

Website layout means arranging parts of a webpage such as:

  • Header

  • Navigation bar

  • Main content

  • Sidebar

  • Footer

Modern CSS provides many layout methods:

  • Block layout

  • Flexbox

  • CSS Grid

  • Float layout (old)

  • Positioning layout

Below are the most important ones.


 1. Basic Block Layout

Every block element (like <div>, <section>) stacks vertically.


 


 2. Float Layout (Old Method)

✔ Old method for sidebars
✖ Now replaced by Flexbox/Grid


3. Flexbox Layout (Best for simple layouts)

HTML:


 

CSS:


 

 

✔ Easy 2-column or 3-column layouts
✔ Responsive
✔ Centering is easy


4. CSS Grid Layout (Best for complex layouts)

HTML:

CSS:


 

✔ Powerful
✔ Organised
✔ Great for whole page layout


5. Fixed Layout (Using position: fixed)

✔ Navbar stays on screen when scrolling


6. Responsive Layout (Using media queries)

✔ Stack items vertically on small screens


Full Example (Modern Flexbox Page Layout)


 


 Summary

Layout Method Best For
Block Simple stacking
Float Old 2-column layouts
Flexbox Modern, simple page layout
Grid Complex, full-page layout
Position Fixed or sticky items

CodeCapsule

Sanjit Sinha — Web Developer | PHP • Laravel • CodeIgniter • MySQL • Bootstrap Founder, CodeCapsule — Student projects & practical coding guides. Email: info@codecapsule.in • Website: CodeCapsule.in

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *