html - circular divs computed width incorrect causing not to be circular -
i have circle divs (using large border-radius) , they're different sizes on different screen sizes using media queries. width doesn't kick in correctly on media query sizes. example here screenshot of small devices:
the images shows width , height set 80px in css computed width 63px.
when drag screen wider, seeing circles gradually become wider , wider until circles, kind of "responsive" div, rather div changes size @ width breakpoints.
here jsfiddle:
http://jsfiddle.net/52vtd/15513/
how can circle divs circles (same width height)?
html:
css:
#about-page { height: 100%; padding-top: 57px; width: 100%; overflow-y: auto; overflow-x: auto; min-height: 480px; justify-content: center; color: black; background-color: white; } #content-container { h1, h2, h3, h4, h5, h6 { text-align: center; text-transform: uppercase; font-weight: 200; } } .circle-container { display: inline-flex; margin-bottom: 40px; width: 100%; justify-content: center; } .circle { border-radius: 75px; border: 1px solid black; display: inline-flex; } /* xs */ @media screen , (min-width: 320px) { .circle { height: 80px; width: 80px; margin: 5px; } } /* s */ @media screen , (min-width: 544px) { .circle { height: 110px; width: 110px; margin: 5px; } } /* m */ @media screen , (min-width: 768px) { .circle { height: 120px; width: 120px; margin: 8px; } } /* l */ @media(min-width:992px) { .circle { height: 130px; width: 130px; margin: 10px; } } /* xl */ @media screen , (min-width: 1200px) { .circle { height: 150px; width: 150px; margin: 10px; } }
you're using flexbox (specifically inline-flex
) default, circles shrink fit container element. prevent this, set flex-shrink: 0
or flex: 0 0 auto;
prevent behaviour.
.circle { border-radius: 75px; border: 1px solid black; display: inline-flex; flex: 0 0 auto; }
Comments
Post a Comment