HTMLs Tutorial

HTML Tutorial HTML Tags HTML Basic Tags HTML Attributes HTML Elements HTML Formatting HTML Text Format HTML body tag HTML samp tag HTML script Tag HTML section tag HTML select tag HTML source tag HTML span tag HTML strike tag HTML strong tag HTML style tag HTML sub tag HTML summary tag HTML sup Tag HTML svg tag HTML table tag HTML u tag HTML Headings HTML Paragraphs HTML wbr tag HTML Anchor HTML Image HTML Lists HTML Ordered List HTML Unordered List HTML Form HTML Form input HTML with CSS HTML Layouts HTML References HTML Frames HTML Links Fieldset Tag in HTML Basic HTML Tags Br Tag in HTML Free HTML Templates How to Create a Table in HTML HTML Calendar HTML Card HTML Cellspacing HTML Center Image HTML Checkbox Read-only HTML Cleaner HTML Code for a Tab HTML Comment HTML Compiler HTML Nested Forms HTML Overlay Text on the Image HTML Select Option Default HTML Snake Game HTML Subheader HTML Tab Character dd Tag in HTML How Many HTML Tags are There HTML Align Tag HTML Responsive HTML Tab Code HTML Table Alternate Row Color HTML Table Fix Column Width Contact HTML DL Tag in HTML How to Insert Image in HTML HTML Background Color HTML Dark Mode How to Convert HTML to PNG HTML Data Toggle HTML Email Template HTML Font Color HTML Font Family ID and Class in HTML HTML Tab Space HTML Tab Tag HTML Itemprop HTML Itemscope HTML Form Design HTML Input Only Numbers HTML Textarea HTML to JPG HTML to Markdown Python li Tag in HTML MDN HTML What is the Correct HTML for Making a Hyperlink? What is the Root Element of an HTML Document How to Make a Box in HTML How to Save HTML Files in Notepad How to Align Text in HTML How to Change Font Color in HTML? How to Change Font Size in HTML How to Change Image Size in HTML How to Create a HTML Page How to Create a Link in HTML File? How to Create an HTML File? HR Tag in HTML HTML Base Tag HTML Default Attribute HTML Hyperlink HTML Indent HTML Injection Payloads HTML Input Numbers Only HTML Roadmap HTML Row Height HTML Schedule HTML Space HTML Tab HTML vs HTTP HTML5 API HTML5 Video HTML Collection to Array Text Area in HTML

HTML5 Advance

HTML5 Tutorial HTML5 Tags HTML Button Tag HTML canvas Tag HTML caption Tag HTML City tag HTML Tag HTML5 SVG HTML Event Attribute HTML5 Audio HTML5 Youtube HTML5 Button Tag HTML5 Tags

Misc

How to add JavaScript to HTML How to change font in HTML How to change text color in HTML HTML Date HTML Hide Element HTML Nested Table HTML Reset Button What does HTML stand for? HTML Background Image HTML Tag Div Tag in HTML How to insert Image in HTML How to create a link with no underline in HTML How to insert spacestabs in text using HTMLCSS HTML tag HTML Code HTML Tag HTML Canvas Design a tribute page using HTML and CSS What is a Container tag Font tag in HTML Difference between HTML and DHTML Empty Tag in HTML HTML Button Link Html Line Break Img src HTML Nested List in HTML Placeholder in HTML TD in HTML HTML Space Code HTML Target Attribute HTML Tag Markup Meaning in HTML Border-Collapse in HTML HTML Onclick Online HTML Compiler Convert HTML to PDF HTML Formatter HTML5 - Web Storage HTTP – Responses Container Tag in HTML DL Tag in HTML Horizontal Rule HTML HTML Tab Text Html Table Cell Background Color HTML Table Cell Color HTML Col Width How Many HTML Tags are There Convert String to Unicode Characters in Python HTML Runner HTML Style Attribute HTML Superscript Attribute HTML tabindex Marquee Tag in HTML HTML Dynamic Form HTML side Tag HTML Pattern Attribute HTML q Tag HTML Readonly Base 64 Encoding in HTML Documents Enhancing Data Portability and Security Evo Cam Web Cam HTML Free code camp HTML CSS How to Add a JS File in HTML? How to Add Picture in HTML How to Add the Logo in HTML? How to Add Video in HTML HTML Class Attribute HTML Entities HTML Form Elements HTML Form Templates HTML Marquee Tag HTML Radio Buttons HTML Text box HTML to JSX HTML Tooltip Basic HTML Codes How to Align Image Center in HTML HTML Header Tag HTML Image Tag HTML Next Line

