"Image circle ratio respect"
Bootstrap 3.1.0 Snippet by joseanmola

<link href="//netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//netdna.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div class="container"> <div class="row"> <h2>Any image, size doesn´t matter, centered and respecting ratio</h2> </div> <div class="row"> <div class="col-sm-2"> <p> Image in to circle</p> <div class="ratio img-responsive img-circle" style="background-image: url(http://trovacamporella.com/img/trovacamporella-fiat500.png);"></div> <p> Image in to circle with link</p> <a href="http://trovacamporall.com" class="ratio img-responsive img-circle" style="background-image: url(http://trovacamporella.com/img/trovacamporella-fiat500.png);"></a> </div> <div class="col-sm-10"> <p> Original image (no resize)</p> <img src="http://trovacamporella.com/img/trovacamporella-fiat500.png"> </div> </div> </div>
.caption div { box-shadow: 0 0 5px #C8C8C8; transition: all 0.3s ease 0s; } .img-circle { border-radius: 50%; } .img-circle { border-radius: 0; } .ratio { background-position: center center; background-repeat: no-repeat; background-size: cover; height: 0; padding-bottom: 100%; position: relative; width: 100%; } .img-circle { border-radius: 50%; } .img-responsive { display: block; height: auto; max-width: 100%; }

Related: See More


Questions / Comments:

.img-circle {
border-radius: 50%;
}

.img-circle {
border-radius: 0;
}

... is this double or a hack?

spieler () - 10 years ago - Reply 0


Any chance you can show this working for a full screen carousel?

mouse0270 () - 10 years ago - Reply 0