<?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>Tutorials Connect &#187; Css</title>
	<atom:link href="http://www.tutorialsconnect.com/category/web/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tutorialsconnect.com</link>
	<description>Tutorials for Linux Users and Web Developers</description>
	<lastBuildDate>Sun, 07 Jun 2009 10:57:37 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Using CSS to Center Vertically and Horizontally</title>
		<link>http://www.tutorialsconnect.com/2008/10/using-css-to-center-vertically-and-horizontally/</link>
		<comments>http://www.tutorialsconnect.com/2008/10/using-css-to-center-vertically-and-horizontally/#comments</comments>
		<pubDate>Tue, 07 Oct 2008 06:21:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Css]]></category>
		<category><![CDATA[Html]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.tutorialsconnect.com/?p=22</guid>
		<description><![CDATA[Centering items using CSS is actually very easy.  If you want to center a picture horizontally then just use the following code in your CSS file.
IMG.centered {
display: block;
margin-left: auto;
margin-right: auto;
}
What the above CSS code does is center an image between the left and right margins automatically. Whenever you insert an image just make sure to [...]]]></description>
			<content:encoded><![CDATA[<p>Centering items using CSS is actually very easy.  If you want to center a picture horizontally then just use the following code in your CSS file.</p>
<blockquote><p>IMG.centered {<br />
display: block;<br />
margin-left: auto;<br />
margin-right: auto;<br />
}</p></blockquote>
<p>What the above CSS code does is center an image between the left and right margins automatically. Whenever you insert an image just make sure to call the &#8220;centered&#8221; class, for example:</p>
<blockquote><p>&lt;img class=&#8221;centered&#8221; src=&#8221;/images/someimage.jpg&#8221; alt=&#8221;some text&#8221; /&gt;</p></blockquote>
<p>If you want to center something vertically then you would need to use a container.  For example:</p>
<blockquote><p>DIV.container {<br />
top: 0;<br />
left: 0;<br />
width: 100%;<br />
height: 100%;<br />
position: fixed;<br />
display: table;<br />
}<br />
P {<br />
display: table-cell;<br />
vertical-align: middle;<br />
}</p></blockquote>
<p>Now that you have the CSS part done lets look at the HTML part.</p>
<blockquote><p>&lt;div class=&#8221;container&#8221;&gt;<br />
&lt;p&gt;This text is vertically centered&lt;/p&gt;<br />
&lt;/div&gt;</p></blockquote>
<p>Now lets combine both of the techniques together to have an image that is horizontally and vertically centered in a browser window.</p>
<p>CSS Code:</p>
<blockquote><p>DIV.container {<br />
top: 0;<br />
left: 0;<br />
width: 100%;<br />
height: 100%;<br />
position: fixed;<br />
display: table;<br />
}<br />
P {<br />
display: table-cell;<br />
vertical-align: middle;<br />
}</p></blockquote>
<p>HTML Code:</p>
<blockquote><p>&lt;div class=&#8221;container&#8221;&gt;<br />
&lt;p&gt;The image below is vertically and horizontally centered.&lt;br /&gt;<br />
&lt;img class=&#8221;centered&#8221; src=&#8221;images/someimage.jpg&#8221; alt=&#8221;some text&#8221; /&gt;&lt;/p&gt;<br />
&lt;/div&gt;</p></blockquote>
<p>Thats It!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tutorialsconnect.com/2008/10/using-css-to-center-vertically-and-horizontally/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
