Responsive Website — Making Websites Look Good on All Screen Sizes

responsive-websites-dindin-design

Hi everyone!

Today we are going to explore something essential in web development, especially for those of us who want our websites to look great across every kind of screen. That topic is responsiveness. Once we understand the basics of CSS layout, the next important step is learning how to ensure our design adapts beautifully across a wide range of screen sizes — from large desktop monitors to compact mobile phones.

Let us try something fun together. Open any website, then slowly reduce the width of your browser window. Do you notice how the layout adjusts? Perhaps a wide navigation bar becomes a small button, or a row of images stacks vertically. That kind of transformation is exactly what responsive design is all about. It is the practice of making sure that a website remains functional, user-friendly, and visually pleasing, no matter the device used to view it.

To make this happen, CSS gives us some powerful tools and techniques. Let us go through them one by one and see how they work in practice.

Media Queries

Media queries are one of the main features in CSS that help us adapt the design based on screen size. They allow us to apply specific styles only when certain conditions are met. These conditions usually relate to the width of the screen, often called breakpoints.

Here is a basic example:

@media (max-width: 600px) {
  .navbar {
    display: none;
  }
}

This rule hides the navigation bar when the screen is 600 pixels wide or smaller. We can create multiple breakpoints for different devices such as tablets, phones, and desktops. Media queries give us precise control over how our layout behaves on each device.

CSS Grid

If we need a structured layout with rows and columns, CSS Grid is a great solution. It provides complete control over two-dimensional layout design. Here is an example of how we can create two columns and three rows:

.container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 100px 200px 200px;
  gap: 30px;
}

We can even make certain elements span across multiple rows or columns. This is perfect for organizing headers, main content areas, sidebars, and footers in a clean and structured way. Grid is extremely powerful when we want precision in layout alignment.

Flexbox

When the layout goes in a single direction — either horizontal or vertical — Flexbox shines. It is easy to use and helps us build flexible designs that adjust automatically based on space.

Suppose we have a row of boxes and want them to share space equally. Here is how we can do it:

.container {
  display: flex;
}
.card {
  flex: 1;
}

This gives each card equal space. We can also change the proportions:

.card:first-child {
  flex: 2;
}
.card:nth-child(2) {
  flex: 0.5;
}

Flexbox is great for distributing space, aligning content, and adjusting to different screen sizes without too much code.

Bootstrap

Sometimes we want to move faster without writing all the CSS ourselves. That is where Bootstrap becomes useful. It is a powerful CSS framework that provides pre-designed classes for layout, typography, buttons, and more. Bootstrap is based on Flexbox and comes with built-in responsiveness.

For example, here is how we can define columns:

<div class="col-6"></div>
<div class="col-2"></div>
<div class="col-4"></div>

Bootstrap uses a 12-column system. So a col-6 takes half the width of the container. We can also use responsive classes like col-md-6 or col-lg-4 to define how things should appear on medium or large screens. This makes it easy to design layouts that work well everywhere.

Final Thoughts

So friends, those are the four main tools for creating responsive websites:

  • Media Queries

  • CSS Grid

  • Flexbox

  • Bootstrap

Each has its own strengths. In many cases, combining them gives the best result. Think of them as tools in a toolbox — use whichever fits the job.

In our upcoming lessons, we will take a closer look at each technique, beginning with media queries, so we can learn how to use them effectively.

While waiting, feel free to open the practice project called 8.2 Responsiveness in VS Code. Try resizing the browser window, adjusting layout styles, and applying different breakpoints. Play with media queries, flexbox rules, and even try a bit of grid.

Let us keep exploring and building amazing things together. See you in the next session!

Comments

Postingan Populer

Image

Hello everyone! In our last post about Grid Layouts , we explored how to create a basic grid structure in CSS. Now, let’s take that one step further. Today, we're diving into Grid Sizing — how to size columns and rows inside your grid layout. By the end of this post, you’ll know exactly when to use fixed units like px , flexible units like fr , and responsive functions like minmax() . We’ll even explore some cool developer tools and an interactive test. Ready? Let’s go! What is Grid Sizing? Grid Sizing refers to how we control the size of the rows and columns inside our CSS Grid layout. Depending on what kind of content you're building (e.g., dashboards, cards, galleries), you'll want your grid to behave differently. In CSS Grid, we use properties like: grid-template-rows grid-template-columns grid-auto-rows grid-auto-columns Let’s break these down together. 1. Fixed Sizes with px and rem You can define static sizes for rows and columns using pixels ...

Image

Rumah kayu merupakan pilihan yang populer bagi banyak orang. Rumah kayu memiliki banyak keunggulan, seperti nyaman, sehat, dan estetik. Namun, rumah kayu juga memiliki beberapa kekurangan, seperti mudah lapuk dan terbakar. Untuk mengatasi kekurangan tersebut, desain rumah kayu minimalis modern hadir sebagai solusi yang tepat. Desain rumah kayu minimalis modern menggabungkan gaya minimalis yang mengutamakan kesederhanaan dan fungsionalitas dengan gaya modern yang mengutamakan estetika dan teknologi. Keunggulan Desain Rumah Kayu Minimalis Modern Desain rumah kayu minimalis modern memiliki beberapa keunggulan, antara lain: Nyaman dan sejuk Kayu adalah bahan yang memiliki sifat isolasi yang baik, sehingga dapat menjaga suhu ruangan tetap sejuk. Hal ini sangat cocok untuk iklim tropis seperti di Indonesia. Selain itu, kayu juga dapat menyerap suara, sehingga dapat memberikan suasana yang tenang dan nyaman. Ramah lingkungan Kayu merupakan bahan yang dapat diperbarui, sehin...

Image

Superingan is a Blogger template designed with simplicity and functionality in mind, offering a clean and user-friendly platform for professional websites. This theme is perfect for various website types, including personal blogs, online magazines, news websites, and portfolios. Features: Responsive Design: Your website will look its best across all devices, from desktops and laptops to tablets and smartphones. Customizable Colors: Easily change the template's colors to match your branding or preferences. Custom Headers: Upload your own header image to add a personal touch to your website. Custom Menus: Create and manage your website's navigation menus with ease. Widget Areas: Add widgets to display additional content and features on your website's sidebar. Clean HTML & CSS Code: The template is built with clean and well-structured code, making it easy to learn and customize further. Superingan is an ideal choice for those seeking a professional website with a sim...