<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Flexbox.ninja</title>
		<link>https://geoffreycrofte.com/flexbox-ninja</link>
		<description>Some real use cases solved with CSS Flexbox like the holy grail layout, columns with same heights, vertical and horizontal centering, etc.</description>
		<language>EN</language>
		<pubDate>Mon, 20 Apr 2026 04:01:40 +0200</pubDate>
		<lastBuildDate>Wed, 24 Feb 2021 00:00:00 +0100</lastBuildDate>
		<docs>http://www.rssboard.org</docs>
		<image>
			<title>GeoffreyCrofte.com - Flexbox·ninja</title>
			<url>https://geoffreycrofte.com/flexbox-ninja/assets/images/logo.png</url>
			<link>https://geoffreycrofte.com/flexbox-ninja</link>
			<description>Flexbox.ninja – Solved by Flexbox High Kick</description>
			<width>144</width>
			<height>80</height>
		</image>
		<skipHours>
			<hour>23</hour>
		</skipHours>
		<skipDays>
			<day>Sunday</day>
		</skipDays>
		<atom:link href="https://geoffreycrofte.com/flexbox-ninja/feed" rel="self" type="application/rss+xml" />


		
	<item>
		<title>Holy Grail Layout</title>
		<link>https://geoffreycrofte.com/flexbox-ninja/demos/holy-grail-layout/</link>
		<author>Geoffrey Crofte</author>
		<pubDate>Wed, 10 Aug 2016 00:00:00 +0200</pubDate>
		<source url="https://geoffreycrofte.com/flexbox-ninja/feed">Geoffreycrofte.com - Flexbox·ninja</source>
		<guid isPermaLink="true">https://geoffreycrofte.com/flexbox-ninja/demos/holy-grail-layout</guid>

		<description><![CDATA[
			<img src="https://geoffreycrofte.com/flexbox-ninja/demos/holy-grail-layout/holy-grail-layout-big.png" width="362" height="216" />
			
				<div class="container">

					<p>You certainly already know this layout. The Holy Grail layout is defined as:</p>

					<blockquote>
						<p>The <strong>Holy Grail</strong> refers to a web page layout which has multiple, equal height columns that are defined with style sheets. It is commonly desired and implemented, although the ways in which it can be implemented with current technologies all have drawbacks. Because of this, finding an optimal implementation has been likened to <strong>searching for the elusive Holy Grail</strong>.</p>
						<p class="source"><a href="https://en.wikipedia.org/wiki/Holy_Grail_%28web_design%29">Wikipedia</a></p>
					</blockquote>

					<h2>Defining the Holy Grail</h2>

					<p>From the Wikipedia summary, and lot of other researches to find the good way to implement this layout, we are looking for something like that:</p>

					<ul>
						<li>Sidebars and main content should have the same height, regardless of which element is the tallest,</li>
						<li>Sidebars should have fixed width and main content fluid width,</li>
						<li>The center column (main content) should appear first in the HTML source,</li>
						<li>If the content is sparse, the footer should stay to the bottom of the page,</li>
						<li>Use a minimal markup and CSS.</li>
					</ul>

					<h2>Let's code this</h2>

					<p>First at all, you need to build a basic HTML markup. I propose to you this one, but feel free to adapt or improve regarding your real needs.</p>

					<h3>HTML</h3>

<pre class="code"><code class="html">&lt;body class="holy-grail"&gt;
	&lt;header&gt;
		&lt;!-- header content -->
	&lt;/header&gt;

	&lt;div class="holy-grail-body"&gt;

		&lt;section class="holy-grail-content"&gt;
			&lt;!-- Main page content -->
		&lt;/section&gt;

		&lt;div class="holy-grail-sidebar-1 hg-sidebar"&gt;
			&lt;!-- sidebar 1 content -->
		&lt;/div&gt;

		&lt;div class="holy-grail-sidebar-2 hg-sidebar"&gt;
			&lt;!-- sidebar 2 content -->
		&lt;/div&gt;

	&lt;/div&gt;

	&lt;footer&gt;
		&lt;!-- footer content -->
	&lt;/footer&gt;
&lt;/body&gt;</code></pre>
					
					<p>I used explicit classes to make my code easier to read, I suggest you to do so, for you and your team, or for your new you in 6 months!</p>

					<h3>CSS</h3>

					<p>To be clear: today, your website has to be responsive. That's why the CSS code I'll propose you is <em>mobile first responsive</em>.</p>

<pre class="code"><code class="css">/**
 * Make body at least 100% height
 * You can also use a combination
 * of height: 100% in &lt;html&gt; and
 * min-height: 100% in &lt;body&gt;.
 */
.holy-grail {
	min-height: 100vh;
}

/**
 * Let's do a column distribution
 * (mobile first)
 * flex value is 1 1 auto to make
 * body skrinkable and extensible
 */
.holy-grail,
.holy-grail-body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
}

/**
 * Content body item is made
 * extensible too.
 */
.holy-grail-content {
	flex: 1 1 auto;
}

/**
 * Put the first sidebar before content.
 * If you need sidebar to be before content
 * only in big screen put those 3 next lines
 * in @media block.
 */
.holy-grail-sidebar-1 {
	order: -1;
}

/**
 * Let's introduce bigger screen
 */

@media (min-width: 768px) {
	/**
	 * Body items are now side by side
	 */
	.holy-grail-body {
		flex-direction: row;
	}

	/**
	 * Sidebars have a basic 260 width
	 * and are not really flexible anymore
	 */
	.hg-sidebar {
		flex: 0 0 260px;
	}
}</code></pre>

					<p>I hope these comments will help you understand this very short code. You see now how Holy Grail Layout is at your fingertips.</p>

					<p>You may now improve this kick-start CSS code introducing more precise break points you need in order to build <strong>your</strong> perfect website.</p>

				</div><!-- .container -->
		]]></description>
	</item>

	<item>
		<title>Same Columns Height</title>
		<link>https://geoffreycrofte.com/flexbox-ninja/demos/same-height-columns/</link>
		<author>Geoffrey Crofte</author>
		<pubDate>Mon, 12 Sep 2016 00:00:00 +0200</pubDate>
		<source url="https://geoffreycrofte.com/flexbox-ninja/feed">Geoffreycrofte.com - Flexbox·ninja</source>
		<guid isPermaLink="true">https://geoffreycrofte.com/flexbox-ninja/demos/same-height-columns</guid>

		<description><![CDATA[
			<img src="https://geoffreycrofte.com/flexbox-ninja/demos/same-height-columns/same-height-columns-big.png" width="362" height="216" />
			
				<div class="container">

					<p>Yeah I know, I can do it with <code>min-height</code>, or perhaps a <code>table</code>-layout… It's what you think, but you are not totally right if you do so. But before talking about right and wrong, let’s define our needs.</p>

					<h2>Defining the columns behavior</h2>

					<p>I worked with several designers. You know them, they want to create perfect blocks with right divisions, well measured columns, buttons to the bottom, gorgeous images or icons to illustrate a marketing wording…<br>
					Let's define our needs as following:</p>

					<ul>
						<li>Columns should have same visual height by taking the biggest one,</li>
						<li>Columns could have same width, but can also be flexible,</li>
						<li>I want an image at the top, then a title, then a little text and a button/link</li>
						<li>The link have to be at the bottom-end of the column, no matter the text size above,</li>
						<li>Use a minimal markup and CSS, only CSS, no JS</li>
					</ul>

					<h2>Let's code this</h2>

					<p>First at all, you need to build a basic HTML markup. I propose to you this one, but feel free to adapt or improve regarding your real needs.</p>

					<h3>HTML</h3>

<pre class="code"><code class="html">&lt;section&gt;
	&lt;h1&gt;Same Column Height&lt;/h1&gt;
	&lt;div class="flex"&gt;
		&lt;div class="col"&gt;
				
			&lt;a href="#"&gt;
				&lt;img src="image.jpg" width="" height="" alt="Some sample words"&gt;
			&lt;/a&gt;

			&lt;h2&gt;A little title&lt;/h2&gt;
			&lt;p&gt;Lorem ipsum dolor sit […]&lt;/p&gt;
				
			&lt;a class="btn" href="#"&gt;Read more&lt;/a&gt;

		&lt;/div&gt;

		&lt;div class="col"&gt;
				
			&lt;a href="#"&gt;
				&lt;img src="image.jpg" width="" height="" alt="Some sample words"&gt;
			&lt;/a&gt;

			&lt;h2&gt;A little title&lt;/h2&gt;
			&lt;p&gt;Lorem ipsum dolor sit amet […]&lt;/p&gt;
				
			&lt;a class="btn" href="#"&gt;Read more&lt;/a&gt;

		&lt;/div&gt;

		&lt;div class="col"&gt;
				
			&lt;a href="#"&gt;
				&lt;img src="image.jpg" width="" height="" alt="Some sample words"&gt;
			&lt;/a&gt;

			&lt;h2&gt;A little title&lt;/h2&gt;
			&lt;p&gt;Lorem ipsum dolor sit amet, consectetur […]&lt;/p&gt;
				
			&lt;a class="btn" href="#"&gt;Read more&lt;/a&gt;

		&lt;/div&gt;
	&lt;/div&gt;
&lt;/section&gt;</code></pre>

					<p>Now some styles to make the magic works.</p>

					<h3>CSS</h3>

					<p>To be clear: today, your website has to be responsive. That's why the CSS code I'll propose you is <em>mobile first responsive</em>.</p>

<pre class="code"><code class="css">/**
 * Make images responsive
 */
.flex .col img {
	width: 100%;
	height: auto;
}

/**
 * Make .flex children same
 * height using display flex.
 * Justify property prepares
 * cols for being centered.
 */
.flex {
	display: flex;
	justify-content: center;
	width: 960px;
	max-width: 100%;
	margin: auto;
}

/**
 * Make cols flexible to
 * auto push button at the
 * col bottom.
 */
.flex .col {
	display: flex;
	flex-direction: column;
	flex: 1 1 300px;
	/* 
	In the order, equal to
	flex-grow: 1;
	flex-shrink: 1;
	flex-basis: 300px;
	*/
	margin: 1em;
}

/**
 * Margin-top auto pushes
 * button to bottom.
 * Align self makes button
 * stuck to the left.
 */
.flex .col .btn {
	align-self: flex-start;
	margin-top: auto;
}

/**
 * Under 900px wrap cols
 */
@media (max-width: 900px) {
	.flex {
		flex-wrap: wrap;
	}
}</code></pre>
					<p>In that precise case, I allowed images to be very big, larger than their physical width in intermediate screen sizes. (iPad mini in portrait, or something…)<br>
					If you need to keep a real good feeling about images, grab a solution among <code>size</code> and <code>srcset</code> attributes, or simply decide to replace <code>flex: 1 1 300px;</code> by <code>flex: 0 1 300px;</code> that allows cols being smaller but not bigger than 300 pixels wide.</p>

					<p>I hope these comments will help you understand this very short code.Yeah, as you can see, it's pretty easy to do it work.</p>

					<p>Sure, there are many other ways to make the same thing differently. Feel free to adapt it and make your own code.</p>

				</div><!-- .container -->
		]]></description>
	</item>

	<item>
		<title>Website Header</title>
		<link>https://geoffreycrofte.com/flexbox-ninja/demos/website-header/</link>
		<author>Geoffrey Crofte</author>
		<pubDate>Fri, 16 Sep 2016 00:00:00 +0200</pubDate>
		<source url="https://geoffreycrofte.com/flexbox-ninja/feed">Geoffreycrofte.com - Flexbox·ninja</source>
		<guid isPermaLink="true">https://geoffreycrofte.com/flexbox-ninja/demos/website-header</guid>

		<description><![CDATA[
			<img src="https://geoffreycrofte.com/flexbox-ninja/demos/website-header/website-header-big.png" width="362" height="216" />
								
				<div class="container">
					<p>This is awesome! A logo to the left, a navigation to the right.<br>
					It's not a big deal, but this tip could save your time during a lot of projects.</p>

					<h2>Defining our needs</h2>
					<p>I think there are two ways to handle this kind of situation, but only CSS will change the game. My list of needs:</p>

					<ul>
						<li>A logo to the left, a navigation to the right,</li>
						<li>Logo and navigation have to be vertically centered,</li>
						<li>Horizontal alignement have to be shared between logo and nav</li>
						<li>When screen width becomes not enough for both in the same row, logo and nav have to be in two different centered-content lines.</li>
						<li>(Optional) When both are in the same line logo is stuck to the very left, nav to the very right</li>
					</ul>

					<p>I put this last item as optionnal, because… it depends on the project you are doing, but the need can happens.</p>
					
					<h2>Let's code this</h2>

					<h3>Our HTML basics</h3>

<pre class="code"><code class="html">&lt;header class="main-header"&gt;
	&lt;div class="container"&gt;
		&lt;h1 class="mh-logo"&gt;
			&lt;img src="https://geoffreycrofte.com/flexbox-ninja/assets/images/logo.svg" width="170" height="95" alt="Flexbox.ninja"&gt;
		&lt;/h1&gt;
		&lt;nav class="main-nav"&gt;
			&lt;ul class="main-nav-list"&gt;
				&lt;li&gt;
					&lt;a href="#"&gt;Home&lt;/a&gt;
				&lt;/li&gt;
				&lt;li&gt;
					&lt;a href="#"&gt;About us&lt;/a&gt;
				&lt;/li&gt;
				&lt;li&gt;
					&lt;a href="#"&gt;Our clients&lt;/a&gt;
				&lt;/li&gt;
				&lt;li&gt;
					&lt;a href="#"&gt;Contact&lt;/a&gt;
				&lt;/li&gt;
			&lt;/ul&gt;
		&lt;/nav&gt;
	&lt;/div&gt;
&lt;/header&gt;</code></pre>
				
					<p>I use a lot of classes so you can easily chose your own markup.
					<br>In this case, the <code>.container</code> element is here to limit header content width in big screens.</p>

					<h3>CSS to flex the things</h3>

					<p>It's time to define the main rules that make this magic appears. Feel free to see the complete demo file to grab some other tips.</p>

<pre class="code"><code class="css">/**
 * Images a now responsive
 */
img {
	max-width: 100%;
	height: auto;
}

/**
 * Limit the container in
 * width for big screens
 */
.container {
	width: 960px;
	max-width: 100%;
	padding: 20px;
	margin: 0 auto;
}

/**
 * By using display: flex
 * Logo and nav are in 2 cols
 * align-items make them
 * vertically centered
 * justify-content distribute
 * horizontal spaces around
 * and flex-wrap break the
 * things in two lines in
 * small screens
 */
.main-header .container {
	display: flex;
	align-items: center;
	justify-content: space-around;
	flex-wrap: wrap;
}

/**
 * The followings are to
 * make things more
 * clean and airy
 * and contents centered
 */
.main-nav ul {
	margin: 1em 0 .5em;
	text-align: center;
}
.main-nav li {
	display: inline;
}
.main-nav a {
	display: inline-block;
	padding: .5em 1.5em;
}</code></pre>

				<p>Magic part is at <code>.main-header .container</code> selector with all the flex-things. With that, we don't have the last (optionnal) point of our list.</p>

				<p>I propose to you an alternative by pointing only the differences in this following CSS code:</p>

<pre class="code"><code class="css">/**
 * Space-around become
 * Space-between to
 * distribute space
 * between the flex-items
 */
@media (min-width: 960px) {
	.main-header .container {
		justify-content: space-between;
	}
}</code></pre>

					<p>Here, the breakpoint is defined by the maximum width of my <code>.container</code>. I think it's an at-least value, but feel free to adjust it according to your project.</p>

				</div><!-- .container -->
				
		]]></description>
	</item>

	<item>
		<title>Buttons with Icons</title>
		<link>https://geoffreycrofte.com/flexbox-ninja/demos/buttons-with-icons/</link>
		<author>Geoffrey Crofte</author>
		<pubDate>Sat, 11 May 2019 00:00:00 +0200</pubDate>
		<source url="https://geoffreycrofte.com/flexbox-ninja/feed">Geoffreycrofte.com - Flexbox·ninja</source>
		<guid isPermaLink="true">https://geoffreycrofte.com/flexbox-ninja/demos/buttons-with-icons</guid>

		<description><![CDATA[
			<img src="https://geoffreycrofte.com/flexbox-ninja/demos/buttons-with-icons/buttons-with-icons-big.png" width="362" height="216" />
								
				<div class="container">
					<p>The most common case for this kind of pattern is when you need to build buttons for social network sharing.</p>

					<h2>Defining our needs</h2>
					<p>As usual, I like to define some goals so that the CSS solution does make sense to you. What I need is:</p>

					<ul>
						<li>Vertical aligned buttons</li>
						<li>Buttons with vertical aligned icon and text</li>
						<li>If I don't have enough space, the overflowing buttons go to a new line.</li>
						<li>Buttons cover the entire space available by distributing the available space.</li>
						<li>Keep the HTML code as simple and accessible as possible, as usual :p</li>
					</ul>

					<p>The last part is optional.</p>
					
					<h2>Let's code this</h2>

					<h3>Our HTML basics</h3>

<pre class="code"><code class="html">&lt;ul class="social-buttons"&gt;
	&lt;li&gt;
		&lt;a href="https://twitter.com/"&gt;
			&lt;i class="icon-twitter" role="presentation"&gt;&lt;/i&gt;
			Twitter
		&lt;/a&gt;
	&lt;/li&gt;
	&lt;li&gt;
		&lt;a href="https://www.facebook.com/"&gt;
			&lt;i class="icon-facebook" role="presentation"&gt;&lt;/i&gt;
			Facebook
		&lt;/a&gt;
	&lt;/li&gt;
	&lt;li&gt;
		&lt;a href="https://instagram.com"&gt;
			&lt;i class="icon-instagram" role="presentation"&gt;&lt;/i&gt;
			Instagram
		&lt;/a&gt;
	&lt;/li&gt;
	&lt;li&gt;
		&lt;a href="http://weibo.com/"&gt;
			&lt;i class="icon-weibo" role="presentation"&gt;&lt;/i&gt;
			Weibo
		&lt;/a&gt;
	&lt;/li&gt;
	&lt;li&gt;
		&lt;a href="https://www.linkedin.com/"&gt;
			&lt;i class="icon-linkedin" role="presentation"&gt;&lt;/i&gt;
			Linkedin
		&lt;/a&gt;
	&lt;/li&gt;
&lt;/ul&gt;</code></pre>
				
					<p>I used <code>role="presentation"</code> to avoid assistive technology reading the decorative icon. Read more about that thanks to the excellent article by Scott O'Hara "<a href="https://www.scottohara.me/blog/2018/05/05/hidden-vs-none.html">Know your ARIA: 'hidden' VS 'none'</a>".</p>

					<h3>CSS to flex the things</h3>

					<p>Ok now we are using Flexbox to make the magic happen.</p>

<pre class="code"><code class="css">/**
 * The container and the item are both
 * into flex layout. To align items
 * to each other.
 */
.social-buttons,
.social-buttons li {
	display: flex;
	padding: 0;
	margin: 0;
}

/**
 * Force to occupy the space available
 * and allow item being on several lines
 */
.social-buttons {
	width: 100%;
	list-style: none;
	flex-wrap: wrap;
}

/**
 * Items tend to occupy 25% of
 * the available width but are
 * allow to grow.
 */
.social-buttons li {
	flex-basis: 25%;
	flex-shrink: 0;
	flex-grow: 1;
}

/**
 * The anchor is also in Flex
 * to align icon and text and
 * center their content.
 */
.social-buttons a {
	display: flex;
	justify-content: center;
	align-items: center;
	width: 100%;
	padding: .5em 1em;
	font-weight: 500;
	text-decoration: none;
	color: #FFF;
}

/**
 * Some decorations for the 
 * next lines.
 */
.social-buttons i {
	margin-right: .5em;
}

.social-buttons [href*="twitter.com"] {
	background: #1da1f2;
}

.social-buttons [href*="facebook.com"] {
	background: #3b5998;
}

.social-buttons [href*="instagram.com"] {
	background: #c13584;
}

.social-buttons [href*="weibo.com"] {
	background: #e6162d;
}

.social-buttons [href*="linkedin.com"] {
	background: #0077b5;
}</code></pre>

				<p>The magic parts are here the <code>wrap</code> option and the fact that <code>.social-buttons li</code> are allow to <code>grow</code> even if their width is set thanks to <code>flex-basis: 25%</code> which is not a strong constraint</p>

				<p>Here is an alternative code with margin:</p>

<pre class="code"><code class="css">.social-buttons li {
	margin: 2px;
}</code></pre>

					<p>Have fun!</p>

				</div><!-- .container -->
				
		]]></description>
	</item>

	<item>
		<title>Pricing Table</title>
		<link>https://geoffreycrofte.com/flexbox-ninja/demos/pricing-table/</link>
		<author>Geoffrey Crofte</author>
		<pubDate>Wed, 24 Feb 2021 00:00:00 +0100</pubDate>
		<source url="https://geoffreycrofte.com/flexbox-ninja/feed">Geoffreycrofte.com - Flexbox·ninja</source>
		<guid isPermaLink="true">https://geoffreycrofte.com/flexbox-ninja/demos/pricing-table</guid>

		<description><![CDATA[
			<img src="https://geoffreycrofte.com/flexbox-ninja/demos/pricing-table/pricing-table-big.png" width="362" height="216" />
								
				<div class="container">
					<p>Pricing Table is all over the internet with a lot of different patterns. I tried to cover the archetype of this kind of component here.</p>

					<h2>Defining our Pricing Table needs</h2>
					<p>As usual, I'll define some goals so that the CSS solution does make sense to you. What I need for this pricing table is:</p>

					<ul>
						<li><a href="https://geoffreycrofte.com/flexbox-ninja/demos/same-height-columns">Same Column Height</a> already seen in Flexbox.ninja</li>
						<li>All call to action at the same level</li>
						<li>One highlighted columns</li>
						<li>Flexible amount of items</li>
						<li>Keep the HTML code as simple and accessible as possible, as usual 😘</li>
					</ul>
					
					<h2>Let's code our Pricing Table</h2>

					<h3>Our HTML basics</h3>

					<p>
						Here is my piece of HTML. Just add any item you want <code>PT-Item</code> and the class <code>.is-highlighted</code> to the item you want to highlight.
					</p>

<pre class="code"><code class="html">&lt;section class="Pricing-Table"&gt;
	&lt;article class="PT-Item"&gt;
		&lt;header class="PT-Heading"&gt;
			&lt;h2 class="PT-Title"&gt;Free&lt;/h2&gt;
			&lt;p class="PT-Subtitle"&gt;Forever, promise.&lt;/p&gt;
		&lt;/header&gt;

		&lt;ul class="PT-Features"&gt;
			&lt;li class="PT-Feature"&gt;Unlimited Items&lt;/li&gt;
			&lt;li class="PT-Feature"&gt;2 Team Members&lt;/li&gt;
			&lt;li class="PT-Feature"&gt;3 Projects&lt;/li&gt;
			&lt;li class="PT-Feature"&gt;Cloud Storage (2Gb)&lt;/li&gt;
		&lt;/ul&gt;

		&lt;div class="PT-Footer"&gt;
			&lt;p class="PT-Price"&gt;
				&lt;small&gt;$&lt;/small&gt;
				&lt;span class="PT-nb"&gt;0&lt;/span&gt;
				&lt;small&gt;/month&lt;/small&gt;
			&lt;/p&gt;
			&lt;p class="PT-Trial"&gt;14-day money back guarantee&lt;/p&gt;
			&lt;p class="PT-CTA"&gt;
				&lt;a href="#" class="button"&gt;Buy this one&lt;/a&gt;
			&lt;/p&gt;
		&lt;/div&gt;
	&lt;/article&gt;
	
	&lt;!-- ... repeat --&gt;

&lt;/section&gt;</code></pre>
				
					<p>I used a <code>ul</code> element for the list of features, because it's a list so it makes sense using semantic HTML. Same for the rest of the HTML element choices here 😊</p>

					<p>You can totally use <a href="https://www.creativejuiz.fr/blog/veille-technologique/html5-microdata-quelques-exemples" hreflang="fr">Microdata (FR)</a> in this case to improve the code of your pricings.</p>

					<h3>CSS to flex the Pricing Table</h3>

					<p>Ok now what I need is to have a two dimension flex context. The first one is for making the items next to each other and stretch by default. The second is to put the content of each item in a column direction to put the footer at the very bottom of an offer.</p>

<pre class="code"><code class="css">/**
 * The container is in a Flex layout
 * with a gap of 24px
 */
.Pricing-Table {
	--gap: 24px;
	--nb-items: 3;
	/* I used CSS Variables here to 
	 * facilitate the calculation
	 * of width suggestion later.
	 */

	display: flex;
	justify-content: center;
	/* Make it wrap in case we have too many items */
	flex-wrap: wrap;
	gap: var(--gap);

	/* Just design purpose */
	width: 1040px;
	max-width: 100%;
	padding: 32px;
}

/**
 * Below a bit of magic to count
 * the number of items.
 * I stopped over 5 on purpose.
 */
.PT-Item:nth-last-child(4):first-child, 
.PT-Item:nth-last-child(4):first-child ~ .PT-Item {
	--nb-items: 4;
}

.PT-Item:nth-last-child(5):first-child, 
.PT-Item:nth-last-child(5):first-child ~ .PT-Item {
	--nb-items: 5;
}

/**
 * Flex direction column to put our
 * footer at the very bottom.
 */
.PT-Item {
   /* Preparing for themed item */
	--primary: #F34A4E;

	display: flex;
	flex-direction: column;
	flex-grow: 1;
	/* Be careful with max-content value */
	min-width: max-content;
	background: white;
	border-radius: 24px;
	overflow: hidden;
	/**
	 * The calc here is a way to keep thing out
	 * of the wrapping behavior for a while.
	 * Above 5 items it stops and go back
	 * to --nb-items = 3
	 */
	flex-basis: calc( calc(100% - (var(--gap) * var(--nb-items)) )/var(--nb-items) );
}

.PT-Item.is-highlighted {
	/* Preparing for highlighted item */
	--primary: #1FA19C;
	transform: scale(1.05);
}

/**
 * Most of the rest is for
 * decorative purpose.
 */

.PT-Item > * {
	padding: 24px;
}

.PT-Item p,
.PT-Item ul,
.PT-Item h2 {
	margin-top: 0;
	margin-bottom: 0;
}

.PT-Heading {
	text-align: center;
	color: white;
	background: var(--primary);
}

.PT-Feature {
	font-size: .875em;
	padding: 8px 0;
	list-style: none;
}

.PT-Feature + .PT-Feature {
	border-top: 1px solid #eee;
}

.PT-Footer {
	padding-top: 0;
	margin-top: auto;
	text-align: center;
}

.PT-Price {
	font-size: 2.5rem;
	color: var(--primary);
}

.PT-Price small {
	margin: 0 -.25em;
	font-size: 1rem;
	color: #777;
}

.PT-Trial {
	font-size: .75em;
	color: #777;
}</code></pre>

				<p>The magic parts here are the <code>wrap</code> option and the fact that <code>.PT-Item</code> width is determined by the <code>flex-basis</code> calculation. Above 5 items I stopped counting on purpose, but feel free to adjust this code for your needs.</p>

				<p>There is no need for responsive complement here since the entire component is wrapping naturally.</p>


				<p>Have fun!</p>

			</div><!-- .container -->
				
		]]></description>
	</item>

	</channel>
</rss>