HTML Responsive

Overview of HTML responsive design 

The idea behind responsive design in HTML is to adapt an HTML element to the size of the device for each screen size. These components should appear flawlessly on every tablet, laptop, or mobile device. An element that swiftly adjusts to the available space in the display view is known as responsive design. It is dependent on several aspects, including responsive images, text size, and viewport width. To perfectly match designs with various browsers and devices, responsive design incorporates a lot of innovative approaches these days. One of the finest features of flexible design using CSS is the use of media queries, which instruct the browser to change the size of the user's device.

Precursor of mobile web design, which is responsive design 

Before responsive web design evolved as the industry standard for building websites that functioned on a types of devices, web developers occasionally referred to mobile web development, mobile web design, or even mobile-friendly design. These are essentially identical to responsive web design; the objective is to ensure that websites function properly in terms of layout, content (text and media), and performance on devices with varying physical characteristics (screen size, resolution). 

The primary differences are associated with the devices in question and the technologies that may be utilized to deliver solutions: 

  1. While there are now many other kinds of devices accessible, including desktops, laptops, mobile phones, tablets, watches, etc., we used to discuss desktop computers or mobile phones. 
  2. These days, we have to build websites defensively to support typical screen sizes and resolutions together with unknowns, rather than just a few distinct screen sizes.
  3. In the past, mobile devices had minimal CPU/GPU and bandwidth capacities. Because some didn't support HTML or CSS at all, it was normal practice to utilize server-side browser sniffing to determine the sort of device or browser before delivering a website that the device could handle. Because that was all they could manage, mobile devices frequently had really basic, simplistic experiences provided to them. Such methods are becoming less frequent because mobile devices can already handle the same technology as desktop PCs.
  4. To develop responsive experiences, current technologies are far superior. For example, relevant media may now be supplied to different devices without the requirement for methods like server-side sniffing thanks to responsive image and media technologies.

HTML syntax design that responds 

Several aspects affect responsive design in HTML; let's examine each one individually: 

Setting Viewport: To assist the browser regulate the size and scale of the web page, the viewport may be set to the user page view using the syntax below. It will automatically modify components to fit various device sizes and adapt the display screen to the device.

<meta name="viewport" content="width=device-width, initial-scale=1.0">

Responsive images: When we upload photos to our website, we also need to make sure that they fit the screen size of every device correctly.

<div class='Description'> <img class='example' src='URL of image' /></div>

Set width property: We may make an element responsive on the screen display view by using CSS to set the width to 100%.

width: 100%;

Using the Max Width Property: This will let us show all of our HTML elements in the appropriate responsive format. Just as with the width, one may specify the max-width of the element to 100%.

Max- width: 100%;

Responsive Text: Just like with other elements, the text needs to adjust to the screen size of all devices. VW may be used to alter the viewport width, making it simple for the user to modify the text size to fit the device screen. This terminology clarifies why the browser display size is referred to as the viewport. In this case, one VW is equivalent to 1% of the viewport width.

<h2 style="font-size:3vw">Words</h2>

Using Media Queries: Text, pictures, and other components may be made more responsive for varying device sizes and browser widths by using media queries in responsive design. These days, a variety of frameworks are accessible to enhance the responsiveness of our website. They resemble:

  1. The responsive stylesheet framework facilitates the usage of several stylesheet frameworks such as W3.CSS which is essential for producing responsive designs. It supports mobile-first design by default. It is simple to pick up and grow in.
  2. Bootstrap is the most widely utilized framework with a fast growth rate and no cost to the user because it is built on web development languages like HTML, CSS and jQuery, which contribute to the responsiveness of websites and makes it easier for users to utilize than other frameworks.
  3. The most recent version of responsive CSS is compatible with a wide range of browsers and gadgets that includes laptops, tablets and smartphones.

Demonstration 1:

We will construct a responsive website in this instance.

<html>

<head>

<meta name='viewport'

content='width=device-width, initial-scale=0'>

</head>

<body>

<div style="text-align: center;

background-color: pink;">

<h1 style="color: black;">

Example for Responsive Page Using Only HTML

</h1>

<h2 style="color: white;">

To make the test responsive

</h2>

<p style="font-size: 2vw;color: white;">

Welcome to the page

</p>

<picture>

<img src=

"Flower 1.jpg"

alt="Flower" width="300" height="300"

border="4">

</picture>

</div>

</body>

</html>

