Table of Contents
Creating Layouts in CSS - This article is part of a series.
CSS Layouts are an essential part of modern web design that plays a critical role in creating visually appealing and functional web pages. You can think of a layout as a blueprint for your website, which defines the structure and appearance of your web pages. It defines where your navigation bar should be placed, how your content should be organized, if you have a sidebar, and so on.
To create an effective layout, you need to have a strong understanding of CSS layout techniques and how to apply them to your designs. So if you are a complete beginner in CSS, feel free to check the previous lessons in this web developer course!
Techniques for creating CSS layouts #
CSS has evolved over the years, and there are now many different techniques for creating layouts in CSS. In this section, we will introduce you to some of the most popular techniques for creating layouts in CSS.
- Many years ago, people would use html tables to create layouts in CSS. They would create a table with a single row and a single column, and then they would place all the content inside that table. This technique was very popular in the early days of the web because it was easy to use and it worked well with older browsers (desktop browsers). If you ever see a website that looks very old and “boxy”, chances are that it was created using this technique.
- Another popular technique for creating layouts in CSS is floats. This technique involves floating elements to the left or right of their parent element. This technique is still used today, but it has some limitations. For example, it doesn’t work well with responsive designs, and it can be difficult to maintain. We will talk more about this technique in the next lesson.
- The third technique for creating layouts in CSS is flexbox. This technique was introduced with CSS3 (in 2011), and it is now widely used by web developers. It allows you to create flexible layouts that adapt to different screen sizes and devices by stretching and shrinking elements as needed. We will talk more about this soon.
- The newest technique for creating layouts in CSS is CSS Grid. This technique was introduced to CSS3 (in 2017), and it is now widely used by web developers. It allows you to create flexible layouts that adapt to different screen sizes and devices by stretching and shrinking elements as needed but is more powerful than flexbox. We will talk more about this soon.
We will omit the first technique (html tables) because it is outdated and not used anymore. So let’s start with the basics and learn how to create layouts in CSS using floats.