Using HTML and CSS how to make a responsive image need a responsive image inside a column, I am making a 3 column layout need the image in the first column I am unable to  position it better  my code  flexBox Header Column 1 Column 2 CATS DOGS MICE Rabbit! Duck Elephant Column 3 Footer 3

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

Using HTML and CSS how to make a responsive image

need a responsive image inside a column, I am making a 3 column layout need the image in the first column I am unable to  position it better 

my code 

<!doctype html>

<html lang="en">
<head>
<meta charset="utf-8">

<title>flexBox</title>
<meta name="Phone" content="Number">


<style>
#header{
background-color:#FF6347;
}
#col1{
background-color:#FFD700 ;
width: 30%;
float: left;
}
#col2{
background-color:#00BFFF ;
width: 50%;
float: left;
}
#col3{
background-color:#FF69B4;
width: 20%;
float: left;

}
#footer{
background-color: #90EE90;
clear: left;

}
ul {
display: flex;
justify-content: space-between;
flex-direction: column;
padding-left: 2px;
height: 65%;
}


li {
list-style: none;
display: inline-block;
background: tomato;
padding: 5px;
width: 170px;
height: 75px;
margin: 5px;
line-height: 70px;
color: white;
font-size: 3em;
text-align: center;
}
#contaner{
display: flex;
justify-content: space-between;
height: 780px;
}



</style>
</head>

<body>
<div id="header">Header</div>
<div id="contaner">
<div id="col1">Column 1
<picture>
<!-- picture with different source sets-->
<source media="(min-width: 500px)" srcset="popularYouLogo_Itas1.png">
<source media="(min-width: 380px)" srcset="popularYouLogo_Itas2.png">
<source media="(min-width: 600px)" srcset="popularYouLogo_Itas3.png">
<img src="popularYouLogo_Itas3.png" alt="image">
</picture></div>

<div id="col2">Column 2
<ul>
<!---unordered list in main column -->
<li class="item">CATS</li>
<li class="item">DOGS</li>
<li class="item">MICE</li>
<li class="item">Rabbit!</li>
<li class="item">Duck</li>
<li class="item">Elephant</li>
</ul></div>

<div id="col3">Column 3</div>
</div>
<div id="footer">Footer 3</div>

</body>
</html>

 

Expert Solution
Step 1

A responsive image means an image which fits automatically to its screen size.

Multiple ways are there to implement responsive images:

Method-1:

Using responsive class in image tag,

<img src="xxx.jpg" alt="alt_name" class="responsive">

In image tag, set Class attribute to "responsive". 

Method-2:

  • Using the srcset, sizes, and media attributes in the image tag,
  • srcset attribute used to the width of the image along with image file source.
  • sizes attribute to specify the size of the image related to its viewport through media condition.
  • Media attribute used to define media condition.

<img src="xxx.jpg" srcset="src width" sizes="" alt="alt_name" c>

 

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Image Element
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education