Jump to content

What is the process of making an image responsive using CSS and HTML?


SubhanUllah

Recommended Posts

<!DOCTYPE html> 
<html> 
<head> 
<meta name="viewport" content="width=device-width, initial-scale=1"> 
<style> 
.responsive { 
  width: 100%; 
  height: auto; 
} 
</style> 
</head> 
<body> 
 
<h2>Responsive Images</h2> 
 
<p>If you want the image to scale both up and down on responsiveness, set the CSS width property to 100% and height to auto.</p> 
<p>Resize the browser window to see the effect.</p> 
 
<img src="img_nature.jpg" alt="Nature" class="responsive" width="600" height="400"> 
 
</body> 
</html> 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...