<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>CSS3 Archives - Nicholas Rowe</title>
	<atom:link href="https://www.nicholas-rowe.com/tag/css3/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.nicholas-rowe.com/tag/css3/</link>
	<description>CEO &#38; Co-Founder - Saigon Digital</description>
	<lastBuildDate>Mon, 17 Nov 2014 18:02:48 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://www.nicholas-rowe.com/wp-content/uploads/2025/12/cropped-nick-whitebg-e1765901896660-32x32.png</url>
	<title>CSS3 Archives - Nicholas Rowe</title>
	<link>https://www.nicholas-rowe.com/tag/css3/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Vertically aligning elements</title>
		<link>https://www.nicholas-rowe.com/vertically-aligning-elements/</link>
					<comments>https://www.nicholas-rowe.com/vertically-aligning-elements/#respond</comments>
		
		<dc:creator><![CDATA[Nicholas Rowe]]></dc:creator>
		<pubDate>Mon, 24 Feb 2014 00:08:33 +0000</pubDate>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[Vertical Align]]></category>
		<guid isPermaLink="false">http://nicholas-rowe.com/?p=294</guid>

					<description><![CDATA[<p>For a long time I&#8217;ve always been using the following method of vertically aligning elements on a web page: .parent{ display: table; width: 100%; } .child{ display: table-cell; text-align: center; vertical-align: middle; } This method works good across all browsers and includes solid IE support down to IE7. The downfall of this particular method is [&#8230;]</p>
<p>The post <a href="https://www.nicholas-rowe.com/vertically-aligning-elements/">Vertically aligning elements</a> appeared first on <a href="https://www.nicholas-rowe.com">Nicholas Rowe</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>For a long time I&#8217;ve always been using the following method of vertically aligning elements on a web page:</p>
<pre>.parent{
display: table;
width: 100%;
}
.child{
display: table-cell;
text-align: center;
vertical-align: middle;
}
</pre>
<p>This method works good across all browsers and includes solid IE support down to IE7. The downfall of this particular method is that it requires two html elements in order for it to work (a parent and a child).</p>
<p>Using CSS3 transforms property, we can now vertically align elements with just 3 lines of css:</p>
<pre>
.element {
  position: relative;
  top: 50%;
  transform: translateY(-50%);
}</pre>
<p>Transforming the element on the Y axis with a negative 50% of the height the element is currently contained in will pull it up half way (more than likely outside the parents width and height).</p>
<p><img fetchpriority="high" decoding="async" src="http://nicholas-rowe.com/wp-content/uploads/2014/02/transformy.png" alt="transformy" width="286" height="261" class="alignnone size-full wp-image-295" /></p>
<p>Now if we add a top: 50% it will pull the element back down directly in the center of whatever parent container the element is sitting inside of.</p>
<p><img decoding="async" src="http://nicholas-rowe.com/wp-content/uploads/2014/02/top50.png" alt="top50" width="286" height="261" class="alignnone size-full wp-image-296" /></p>
<p>The post <a href="https://www.nicholas-rowe.com/vertically-aligning-elements/">Vertically aligning elements</a> appeared first on <a href="https://www.nicholas-rowe.com">Nicholas Rowe</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.nicholas-rowe.com/vertically-aligning-elements/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
