<?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>Swedish fika &#187; CSS</title>
	<atom:link href="http://www.swedishfika.com/category/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.swedishfika.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Sun, 25 Jul 2010 21:57:57 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Horizontally and vertically center a box in the browser window</title>
		<link>http://www.swedishfika.com/2008/02/24/horizontally-and-vertically-center-a-box-in-the-browser-window/</link>
		<comments>http://www.swedishfika.com/2008/02/24/horizontally-and-vertically-center-a-box-in-the-browser-window/#comments</comments>
		<pubDate>Sun, 24 Feb 2008 13:43:37 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://swedishfika.com/2008/02/24/horizontally-and-vertically-centre-a-website-in-the-browser-window/</guid>
		<description><![CDATA[In this guide I will show how you can horizontally and vertically center a box in the browser window. I&#8217;ve used as little markup and CSS as I think is possible just to make this example easy to grasp.

The XHTML
&#60;div class="box"&#62;
  &#60;!-- Website content goes here --&#62;
&#60;/div&#62;
The CSS
div.box{
  width: 500px;
  height: 400px;
 [...]]]></description>
			<content:encoded><![CDATA[<p>In this guide I will show how you can horizontally and vertically center a box in the browser window. I&#8217;ve used as little markup and CSS as I think is possible just to make this example easy to grasp.</p>
<p><span id="more-25"></span></p>
<h3>The XHTML</h3>
<p><code>&lt;div class="box"&gt;<br />
  &lt;!-- Website content goes here --&gt;<br />
&lt;/div&gt;</code></p>
<h3>The CSS</h3>
<p><code>div.box{<br />
  width: 500px;<br />
  height: 400px;<br />
  position: absolute;<br />
  top: 50%;<br />
  left: 50%;<br />
  margin-top: -200px; /* height/2 = 200 */<br />
  margin-left: -250px; /* width/2 = 250 */<br />
}</code></p>
<p>You can also make this shorthand like this:</p>
<p><code>div.box{<br />
  width: 500px;<br />
  height: 400px;<br />
  position: absolute;<br />
  top: 50%;<br />
  left: 50%;<br />
  margin: -200px 0 0 -250px;<br />
}</code></p>
<p><em>/Simon Kjellberg </em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.swedishfika.com/2008/02/24/horizontally-and-vertically-center-a-box-in-the-browser-window/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Horizontally Center a Box in the Browser Window</title>
		<link>http://www.swedishfika.com/2008/02/23/horizontally-center-a-website-in-the-browser-window/</link>
		<comments>http://www.swedishfika.com/2008/02/23/horizontally-center-a-website-in-the-browser-window/#comments</comments>
		<pubDate>Sat, 23 Feb 2008 15:09:50 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://swedishfika.com/2008/02/23/horizontally-center-a-website-in-the-browser-window/</guid>
		<description><![CDATA[In this small guide I will show how you can horizontally center a box in the browser window. I&#8217;ve used as little markup and CSS as I think is possible.

The XHTML
&#60;div class="box-to-center"&#62;
  &#60;!-- website content goes here --&#62;
&#60;/div&#62;

The CSS
div.box-to-center{
  margin-top: 0;
  margin-right: auto;
  margin-bottom: 0;
  margin-left: auto;
  width: 950px;
}
You [...]]]></description>
			<content:encoded><![CDATA[<p>In this small guide I will show how you can horizontally center a box in the browser window. I&#8217;ve used as little markup and CSS as I think is possible.</p>
<p><span id="more-23"></span></p>
<h3>The XHTML</h3>
<p><code>&lt;div class="box-to-center"&gt;<br />
  &lt;!-- website content goes here --&gt;<br />
&lt;/div&gt;<br />
</code></p>
<h3>The CSS</h3>
<p><code>div.box-to-center{<br />
  margin-top: 0;<br />
  margin-right: auto;<br />
  margin-bottom: 0;<br />
  margin-left: auto;<br />
  width: 950px;<br />
}</code></p>
<p>You can of course make this shorthand like this:<br />
<code>div.box-to-center{<br />
  margin: 0 auto;<br />
  width: 950px;<br />
}</code></p>
<h3>Notes</h3>
<p>It is important to remember that you must set margin-right: auto,  margin-left: auto; and a fixed width on the &lt;div&gt; that the entire website is surrounded in.</p>
<p><em>/Simon Kjellberg</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.swedishfika.com/2008/02/23/horizontally-center-a-website-in-the-browser-window/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>CSS Custom Bullet List</title>
		<link>http://www.swedishfika.com/2008/02/20/css-custom-bullet-list/</link>
		<comments>http://www.swedishfika.com/2008/02/20/css-custom-bullet-list/#comments</comments>
		<pubDate>Wed, 20 Feb 2008 19:32:20 +0000</pubDate>
		<dc:creator>Alexander Radsby</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://swedishfika.com/2008/02/20/css-custom-bullet-list/</guid>
		<description><![CDATA[In this small guide I will explain how Simon &#38; I make our custom bullet lists. This can later be applied to other elements on your site because it&#8217;s really easy and flexible. So here we go!

The CSS
li {
  background-image: url(custombullet.gif);
  background-position: center left;
  background-repeat: no-repeat;
  padding-left: 20px;
  list-style: none;
}
You [...]]]></description>
			<content:encoded><![CDATA[<p>In this small guide I will explain how Simon &amp; I make our custom bullet lists. This can later be applied to other elements on your site because it&#8217;s really easy and flexible. So here we go!</p>
<p><span id="more-14"></span></p>
<h3>The CSS</h3>
<p><code>li {<br />
  background-image: url(custombullet.gif);<br />
  background-position: center left;<br />
  background-repeat: no-repeat;<br />
  padding-left: 20px;<br />
  list-style: none;<br />
}</code></p>
<p>You can of course make this shorthand like this:<br />
<code>li {<br />
  background:url(custombullet.gif) center left no-repeat;<br />
  padding-left: 20px;<br />
  list-style: none;<br />
}</code></p>
<p><em>The padding may vary depending on which icon you use.</em></p>
<h3>The XHTML</h3>
<p><code>&lt;ul&gt;<br />
  &lt;li&gt;Sample text&lt;/li&gt;<br />
&lt;/ul&gt;</code></p>
<h3>Samples</h3>
<p>This can as I said be used in many ways and does not have to be limited to list elements. I often use them with &lt;span&gt; tags. It&#8217;s great for putting icons before text. The examples were taken from <a href="http://www.alexanderradsby.com">my blog</a>.</p>
<p><img src="http://swedishfika.com/wp-content/uploads/customicon1.jpg" alt="Sample 1" /><img src="http://swedishfika.com/wp-content/uploads/customicon3.jpg" alt="Sample 2" /></p>
<p>/ Alexander Radsby</p>
]]></content:encoded>
			<wfw:commentRss>http://www.swedishfika.com/2008/02/20/css-custom-bullet-list/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>How to write and style comments in a definition list</title>
		<link>http://www.swedishfika.com/2008/02/19/how-to-write-and-style-comments-in-a-definition-list/</link>
		<comments>http://www.swedishfika.com/2008/02/19/how-to-write-and-style-comments-in-a-definition-list/#comments</comments>
		<pubDate>Tue, 19 Feb 2008 21:14:12 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://swedishfika.com/2008/02/19/how-to-write-and-style-comments-in-a-definition-list/</guid>
		<description><![CDATA[There are many ways to write and style comments and here is a brief guide on how you can use a simple definition list with a few rows of CSS to write a list of comments.
A comment has often some information such as who the comment is written by and a postdate when the comment [...]]]></description>
			<content:encoded><![CDATA[<p>There are many ways to write and style comments and here is a brief guide on how you can use a simple definition list with a few rows of CSS to write a list of comments.</p>
<p><span id="more-11"></span>A comment has often some information such as who the comment is written by and a postdate when the comment was written shown with the comment. The picture at   the top shows how the list will look like when we&#8217;re finished. Lets have that in mind when we begin.</p>
<h3>Lets start writing the XHTML for the definitionlist.</h3>
<p><code>&lt;dl&gt;<br />
  &lt;dt&gt;Simon Kjellberg&lt;/dt&gt;<br />
  &lt;dd class="postdate"&gt;2008-02-19 15:45&lt;/dd&gt;<br />
  &lt;dd&gt;<br />
    This is where the actual comment will be written. For now,<br />
    we just write some text as an example.<br />
  &lt;/dd&gt;<br />
  &lt;dt&gt;Alexander Radsby&lt;/dt&gt;<br />
  &lt;dd class="postdate"&gt;2008-02-18 16:34&lt;/dd&gt;<br />
  &lt;dd&gt;<br />
    This is where the actual comment will be written. For now,<br />
    we just write some text as an example.<br />
  &lt;/dd&gt;<br />
&lt;/dl&gt;</code></p>
<p>If we take a look at the list that&#8217;s written in pure XHTML in a browser now, it should look something like the picture below:</p>
<p><img src="http://swedishfika.com/wp-content/uploads/comments-unstyled.jpg" alt="Unstyled comment list" /></p>
<h3>Now we just need to write some CSS to style the list.</h3>
<h4>Let&#8217;s begin with the &lt;dl&gt;:</h4>
<p><code>dl{<br />
  font-family: Georgia, "Times New Roman", Times, serif;<br />
  margin: 0;<br />
  padding: 0;<br />
  width: 500px;<br />
}</code></p>
<p>We have set a font for all the text in the list and we have set all margins and paddings to 0 to remove undesired and unexpected default values. We also want the list to have a fixed-width so we have set it to 500 pixels.</p>
<h4>Now lets write the CSS for the &lt;dt&gt;-tag that will contain the commenter-name:</h4>
<p><code>dl dt{<br />
  margin: 0;<br />
  padding: 0 0 5px 0;<br />
  width: 360px;<br />
  float: right;<br />
}</code></p>
<p>We have  set a padding-bottom to create a space between the name and the actual comment. We have also set a width to 360px and finally floated it right wich makes the whole &lt;dt&gt; to move to the right.</p>
<h4>Now we need to deside how the postdate will be presented:</h4>
<p><code>dl dd.postdate{<br />
  margin: 0;<br />
  padding: 2px 20px 10px 0;<br />
  float: left;<br />
  width: 120px;<br />
  font-size: 70%;<br />
}</code></p>
<p>As you remember we want to show the postdate to the left and the actual comment below the commenter-name so we have added a class to the &lt;dd&gt; that holds the postdate so we can separate the &lt;dd&gt; that contains the postdate from the &lt;dd&gt; that contains the comment. We&#8217;ve also added a fixed-width and a padding-right to make a gap between the postdate and the commenter-name and floated it left so it will float up to the left next to the commenter-name. Notice that the total width of the &lt;dd&gt; that contains the postdate and the &lt;dt&gt; is not bigger than the total width of the list. (If it would be bigger the layout would breake apart)</p>
<h4>Finally we need to write the CSS for the &lt;dd&gt; that contains the actual comment:</h4>
<p><code>dl dd{<br />
  font-size: 80%;<br />
  margin: 0;<br />
  padding: 0 0 20px 0;<br />
  float: right;<br />
  width: 360px;<br />
  text-align: justify;<br />
}</code></p>
<p>We&#8217;ve almost set the same rules to the &lt;dd&gt; that contains the comment as we did to the &lt;dt&gt;. We have set the same width to the &lt;dd&gt; as we did to the &lt;dt&gt; and also floated right so it will be presented right under the &lt;dt&gt;.</p>
<p>That&#8217;s it! Now we&#8217;re finished and if we take a look at the list in a browser it should look like the list in the image below:</p>
<p><img src="http://swedishfika.com/wp-content/uploads/comment-small.jpg" alt="Comment list" /></p>
<h3>Summary</h3>
<p><code>&lt;dl&gt;<br />
  &lt;dt&gt;Simon Kjellberg&lt;/dt&gt;<br />
  &lt;dd class="postdate"&gt;2008-02-19 15:45&lt;/dd&gt;<br />
  &lt;dd&gt;<br />
    This is where the actual comment will be written. For now,<br />
    we just write some text as an example.<br />
  &lt;/dd&gt;<br />
  &lt;dt&gt;Alexander Radsby&lt;/dt&gt;<br />
  &lt;dd class="postdate"&gt;2008-02-18 16:34&lt;/dd&gt;<br />
  &lt;dd&gt;<br />
    This is where the actual comment will be written. For now,<br />
    we just write some text as an example.<br />
  &lt;/dd&gt;<br />
  &lt;/dl&gt;<br />
</code><br />
<code>dl{<br />
  font-family: Georgia, "Times New Roman", Times, serif;<br />
  margin: 0;<br />
  pading: 0;<br />
  width: 500px;<br />
}<br />
dl dt{<br />
  margin: 0;<br />
  padding: 0 0 5px 0;<br />
  width: 360px;<br />
  float: right;<br />
}<br />
dl dd.postdate{<br />
  margin: 0;<br />
  padding: 2px 20px 10px 0;<br />
  float: left;<br />
  width: 120px;<br />
  font-size: 70%;<br />
}<br />
dl dd{<br />
  font-size: 80%;<br />
  margin: 0;<br />
  padding: 0 0 20px 0;<br />
  float: right;<br />
  width: 360px;<br />
  text-align: justify;<br />
}<br />
</code><br />
I hope this example will come in handy.</p>
<p><em>/ Simon Kjellberg</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.swedishfika.com/2008/02/19/how-to-write-and-style-comments-in-a-definition-list/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
