Ich habe 3 Bilder und wie skaliert man diese Bilder als ich die Größe des Browsers reduzieren. Wie verkleinere ich meine Bilder, wenn ich meinen Browser verkleinere? Ich versuche, diese aber es funktioniert nicht:Wie skaliert man das Bild mit CSS
HTML
<div class="main">
<div class="submain">
<div class="iner">
<img src="img/sample1.png" alt="" />
</div>
<div class="iner1">
<img src="img/sample2.png" alt="" />
</div>
<div class="iner2">
<img src="img/sample3.png" alt="" />
</div>
</div>
</div>
CSS
.main{
position:relative;
height: 500px;
width: 1000px;
background-color: #111210;
}
.iner img{
position: absolute;
width: 600px;
height: 350px;
background-color: #34cb2f;
bottom: 0;
left:50%;
z-index: 5;
transform: translateX(-50%); -webkit-transform: translateX(-50%);
}
.iner1 img{
position: absolute;
width: 600px;
height: 270px;
background-color: #34cb2f;
bottom: 0;
right: 5%;
transform: translateX(-50%); -webkit-transform: translateX(-50%);
}
.iner2 img{
position: absolute;
width: 600px;
height: 270px;
background-color: #34cb2f;
bottom: 0;
left: 65%;
transform: translateX(-50%); -webkit-transform: translateX(-50%);
}
.submain{
width: 800px;
height: 200px;
background-color: rgba(38, 118, 212, 0.51);
}
Und das ist für Stufenbild, wenn min-Breite von weniger als 400px:
@media screen and (min-width: 400px) {
.submain{
width: 75%;
}
}
Aber diese Medienregel funktioniert nicht, vielleicht mache ich etwas falsch, bitte hilf mir zu verstehen. Vielen Dank!
'min-width' bedeutet die minimale Breite, dass die Abfrage wirksam wird, das heißt größer als eine bestimmte Breite. Für weniger als 400 Pixel möchten Sie die maximale Breite, die bei Werten unterhalb eines maximalen Breitenwerts wirksam wird. –