Nasıl Yapılır - Duyarlı Görseller
CSS ile duyarlı bir görüntünün nasıl oluşturulacağını öğrenin.
Duyarlı görüntüler ekranın boyutuna uyacak şekilde otomatik olarak ayarlanacaktır.
Duyarlı efekti görmek için tarayıcı penceresini yeniden boyutlandırın:
Duyarlı Görüntüler Nasıl Oluşturulur
Adım 1) HTML'yi ekleyin:
Örnek
<img src="nature.jpg" alt="Nature" class="responsive">
Adım 2) CSS'yi ekleyin:
Resmin yanıt verme konusunda hem yukarı hem de aşağı ölçeklenmesini istiyorsanız, CSS width
özelliğini %100 ve height
otomatik olarak ayarlayın:
Örnek
.responsive {
width: 100%;
height: auto;
}
If you want an image to scale down if it has to, but never scale up to be larger than its original size, use max-width: 100%
:
Example
.responsive {
max-width: 100%;
height: auto;
}
If you want to restrict a responsive image to a maximum size, use the max-width
property, with a
pixel value of your choice:
Example
.responsive {
width: 100%;
max-width:
400px;
height: auto;
}
Go to our CSS Images Tutorial to learn more about how to style images.
Go to our CSS RWD Tutorial to learn more about responsive web design.