Output

HTML Responsive/>
<!-- /wp:html -->

<!-- wp:paragraph -->
<p>Explanation: The phrase

Demonstration 2 

This instance uses media queries to make the screen responsive. This will enable us to use code to create responsive webpages that work with a variety of browsers and devices:

<head>

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<style>

* {

box-sizing:border-box;

}

.top {

background-color:lightblue;

padding:20px;

float:left;

width:30%;

}

.middle {

background-color:grey;

padding:20px;

float:left;

width:40%;

color:white;

}

.bottom {

background-color:pink;

padding:20px;

float:right;

width:30%;

}

@media screen and (max-width:500px) {

.top, .middle, .bottom {

width:50%;

}

}

</style>

</head>

<body>

<h2>Example for Responsive Design in HTML using Media Queries</h2>

<p>We can see the web page on different devices by resizing the browser window</p>

<div class="top">

<h4>First Part</h4>

<img src="Flower 1.jpg" width="300" height="300"

border="4">

</div>

<div class="middle">

<h4>Second Part</h4>

<img src="Flower 1.jpg" width="300" height="300"

border="4">

</div>

<div class="bottom">

<h4>Third part</h4>

<img src="Flower 1.jpg" width="300" height="300"

border="4">

</div>

</body>

Output

Content displaying or hiding 

As a screen becomes smaller, items may be proportionately shrunk and components can be rearranged as needed to fit everything (relatively well). Although it's fantastic that this is feasible, it's not always the greatest solution to make all of the material from a large screen accessible on a smaller screen or mobile device. Best practices for mobile settings include less complicated navigation, information that is more targeted, and lists or rows rather than several columns of text.

The goal of responsive web design should go beyond simply building a layout that works across a variety of devices and screen sizes. The ability for the user to select what they want to see should also be a priority. Thankfully, CSS has made it simple for us to display and conceal content for many years!

For an HTML block element that has to be hidden in a certain style sheet, either specify display: none or use JavaScript to determine the browser width. Not only can we conceal material for smaller displays, but we can also conceal stuff for larger screens in our default style sheet that should only be accessible on mobile versions or smaller devices. For instance, as we conceal important sections of text, We may swap them out for an alternative navigation structure or with a link to that material. 

We'll notice that we haven't used visibility: hidden in this instance; that attribute removes the information completely, whereas visibility: hidden only conceals it, even though it remains. The markup on the page should not be retained on smaller devices as it consumes resources and may lead to needless scrolling or disrupt the layout.

<html>

<p class="sidebar-nav"><a href="#">Left Content</a> | <a href="#">Right Content</a></p>

<div id="content">

  <h2>Middle Content</h2>

</div>

<div id="sidebar-left">

  <h2>Left content</h2>

</div>

<div id="sidebar-right">

  <h2>Right content</h2>

</div>

</html>

Output

HTML Responsive/>
<!-- /wp:html -->

<!-- wp:paragraph -->
<p>The links to the sidebar content are hidden in our default style sheet, which is seen below. We can see this material on the page load since our screen is big enough.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Here is the *<strong>style.css* (default)</strong> content:</p>
<!-- /wp:paragraph -->

<!-- wp:preformatted -->
<pre class=#content{

  width: 50%;

  float: left;

  margin-right: 2%;

}

#content-left{

  width: 10%;

  float: left;

  margin-right: 2%;

}

#content-right{

  width: 10%;

  float: left;

}

.sidebar-nav{display: none;}

Output

HTML Responsive/>
<!-- /wp:html -->

<!-- wp:paragraph -->
<p>The links to these articles are now visible, and the two sidebars (below) have been hidden. Alternatively, the sidebars might be repositioned in the CSS to float below the text (or in any other sensible manner) and the links could use JavaScript to simply cancel out the display: none when clicked. </p>
<!-- /wp:paragraph -->

<!-- wp:preformatted -->
<pre class=This is the simplified *mobile.css* content:

#content{

  width: 50%;

}

#content-left{

  display: none;

}

#content-right{

  display: none;

}

.sidebar-nav{display: inline;}

Output

HTML Responsive/>
<!-- /wp:html -->

<!-- wp:paragraph -->
<p>In conclusion, <strong>HTML</strong> and <strong>CSS</strong> are used in responsive design to create more user-friendly and responsive websites that fit the screen of any size device. The most recent frameworks are used, including Bootstrap, W3.CSS, and some media query code.</p>
<!-- /wp:paragraph -->

<!-- wp:html -->
<div class=