Learn Basic HTML Complete Course part 24

1 min read

HTML Responsive

Responsive web design is used to make your web page look appropriate, good, and well placedon all devices (desktop, tablet, smartphone etc.)

Responsive web design uses HTML and CSS to resize, hide, shrink, enlarge, or move the content. It makes the content look good on any screen.



Responsive Images

Images which can be scaled nicely to fit any browser size are known as responsive images.

There are some way by which we can make responsive image
1) By using the width property : Set the CSS width property to 100% to make the image responsive and scale up and down.

2) By using the max-width Property : This method is best and most used because it facilitates that the image will scale down if it has to, but never scale up to be larger than its original size.
3) Change images according to the browser width : By using the HTML <picture> element, you can set two or more imagesaccording to the browser width. It will change the picture when you change the browser-size. i.e. desktop and phone.

<!doctype html>
<html>
    <body>
<h4>Responsive Image by width property</h4> 
<p>When we set the CSS width property to 80%,
it makes the image responsive.   
Resize the browser window to see the effect.</p> 
<img src="../image/html_css.jpg" style="width:80%;"><br><hr>

<h4>Responsive Image by max-width Property</h4> 
<p>"max-width:100%" makes the image responsive
and also ensures that the image  
doesn't get bigger than its original size.</p> 
<p>Resize the browser window to see the effect.</p>
<img src="../image/html_css.jpg" style="max-width:100%;
height:auto;"><br><hr>

    </body>
</html>

Responsive Image by width property

When we set the CSS width property to 80%, it makes the image responsive. Resize the browser window to see the effect.

Your image here

Responsive Image by max-width Property

"max-width:100%" makes the image responsive and also ensures that the image doesn't get bigger than its original size.

Resize the browser window to see the effect.

Your image here





You may like these posts

  • HTML File PathsAn HTML file fileName is used to describe the location of a file in a website folder. File paths are like an address of file for a web browser. We can link any exter…
  • HTML TableHTML table tag is used to display data in tabular form (row * column). There can be many columns in a row.We can create a table to display data in tabular form, using <…
  • HTML TagsHTML tags are like keywords which defines that how web browser will format and display the content. With the help of tags, a web browser can distinguish between an HTML co…
  • HTML Id AttributeThe id attribute refers to a unique value for an HTML element. This HTML id value can be used with CSS and JavaScript to perform certain task.HTML id with CSSIn CS…
  • HTML HeadingA HTML heading or HTML h tag can be defined as a title or a subtitle which you want to display on the webpage. When you place the text within the heading tags <h1>…
  • HTML HeadThe HTML <head> element is used as a container for metadata (data about data). It is used between <html> tag and <body> tag.The head of an HTML document …

Post a Comment