Obrazy Bootstrapa
Kształty obrazów Bootstrap
Zaokrąglone rogi:
Koło:
Miniaturka:
Zaokrąglone rogi
Klasa .img-rounded
dodaje zaokrąglone rogi do obrazu (IE8 nie obsługuje zaokrąglonych rogów):
Przykład
<img src="cinqueterre.jpg" class="img-rounded" alt="Cinque Terre">
Koło
Klasa .img-circle
kształtuje obraz w okrąg (IE8 nie obsługuje zaokrąglonych rogów):
Przykład
<img src="cinqueterre.jpg" class="img-circle" alt="Cinque
Terre">
Miniaturka
Klasa .img-thumbnail
kształtuje obraz w miniaturę:
Przykład
<img src="cinqueterre.jpg" class="img-thumbnail" alt="Cinque Terre">
Responsywne obrazy
Obrazy są we wszystkich rozmiarach. Podobnie ekrany. Elastyczne obrazy automatycznie dopasowują się do rozmiaru ekranu.
Twórz responsywne obrazy, dodając .img-responsive
klasę do <img>
tagu. Obraz będzie wtedy ładnie skalowany do elementu nadrzędnego.
Klasa .img-responsive
dotyczy display: block;
i max-width: 100%;
do
height: auto;
obrazu:
Przykład
<img class="img-responsive" src="img_chania.jpg" alt="Chania">
Galeria obrazów
Możesz także użyć systemu siatki Bootstrap w połączeniu z .thumbnail
klasą, aby stworzyć galerię obrazów.
Uwaga: Więcej o systemie siatki dowiesz się w dalszej części tego samouczka (jak stworzyć układ z różną ilością kolumn).
Przykład
<div class="row">
<div class="col-md-4">
<div class="thumbnail">
<a href="/w3images/lights.jpg">
<img src="/w3images/lights.jpg" alt="Lights" style="width:100%">
<div class="caption">
<p>Lorem ipsum...</p>
</div>
</a>
</div>
</div>
<div class="col-md-4">
<div class="thumbnail">
<a href="/w3images/nature.jpg">
<img src="/w3images/nature.jpg" alt="Nature" style="width:100%">
<div class="caption">
<p>Lorem ipsum...</p>
</div>
</a>
</div>
</div>
<div class="col-md-4">
<div class="thumbnail">
<a href="/w3images/fjords.jpg">
<img src="/w3images/fjords.jpg" alt="Fjords" style="width:100%">
<div class="caption">
<p>Lorem ipsum...</p>
</div>
</a>
</div>
</div>
</div>
Responsywne osadzania
Pozwól także na prawidłowe skalowanie filmów lub pokazów slajdów na dowolnym urządzeniu.
Klasy mogą być stosowane bezpośrednio do elementów <iframe>, <embed>, <video> i <object>.
The following example creates a responsive video by adding an .embed-responsive-item
class
to an <iframe>
tag (the video will then scale nicely to the parent element).
The containing <div>
defines the aspect ratio of the video:
Example
<div class="embed-responsive embed-responsive-16by9">
<iframe class="embed-responsive-item" src="..."></iframe>
</div>
What is aspect ratio?
The aspect ratio of an image
describes the proportional relationship between its width and its height. Two common video aspect ratios are 4:3
(the universal video format of the 20th
century), and 16:9 (universal for HD television and European digital
television).
You can choose between two aspect ratio classes:
<!-- 16:9 aspect ratio -->
<div class="embed-responsive embed-responsive-16by9">
<iframe class="embed-responsive-item" src="..."></iframe>
</div>
<!-- 4:3 aspect ratio -->
<div class="embed-responsive embed-responsive-4by3">
<iframe class="embed-responsive-item" src="..."></iframe>
</div>
Complete Bootstrap Image Reference
For a complete reference of all image classes, go to our complete Bootstrap Image Reference.