<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[norman-munge - Medium]]></title>
        <description><![CDATA[My journey through web development - Medium]]></description>
        <link>https://medium.com/norman-munge?source=rss----e71ea3984667---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>norman-munge - Medium</title>
            <link>https://medium.com/norman-munge?source=rss----e71ea3984667---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 15:31:38 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/norman-munge" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Designing 1:1 or 2:1 artwork ratios in CSS]]></title>
            <link>https://medium.com/norman-munge/designing-1-1-or-2-1-artwork-ratios-in-css-144d403f3dcc?source=rss----e71ea3984667---4</link>
            <guid isPermaLink="false">https://medium.com/p/144d403f3dcc</guid>
            <category><![CDATA[web-design]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[ui-design]]></category>
            <category><![CDATA[css]]></category>
            <dc:creator><![CDATA[Norman]]></dc:creator>
            <pubDate>Thu, 29 Jul 2021 17:13:22 GMT</pubDate>
            <atom:updated>2021-07-29T17:13:22.899Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>It’s fair to say that today’s fast-paced world leaves little room for reading texts, especially in mobile and web applications. We are visual beings and our attention span might just be comparable to a goldfish. Although, text is still essential to effectively communicate, in most cases you have to supplement them with images to really pull in your audience.</p><p>Imagine the amazing UI implemented in your favorite streaming or social media platforms like Netflix, Spotify, Extreme Music, Instagram, or Tiktok. If the images could boast, they would say that without them returning users would be next to null; zilch. Now imagine if the same platforms were text-based only. Awesome movies or songs would go under the radar.</p><p>In this article, I’ll show you a simple and easy hack to set images to have desired aspect ratios: rectangular (2:1) or square (1:1) art ratio. So when your team’s designer decides that a certain image should have a certain aspect ratio and still maintain quality, you don’t have to curse him at the back of your mind.</p><p><strong><em>Note:</em></strong> The images can be optimized further to add lazy loading or adding the `srcset` attribute based on the device plus other cool features. That is not covered in this post.</p><h4>The HTML</h4><ul><li>Create a row in a flex grid</li><li>Put as many images as you want</li><li>Wrap each image in a container. This div helps add the image plus any other information like the caption or the description.</li><li>Put each image in its own wrapper . The wrapper w controls the aspect ratio in using a before pseudo-element that has padding which when adjusted resizes the ratio.</li></ul><figure><img alt="HTML Aspect Ration" src="https://cdn-images-1.medium.com/max/1024/1*Qj0w8hhaWy0Gv2uBrRjf-w.png" /></figure><h4>The CSS</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/608/1*gkbemv55Dt9K6ATLreiNjQ.png" /></figure><p>The row is a flex container with each container having a width set with the user preference. Since there are 3 images in the HTML, we set the flex-basis and max-width to 33%</p><p>The juicy part is the image wrapper that has a before pseudo-element to control the aspect ratio. Setting a height of 0 and adding a padding-top to 100% makes it fill the whole container and have a 1:1 aspect ratio (square)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/1*cN-fKWt6-6zEYMpRb8WhVg.png" /></figure><p>To change the aspect ratio, just adjust the padding-top attribute, for example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/814/1*JRBwSom86HzdFoQjv1jvXA.png" /></figure><p>Lastly, the image should contain an absolute position relative to its wrapper and should cover the whole container.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*QZFVFVLSO4eEWM0zz2nWww.png" /></figure><p>And Voila!!</p><p>The images contain the intended aspect ratio</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AeeHyIaB4E-233ma4JUgJQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NDgONIlXqVeX-Zt2glrS-w.png" /></figure><p>A link to the repo can be found here: <a href="https://github.com/normanmunge/artwork-aspect-ratio">Github</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=144d403f3dcc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/norman-munge/designing-1-1-or-2-1-artwork-ratios-in-css-144d403f3dcc">Designing 1:1 or 2:1 artwork ratios in CSS</a> was originally published in <a href="https://medium.com/norman-munge">norman-munge</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>