html - Responsive Circle-cropped photos -


on site, i've created these little quote boxes contain 2-4 line quote, byline , byline description (or title/subtitle, whatever), , circularly cropped photo, absolutely positioned @ bottom left of box. i've done basic js fiddle.

(the way works in actual code have sass mixin, class feeds circle diameter.):

haml

.circle-photo-div{ style: "background: url(#{photo_url})" } 

sass

.circle-photo-div   @include circle-photo(110)   position: absolute   bottom: -19%   left: -7%  @mixin circle-photo($diameter)   width: #{$diameter}px   height: #{$diameter}px   border-radius: #{$diameter / 2.0}px   -webkit-border-radius: #{$diameter / 2.0}px   -moz-border-radius: #{$diameter / 2.0}px   margin: 1em auto   background-size: cover   background-repeat: no-repeat   background-position: center center   -webkit-border-radius: 99em   -moz-border-radius: 99em   border-radius: 99em   border: 5px solid white   box-shadow: 0px 0px 5px 1px rgba(0, 0, 0, 0.8) 

at rate, i've made page responsive -- exception of these circle photos.

the trouble is, if page expands, want photo expand well, , don't know of way feed new ideal diameter class feed sass mixin. have page scales perfectly, these photos either tiny or large.

any idea how -- have circle-cropped photo responsively resizes , maintains relative position @ bottom left of box (which, think, means absolute positioning must change well)?

the answer ended being vw/vh.

http://css-tricks.com/viewport-sized-typography/

if made circle-dimensions percentage-based, circles turn ellipses, unless height of container equal width of container, never case (an 80% x 80% circle in 100px x 200px container 80px 160px).

the trick make circle diameter function of container/window width alone, using vw unit. way, image resized window, without distorting ovals.


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -