The Basics Of Responsive Web Design 2022

HRブログ
3 min readApr 14, 2022
Photo by Jackson So on Unsplash

If you’re new to the world of Software engineering then you’ll be interested in terms such as media queries: fluid layouts, flexbox layouts, responsive images, HTML, and CSS which makes your website adapt independently.

In this article, we’ll be covering the basics components of Responsive web design, with some links to further information when necessary.

What Is Responsive Web Design?

Responsive Web design is the approach that suggests that design and development should reply to the user’s behavior and environment based on screen size, platform, and orientation.

The essential elements of responsive web design…

Media Queries

Media Queries are fundamentally a part of CSS3 that allows you to render content to adapt to various factors like screen size or resolution. With a media query, you’ll be able to use the identical content blocks in multiple layouts optimized for the device’s size or features. Various factors such as resolution, browser, and orientation are considered a part of a media query.

Syntax:

@media media-type and (media-feature-rule) {/* CSS rules go here */}

Fluid Layouts

Fluid Layouts are a vital part of responsive web design which is predicated on the size and resolution of the screen. The liquid layout was created for this which relies on dynamic values like the percentage of the viewport width. This approach will dynamically increase or decrease the different container element sizes supported by the dimensions of the screen. This works well in all major browsers when the width of container elements is fixed.

.container { width: 100%;}

Flexbox Layouts

Flexbox is intended to redefine how we do layouts in CSS as a more efficient way to layout multiple elements, even when the scale of the contents inside the container is unknown. A flex container expands items to fill available free space or shrinks them to prevent overflow. These flex containers have a variety of unique properties, like justify-content, that you simply can’t edit with an everyday HTML element.

.container {justify-content: flex-start | flex-end | center | space-between | space-around |}

Responsive Images

Responsive images follow the identical concept as a fluid layout, using a dynamic unit to manage the width or height. The most basic iteration of responsive images will automatically adjust to fit the dimensions of the screen.

In this example, the subsequent CSS is applied to the image so it’ll scale both up and down on responsiveness…

.responsive {width: 100%;height: auto;}

In this example, the subsequent CSS is applied to the image so it will scale down if it has to, but never scale up to be larger than its original size, use…

.responsive {max-width: 100%;height: auto;}

In this example, the subsequent CSS is applied to the image so it’ll restrict a responsive image to a maximum size, use the max-width property, with a pixel value of your choice:

.responsive {width: 100%;max-width: 400px;height: auto;}

CSS & HTML

The fundamentals of responsive design come right down to two things which are HTML and CSS. These are two languages that control the content and layout of a page in any given browser. HTML mainly controls the structure, elements, and content of a webpage. For example, to feature an in-line CSS, you’ve got to use HTML code like this:

<!DOCTYPE html>
<html>
<head>
<style>
body {background-color: powderblue;}
h1 {color: blue;}
p {color: red;}
</style>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>

The Future Of Responsive Web Design

The future of responsive web design, or perhaps simply web design, is one within which designs aren’t just screen agnostic, but screen independent. In practical terms, it means dropping mobile-first and adopting an audio-first approach. If your sites are optimized for screen readers, then they’re going to function effectively on the following next-generation web browser.

--

--

HRブログ

Talks about #realworld, #finance , #economics, #crypto and #technology.