Salut J'ai de la difficulté à rendre mon image sensible à la div. Y a-t-il un moyen d'avoir simplement des pièces "coupées" qui ne tiennent pas et qui montrent simplement ce qui se trouve dans la div?Image d'échelle basée sur div
HTML
<div class="col-md-4">
<div style="height:42vh; background-color:#f2f2f2; margin-top:0px; margin-bottom:30px;" >
<!--IMAGE DIV-->
<div id="imgdiv" style="height:28vh;" class="img-responsive">
</div>
<div style="height:14vh; background-color:#1c1818; padding-top:0.95em; padding-left:1.75em; padding-right:1.75em;"><%= link_to event.name, event, 'data-no-turbolink' => true, :style=>"float:left; font-family: 'Roboto' !important; font-size:1.5em; color:white;" %> <br>
<div style="float:left; font-family: 'Roboto' !important; font-size:1em; color:white; margin-top:0.15em;"><%= event.start_date.strftime('%B %d, %Y')%><br>
<span style="float:left;"><%= event.city%> City</span></div>
</div>
</div>
</div>
CSS
#imgdiv{
background-image: url(http://lorempixel.com/500/226/fashion);
background-repeat: no-repeat;
background-size: contain;
}
J'utilise également bootstrap twitter, mais le class="img-responsive"
ne répond pas à mes besoins. Lorsque l'image n'a pas le même rapport d'aspect, il y a un espace vide pour le côté le plus court - il essaie toujours d'ajuster l'image entière à l'intérieur de la div. Y a-t-il un autre moyen d'y parvenir? Dois-je utiliser javascript pour cela? Si oui, comment je vais y aller?
Merci d'avance. :)
N'utilisez simplement pas la taille d'arrière-plan. –