.responsive_img {
width: 100%;
height: auto;
object-fit: cover;
/* Prevent the image from stretching. So it crops the image to prevent from awkward stretching */
}
/*width of image is auto adjusted by 70% of its container width.*/
img {
width: 70%;
}
/*if your image has a 50% width for any kind of screen.
But when you want to make it full-size for mobile devices you need to get help from media queries:*/
/*using media Queries */
@media only screen and (max-width: 480px) {
img {
width: 100%;
}
}
<style>
#imgx img {
float:left;
margin:2px;
border-radius:7px;
display: block;
max-width:100%;
height:auto;
width:100%;
}
</style>
<div id="imgx" class="col-xs-12 col-sm-12" style="padding-bottom:5px;">
<picture>
<source media="(max-width: 799px)" srcset="elva-480w-close-portrait.jpg">
<source media="(min-width: 800px)" srcset="elva-800w.jpg">
<img src="elva-800w.jpg" alt="Chris standing up holding his daughter Elva">
</picture>
img,
video,
iframe {
max-inline-size: 100%;
block-size: auto;
}
Code Example |
---|
Css :: Link design like a Button" |
Css :: media screen smartphone |
Css :: cursor couleur in css |
Css :: how to change the position of a button in css |
Css :: change default arrow icon for accordion in bootstrap |
Css :: css textarea set max characters |
Css :: css background image cut off |
Css :: rotate in 3d css |
Css :: position absolute |
Css :: flask sqlalchemy array column |
Css :: how to create multicolor text in css |
Css :: wordpress remove sticky header |
Css :: how to use local fonts in css |
Css :: background shorthand |
Css :: install tailwind css |
Css :: animation fade in css |
Css :: line sharpness css |
Css :: display sm none |
Css :: css disabled |
Css :: fixed within the div css |
Css :: change font size in textarea html |
Css :: width css |
Css :: css animation shorthand |
Css :: center text in height css |
Css :: center background image css |
Css :: css custom properties |
Css :: backgroud color css |
Css :: animation left to right css |
Css :: use CSS to add a bullet point |
Css :: twig inline css |