<?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>David Calhoun&#039;s Blog &#187; box model</title>
	<atom:link href="http://davidbcalhoun.com/tag/box-model/feed" rel="self" type="application/rss+xml" />
	<link>http://davidbcalhoun.com</link>
	<description>Just another blog</description>
	<lastBuildDate>Mon, 07 May 2012 02:06:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>A Clockwork Box</title>
		<link>http://davidbcalhoun.com/2010/a-clockwork-box</link>
		<comments>http://davidbcalhoun.com/2010/a-clockwork-box#comments</comments>
		<pubDate>Tue, 02 Mar 2010 23:22:59 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[box model]]></category>
		<category><![CDATA[css]]></category>

		<guid isPermaLink="false">http://davidbcalhoun.com/?p=171</guid>
		<description><![CDATA[With CSS there are always various ways to accomplish something. After reading this short tidbit, you should be familiar with the various ways of controlling the size of an element&#8217;s padding, border, and margin, and you should know what the handy &#8220;clockwork&#8221; tip is, and how it will be useful to remember when you&#8217;re putting [...]]]></description>
			<content:encoded><![CDATA[<div class="intro"><img src="http://davidbcalhoun.com/wp-content/uploads/2010/03/clockwork-box.png" alt="Clockwork Orange cover" title="Clockwork Orange cover" width="450" height="320" class="left alignleft size-full wp-image-174" />
<div>With CSS there are always various ways to accomplish something.  After reading this short tidbit, you should be familiar with the various ways of controlling the size of an element&#8217;s padding, border, and margin, and you should know what the handy &#8220;clockwork&#8221; tip is, and how it will be useful to remember when you&#8217;re putting your CSS into practice.</div>
</div>
<h3>Equal values on all four sides</h3>
<p>If all four values (top, right, bottom, and left) are equal, then you simply write the following:</p>
<pre name="code" class="css">
padding: 1px;
border-width: 1px;
margin: 1px;
</pre>
<h3>The longhand way</h3>
<p>If you don&#8217;t want equal values on all four sides, then you can specify each side individually:</p>
<pre name="code" class="css">
padding-top: 1px;
padding-right: 2px;
padding-bottom: 3px;
padding-left: 4px;

border-top-width: 1px;
border-right-width: 2px;
border-bottom-width: 3px;
border-left-width: 4px;

margin-top: 1px;
margin-right: 2px;
margin-bottom: 3px;
margin-left: 4px;
</pre>
<h3>The shortcut (like clockwork)</h3>
<p>However this seems to be quite a hassle typing out each property, so you&#8217;ll find it&#8217;s much easier to use the following shorthand, which is in this order: top, right, bottom, left (think of the hands going clockwise around a clock).  The following is equivalent to the above code:</p>
<pre name="code" class="css">
padding: 1px 2px 3px 4px;
border-width: 1px 2px 3px 4px;
margin: 1px 2px 3px 4px;
</pre>
<h3>Other shorthands</h3>
<p>This is the style I find myself writing in most often, but there are two other shorthand styles you should be aware of:</p>
<pre name="code" class="css">
padding: 1px 2px 3px;  /* top, left/right, bottom */
padding: 1px 2px;      /* top/bottom, left/right */
</pre>
<h3>Summary</h3>
<p>In short, there are various ways to define the padding, border, and margin on an element.  Here&#8217;s a recap, with padding used as an example:</p>
<pre name="code" class="css">
padding: 1px;              /* 1 value: top/right/bottom/left     */
padding: 1px 2px;          /* 2 values: top/bottom, left/right   */
padding: 1px 2px 3px;      /* 3 values: top, left/right, bottom  */
padding: 1px 2px 3px 4px;  /* 4 values: top, right, bottom, left */
</pre>
]]></content:encoded>
			<wfw:commentRss>http://davidbcalhoun.com/2010/a-clockwork-box/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

