<?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[Stories by Kellycochrane on Medium]]></title>
        <description><![CDATA[Stories by Kellycochrane on Medium]]></description>
        <link>https://medium.com/@kellycochrane2?source=rss-7a60b3b91adb------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*pFzPJlqoXumvIFugsuQt5Q.jpeg</url>
            <title>Stories by Kellycochrane on Medium</title>
            <link>https://medium.com/@kellycochrane2?source=rss-7a60b3b91adb------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 15:00:29 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kellycochrane2/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Why you should stop using “traditional” margin and padding when styling with CSS]]></title>
            <link>https://medium.com/@kellycochrane2/why-you-should-stop-using-traditional-margin-and-padding-when-styling-with-css-21428c3ee7?source=rss-7a60b3b91adb------2</link>
            <guid isPermaLink="false">https://medium.com/p/21428c3ee7</guid>
            <category><![CDATA[css3]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[accessibility]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Kellycochrane]]></dc:creator>
            <pubDate>Wed, 02 Nov 2022 16:54:45 GMT</pubDate>
            <atom:updated>2022-11-09T20:07:45.754Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pZbq2mTk_09JYVI9" /><figcaption>Photo by <a href="https://unsplash.com/@pankajpatel?utm_source=medium&amp;utm_medium=referral">Pankaj Patel</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>With more people using the web than ever comes a greater need to ensure web experiences are accessible for users everywhere. This includes people who view content from different directions/orientations (right-to-left, top-to-bottom, etc).</p><p>When adding traditional margin and padding, you’re explicitly defining margin and padding from various directions (top, bottom, left, and right). This may create a layout that looks nice to you in your locale, but it may be confusing when a user with a different locale views the content from a different direction/orientation than the way you designed it.</p><p><strong><em>Every modern developer should be using </em></strong><strong><em>margin-inline/</em></strong><strong><em>margin-block and </em></strong><strong><em>padding-inline/</em></strong><strong><em>padding-block.</em></strong></p><p>Let’s break down how these CSS properties work and why we’d want to use them.</p><p>margin-inline and padding-inline controls left and right margin/padding. Rather than explicitly defining margins corresponding to these specific directions, we define them as start and end margins. While one locale may start to the left and end at the right, others may not, so defining them this way will ensure margins and padding will be displayed as expected regardless of locale.</p><p>Similarly, margin-block and padding-block controls top and bottom margin/padding with the same start and end pattern rather than explicit definitions for top and bottom.</p><p><strong>To define margin or padding for multiple directions at once, you may use:</strong></p><ul><li>margin-inline: [start value] [end value]; for left and right margins</li><li>margin-block: [start value] [end value]; for top and bottom margins</li><li>padding-inline: [start value] [end value]; for left and right padding</li><li>padding-block: [start value] [end value]; for top and bottom padding</li></ul><p><strong>To define margin or padding for just one direction, you may use:</strong></p><ul><li>margin-inline-start (rather than margin-left)</li><li>margin-inline-end (rather than margin-right)</li><li>margin-block-start (rather than margin-top)</li><li>margin-block-end (rather than margin-bottom)</li><li>padding-inline-start (rather than padding-left)</li><li>padding-inline-end (rather than padding-right)</li><li>padding-block-start (rather than padding-top)</li><li>padding-block-end (rather than padding-bottom)</li></ul><p><strong>Let’s look at some examples:</strong></p><pre>// Traditional<br>margin-left: 1.2em;</pre><pre>// Equivalent<br>margin-inline-start: 1.2em;</pre><pre>// Traditional<br>padding-top: 5px;</pre><pre>// Equivalent<br>padding-block-start: 5px;</pre><p>Or when defining padding for multiple directions:</p><pre>// Traditional<br>padding: 5px 10px 20px 15px;</pre><pre>// Equivalent<br>padding-block: 5px 20px;<br>padding-inline: 15px 10px;</pre><p>These modern margin/padding patterns are even more powerful when combined with the use of flexbox for content alignment rather than float. Flexbox is a direction-agnostic layout model. Rather than explicitly aligning an element to the left, right, top, or bottom, flexbox allows for aligning content to the vertical and horizontal start and end of its parent element.</p><p><strong>For example:</strong></p><pre>// Aligns child elements to the right when viewing left-to-right or left if viewing right-to-left</pre><pre>.parent-element {<br>   display: flex;<br>   align-items: flex-end;<br>}</pre><p>Even if your application or website doesn’t currently support displaying text/content in various directions/orientations based on locale, developers should ultimately be working towards making their web experience accessible to all users by adopting use of the patterns discussed above. It’s an easy transition to make that every developer should adopt for the future of accessibility.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=21428c3ee7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>