Home » Tag Archives: CSS (page 30)

Tag Archives: CSS

Aspect Ratios with SVG

I quite like this little trick from Noam Rosenthal: <style> .aspectRatioSizer { display: grid; } .aspectRatioSizer > * { grid-area: 1 / 1 / 2 / 2; } </style> <div class="aspectRatioSizer"> <svg viewBox="0 0 7 2"></svg> <div> Content goes here </div> </div> Two things going on there: As soon as you give a <svg> a viewBox, it goes full-width, but ...

Read More »

Powered by WP Robot