<?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>CSS basics &#8211; Blackbams Blog</title>
	<atom:link href="https://blog.blackbam.at/tag/css-basics/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.blackbam.at</link>
	<description>development - digital arts - internet</description>
	<lastBuildDate>Wed, 26 Feb 2014 00:46:51 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.1</generator>
	<item>
		<title>How to center a div with floating elements and variable width horizontally using pure CSS</title>
		<link>https://blog.blackbam.at/2014/02/26/how-to-center-a-div-with-floating-elements-and-variable-width-horizontally-using-pure-css/</link>
					<comments>https://blog.blackbam.at/2014/02/26/how-to-center-a-div-with-floating-elements-and-variable-width-horizontally-using-pure-css/#respond</comments>
		
		<dc:creator><![CDATA[Blackbam]]></dc:creator>
		<pubDate>Wed, 26 Feb 2014 00:43:31 +0000</pubDate>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS basics]]></category>
		<category><![CDATA[Web]]></category>
		<guid isPermaLink="false">https://blog.blackbam.at/?p=2171</guid>

					<description><![CDATA[In this very short article I am going to show you how to center a div containing floating elements horizontally with pure CSS. Although it should be a simple problem, sometimes it can be annoying to get something centered. So here is a very simple solution for this problem: How to center a div: margin: [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>In this very short article I am going to show you how to center a div containing floating elements horizontally with pure CSS. Although it should be a simple problem, sometimes it can be annoying to get something centered. So here is a very simple solution for this problem:</p>
<p>How to center a div:</p>
<pre lang="css">  
  margin: 0 auto;
  
</pre>
<p>&nbsp;</p>
<p>How to center text elements:</p>
<pre lang="css">  
  text-align:center;
  
</pre>
<p>&nbsp;</p>
<p>How to center a div containing floating elements:</p>
<p>HTML:</p>
<p>&nbsp;</p>
<p>&lt;div id=&#8221;wrapper&#8221;&gt;<br />&lt;div id=&#8221;div_to_center&#8221;&gt;<br />&lt;ul&gt;<br />&lt;li class=&#8221;item&#8221;&gt;abc&lt;/li&gt;<br />&lt;li class=&#8221;item&#8221;&gt;def&lt;/li&gt;<br />&lt;/ul&gt;<br />&lt;/div&gt;<br />&lt;/div&gt;</p>
<p>&nbsp;</p>
<pre lang="css"> 
  
#wrapper {
    text-align:center;
}

#div_to_center {
    margin:0 auto;
    display:inline-block;
}

#div_to_center .item {
    float:left;
    display:inline-block;
}
  </pre>
<p><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fblog.blackbam.at%2F2014%2F02%2F26%2Fhow-to-center-a-div-with-floating-elements-and-variable-width-horizontally-using-pure-css%2F&#038;title=How%20to%20center%20a%20div%20with%20floating%20elements%20and%20variable%20width%20horizontally%20using%20pure%20CSS" data-a2a-url="https://blog.blackbam.at/2014/02/26/how-to-center-a-div-with-floating-elements-and-variable-width-horizontally-using-pure-css/" data-a2a-title="How to center a div with floating elements and variable width horizontally using pure CSS"><img src="https://static.addtoany.com/buttons/share_save_120_16.png" alt="Share"></a></p>]]></content:encoded>
					
					<wfw:commentRss>https://blog.blackbam.at/2014/02/26/how-to-center-a-div-with-floating-elements-and-variable-width-horizontally-using-pure-css/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
