<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Eduardo Uribe</title>
    <description>The latest articles on DEV Community by Eduardo Uribe (@eduardo__uribe).</description>
    <link>https://dev.to/eduardo__uribe</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F179845%2F1a8cf254-331a-4dcb-b192-753c91317be6.jpg</url>
      <title>DEV Community: Eduardo Uribe</title>
      <link>https://dev.to/eduardo__uribe</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/eduardo__uribe"/>
    <language>en</language>
    <item>
      <title>Vertically and horizontally center text with flexbox</title>
      <dc:creator>Eduardo Uribe</dc:creator>
      <pubDate>Fri, 05 Jul 2019 22:30:58 +0000</pubDate>
      <link>https://dev.to/eduardo__uribe/vertically-and-horizontally-center-text-with-flexbox-1fmd</link>
      <guid>https://dev.to/eduardo__uribe/vertically-and-horizontally-center-text-with-flexbox-1fmd</guid>
      <description>&lt;p&gt;Today you will learn how to easily center text both vertically and horizontally.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--X5jDwydL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/nsbng03fflb6l8si4v2s.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--X5jDwydL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/nsbng03fflb6l8si4v2s.jpg" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  The starting code
&lt;/h3&gt;

&lt;p&gt;HTML&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1WfRXmm3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/152y0yukb1j9g5jbe2uy.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1WfRXmm3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/152y0yukb1j9g5jbe2uy.jpg" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;CSS&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZWKULlTa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/344j9zr87a88fb1lw22o.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZWKULlTa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/344j9zr87a88fb1lw22o.jpg" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  How it works
&lt;/h3&gt;

&lt;p&gt;Text inside a flex container becomes a flex item by automatically been wrapped in an &lt;a href="https://www.w3.org/TR/css-display-3/#css-anonymous"&gt;anonymous block container&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Qu3oFO1k--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/vu0o2cl42lmwcyfn7yt5.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Qu3oFO1k--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/vu0o2cl42lmwcyfn7yt5.jpg" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This converts the text into a flex item and allows it to participate in its container's flex formatting context.&lt;/p&gt;

&lt;p&gt;Now any flexbox property can be applied to the anonymous block which contains the text.&lt;/p&gt;

&lt;p&gt;In this case, we are centering horizontally with &lt;code&gt;justify-content: center;&lt;/code&gt; and vertically with &lt;code&gt;align-items: center;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rXHRjerU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/fzmkuryltm3wp2ax9iwu.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rXHRjerU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/fzmkuryltm3wp2ax9iwu.jpg" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And that's how you center text both vertically and horizontally inside an element, with flexbox.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://twitter.com/Eduardo__Uribe"&gt;Liked to be notified about new small HTML/CSS tips follow me on twitter @Eduardo__Uribe&lt;/a&gt;&lt;/p&gt;

</description>
      <category>css</category>
      <category>flexbox</category>
    </item>
  </channel>
</rss>
