<?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>JaffnaCampus.com &#187; CSS Box Model</title>
	<atom:link href="http://jaffnacampus.com/category/css/css-box-model/feed/" rel="self" type="application/rss+xml" />
	<link>http://jaffnacampus.com</link>
	<description>Gateway to your IT potential</description>
	<lastBuildDate>Tue, 27 Sep 2011 13:57:48 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>CSS Padding</title>
		<link>http://jaffnacampus.com/css/css-box-model/css-padding/</link>
		<comments>http://jaffnacampus.com/css/css-box-model/css-padding/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 04:41:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS Box Model]]></category>
		<category><![CDATA[CSS Padding]]></category>

		<guid isPermaLink="false">http://jaffnacampus.com/?p=161</guid>
		<description><![CDATA[The CSS padding properties define the space between the   element border and the element content.

Padding
The padding clears an [...]]]></description>
			<content:encoded><![CDATA[<p>The CSS padding properties define the space between the   element border and the element content.</p>
<hr />
<h2>Padding</h2>
<p>The padding clears an area around the content (inside the border) of   an   element. The padding is affected by the background color of the element.</p>
<p>The top, right, bottom, and left padding can  be changed independently using separate properties. A shorthand padding   property  can also be used, to change all paddings at once.</p>
<h2>Possible Values</h2>
<table border="1" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<th align="left">Value</th>
<th align="left">Description</th>
</tr>
<tr>
<td><em>length</em></td>
<td>Defines a fixed padding (in pixels, pt, em, etc.)</td>
</tr>
<tr>
<td><em>%</em></td>
<td>Defines a padding in % of the containing element</td>
</tr>
</tbody>
</table>
<p></p>
<hr />
<h2>Padding &#8211; Individual sides</h2>
<p>In CSS, it is possible to specify different padding for different   sides:</p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td>
<h2>Example</h2>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td> padding-top:25px;<br />
                padding-bottom:25px;<br />
                padding-right:50px;<br />
                padding-left:50px;</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<p></p>
<hr />
<h2>Padding &#8211; Shorthand property</h2>
<p>To shorten the code, it is possible to specify all the padding   properties in   one property. This is called a shorthand property.</p>
<p>The shorthand property for all the padding properties is &quot;padding&quot;:</p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td>
<h2>Example</h2>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td> padding:25px 50px;</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<p>The padding property can have from one to four values.</p>
<ul>
<li><strong>padding:25px 50px 75px 100px; </strong>
<ul>
<li>top padding is 25px</li>
<li>right padding is 50px</li>
<li>bottom padding is 75px</li>
<li>left padding is 100px</li>
</ul>
<p>
  </li>
<li><strong>padding:25px 50px 75px;</strong>
<ul>
<li>top padding is 25px</li>
<li>right and left paddings are 50px</li>
<li>bottom padding is 75px</li>
</ul>
<p>
  </li>
<li><strong>padding:25px 50px;</strong>
<ul>
<li>top and bottom paddings are 25px</li>
<li>right and left paddings are 50px</li>
</ul>
<p>
  </li>
<li><strong>padding:25px;</strong>
<ul>
<li>all four paddings are 25px</li>
</ul>
</li>
</ul>
<hr />
<h2>All CSS Padding Properties</h2>
<p>The number in the &quot;CSS&quot; column indicates in which CSS version the   property is defined (CSS1 or CSS2).</p>
<table border="1" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<th align="left" width="20%">Property</th>
<th align="left" width="50%">Description</th>
<th align="left" width="23%">Values</th>
<th align="left" width="7%">CSS</th>
</tr>
<tr>
<td>padding</td>
<td>A shorthand property for setting all the padding properties in   one declaration</td>
<td><em>padding-top<br />
        padding-right<br />
        padding-bottom<br />
        padding-left</em></td>
<td>1</td>
</tr>
<tr>
<td>padding-bottom</td>
<td>Sets the bottom padding of an element</td>
<td><em>length<br />
        %</em></td>
<td>1</td>
</tr>
<tr>
<td>padding-left</td>
<td>Sets the left padding of an element</td>
<td><em>length<br />
        %</em></td>
<td>1</td>
</tr>
<tr>
<td>padding-right</td>
<td>Sets the right padding of an element</td>
<td><em>length<br />
        %</em></td>
<td>1</td>
</tr>
<tr>
<td>padding-top</td>
<td>Sets the top padding of an element</td>
<td><em>length<br />
        %</em></td>
<td>1</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://jaffnacampus.com/css/css-box-model/css-padding/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS Margin</title>
		<link>http://jaffnacampus.com/css/css-box-model/css-margin/</link>
		<comments>http://jaffnacampus.com/css/css-box-model/css-margin/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 04:39:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS Box Model]]></category>
		<category><![CDATA[CSS Margin]]></category>

		<guid isPermaLink="false">http://jaffnacampus.com/?p=159</guid>
		<description><![CDATA[The CSS margin properties define the space around   elements.

Margin
The margin clears an area around an element (outside the [...]]]></description>
			<content:encoded><![CDATA[<p>The CSS margin properties define the space around   elements.</p>
<hr />
<h2>Margin</h2>
<p>The margin clears an area around an element (outside the border). The   margin   does not have a background color, and is completely transparent.</p>
<p>The top, right, bottom, and left margin can   be changed independently using separate properties. A shorthand margin   property   can also be used, to change all margins at once.</p>
<h2>Possible Values</h2>
<table border="1" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<th align="left">Value</th>
<th align="left">Description</th>
</tr>
<tr>
<td>auto</td>
<td>The browser sets the margin.<br />
        The result of this is   		dependant of the browser</td>
</tr>
<tr>
<td><em>length</em></td>
<td>Defines a fixed margin (in pixels, pt, em, etc.) </td>
</tr>
<tr>
<td><em>%</em></td>
<td>Defines a margin in % of the containing element</td>
</tr>
</tbody>
</table>
<h3>It is possible to use   negative values, to overlap content.</h3>
<hr />
<h2>Margin &#8211; Individual sides</h2>
<p>In CSS, it is possible to specify different margins for different   sides:</p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td>
<h2>Example</h2>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td> margin-top:100px;<br />
                margin-bottom:100px;<br />
                margin-right:50px;<br />
                margin-left:50px;</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<p></p>
<hr />
<h2>Margin &#8211; Shorthand property</h2>
<p>To shorten the code, it is possible to specify all the margin   properties in   one property. This is called a shorthand property.</p>
<p>The shorthand property for all the margin properties is &quot;margin&quot;:</p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td>
<h2>Example</h2>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td> margin:100px 50px;</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<p>The margin property can have from one to four values.</p>
<ul>
<li><strong>margin:25px 50px 75px 100px; </strong>
<ul>
<li>top margin is 25px</li>
<li>right margin is 50px</li>
<li>bottom margin is 75px</li>
<li>left margin is 100px</li>
</ul>
<p>
  </li>
<li><strong>margin:25px 50px 75px;</strong>
<ul>
<li>top margin is 25px</li>
<li>right and left margins are 50px</li>
<li>bottom margin is 75px</li>
</ul>
<p>
  </li>
<li><strong>margin:25px 50px;</strong>
<ul>
<li>top and bottom margins are 25px</li>
<li>right and left margins are 50px</li>
</ul>
<p>
  </li>
<li><strong>margin:25px;</strong>
<ul>
<li>all four margins are 25px</li>
</ul>
</li>
</ul>
<hr />
<h2>All CSS Margin Properties</h2>
<p>The number in the &quot;CSS&quot; column indicates in which CSS version the   property is defined (CSS1 or CSS2).</p>
<table border="1" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<th align="left" width="20%">Property</th>
<th align="left" width="50%">Description</th>
<th align="left" width="23%">Values</th>
<th align="left" width="7%">CSS</th>
</tr>
<tr>
<td>margin</td>
<td>A shorthand property for setting the margin properties in one   declaration</td>
<td><em>margin-top<br />
        margin-right<br />
        margin-bottom<br />
        margin-left</em></td>
<td>1</td>
</tr>
<tr>
<td>margin-bottom</td>
<td>Sets the bottom margin of an element</td>
<td>auto<br />
        <em>length<br />
          %</em></td>
<td>1</td>
</tr>
<tr>
<td>margin-left</td>
<td>Sets the left margin of an element</td>
<td>auto<br />
        <em>length<br />
          %</em></td>
<td>1</td>
</tr>
<tr>
<td>margin-right</td>
<td>Sets the right margin of an element</td>
<td>auto<br />
        <em>length<br />
          %</em></td>
<td>1</td>
</tr>
<tr>
<td>margin-top</td>
<td>Sets the top margin of an element</td>
<td>auto<br />
        <em>length<br />
          %</em></td>
<td>1</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://jaffnacampus.com/css/css-box-model/css-margin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS Outlines</title>
		<link>http://jaffnacampus.com/css/css-box-model/css-outlines/</link>
		<comments>http://jaffnacampus.com/css/css-box-model/css-outlines/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 04:37:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS Box Model]]></category>
		<category><![CDATA[CSS Outlines]]></category>

		<guid isPermaLink="false">http://jaffnacampus.com/?p=157</guid>
		<description><![CDATA[An outline is a line that is drawn around elements,   outside the border edge,   to make [...]]]></description>
			<content:encoded><![CDATA[<p>An outline is a line that is drawn around elements,   outside the border edge,   to make the element &quot;stand out&quot;.</p>
<p>The outline properties specifies the style, color,   and width of an outline.</p>
<hr />
<h2>All CSS Outline Properties</h2>
<p>The number in the &quot;CSS&quot; column indicates in which CSS version the   property is defined (CSS1 or CSS2).</p>
<table border="1" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<th align="left" width="20%">Property</th>
<th align="left" width="53%">Description</th>
<th align="left" width="20%">Values</th>
<th align="left" width="7%">CSS</th>
</tr>
<tr>
<td>outline</td>
<td>Sets all the outline properties in        one declaration</td>
<td><em>outline-color<br />
        outline-style<br />
        outline-width<br />
      </em>inherit</td>
<td>2</td>
</tr>
<tr>
<td> outline-color</td>
<td>Sets the color of an outline</td>
<td><em>color_name<br />
        hex_number<br />
        rgb_number<br />
        </em>invert<br />
        inherit</td>
<td>2</td>
</tr>
<tr>
<td> outline-style</td>
<td>Sets the style of an outline</td>
<td>none<br />
        dotted<br />
        dashed<br />
        solid<br />
        double<br />
        groove<br />
        ridge<br />
        inset<br />
        outset<br />
        inherit</td>
<td>2</td>
</tr>
<tr>
<td> outline-width</td>
<td>Sets the width of an outline</td>
<td>thin<br />
        medium<br />
        thick<br />
        <em>length<br />
        </em>inherit</td>
<td>2</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://jaffnacampus.com/css/css-box-model/css-outlines/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS Border</title>
		<link>http://jaffnacampus.com/css/css-box-model/css-border/</link>
		<comments>http://jaffnacampus.com/css/css-box-model/css-border/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 04:35:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS Box Model]]></category>
		<category><![CDATA[CSS Border]]></category>

		<guid isPermaLink="false">http://jaffnacampus.com/?p=155</guid>
		<description><![CDATA[
CSS Border Properties
The CSS border properties allow you to specify the style and color of   an element&#8217;s border.

Border [...]]]></description>
			<content:encoded><![CDATA[<div>
<h2>CSS Border Properties</h2>
<p>The CSS border properties allow you to specify the style and color of   an element&#8217;s border.</p>
</div>
<h2>Border Style</h2>
<p>The border-style property specifies what kind of border to display.</p>
<h3>None of the border properties will have   ANY effect unless the <strong>border-style</strong> property is set!</h3>
<h2>border-style values:</h2>
<p>none: Defines no   border</p>
<p>dotted:   Defines a dotted border</p>
<p>dashed:   Defines a dashed border</p>
<p>solid: Defines a   solid border</p>
<p>double:   Defines two borders. The width of the two borders are the same as the   border-width value</p>
<p>groove:   Defines a 3D grooved border. The effect depends on the border-color   value</p>
<p>ridge:   Defines a 3D ridged border. The effect depends on the border-color value</p>
<p>inset:   Defines a 3D inset border. The effect depends on the border-color value</p>
<p>outset:   Defines a 3D outset border. The effect depends on the border-color value</p>
<hr />
<h2>Border Width</h2>
<p>The border-width property is used to set the width of the border.</p>
<p>The width is set in pixels, or by using one of the three pre-defined   values:   thin, medium, or thick.</p>
<p><strong>Note:</strong> The &quot;border-width&quot; property does not work if it is used   alone. Use the &quot;border-style&quot; property to set the borders first.</p>
<table id="table1" border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td>
<h2>Example</h2>
<table id="table2" border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td> p.one<br />
                {<br />
                border-style:solid;<br />
                border-width:5px;<br />
                }<br />
                p.two<br />
                {<br />
                border-style:solid;<br />
                border-width:medium;<br />
                } </td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<p></p>
<hr />
<h2>Border Color</h2>
<p>The border-color property is used to set the color of the border. The   color can be set by:</p>
<ul>
<li>name &#8211; specify a color name, like &quot;red&quot;</li>
<li>RGB &#8211; specify a RGB value, like &quot;rgb(255,0,0)&quot;</li>
<li>Hex &#8211; specify a hex value, like &quot;#ff0000&quot;</li>
</ul>
<p>You can also set the border color to &quot;transparent&quot;.</p>
<p><strong>Note:</strong> The &quot;border-color&quot; property does not work if it is used   alone. Use the &quot;border-style&quot; property to set the borders first.</p>
<table id="table1" border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td>
<h2>Example</h2>
<table id="table2" border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td> p.one<br />
                {<br />
                border-style:solid;<br />
                border-color:red;<br />
                }<br />
                p.two<br />
                {<br />
                border-style:solid;<br />
                border-color:#98bf21;<br />
                } </td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<p></p>
<hr />
<h2>Border &#8211; Individual sides</h2>
<p>In CSS it is possible to specify different borders for different   sides:</p>
<table id="table17" border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td>
<h2>Example</h2>
<table id="table18" border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td> p<br />
                {<br />
                border-top-style:dotted;<br />
                border-right-style:solid;<br />
                border-bottom-style:dotted;<br />
                border-left-style:solid;<br />
                }</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<p>The example above can also be set with a single property:</p>
<table id="table17" border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td>
<h2>Example</h2>
<table id="table18" border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td> border-style:dotted solid;</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<p>The border-style property can have from one to four values.</p>
<ul>
<li><strong>border-style:dotted solid double dashed; </strong>
<ul>
<li>top border is dotted</li>
<li>right border is solid</li>
<li>bottom border is double</li>
<li>left border is dashed</li>
</ul>
<p>
  </li>
<li><strong>border-style:dotted solid double;</strong>
<ul>
<li>top border is dotted</li>
<li>right and left borders are solid</li>
<li>bottom border is double</li>
</ul>
<p>
  </li>
<li><strong>border-style:dotted solid;</strong>
<ul>
<li>top and bottom borders are dotted</li>
<li>right and left borders are solid</li>
</ul>
<p>
  </li>
<li><strong>border-style:dotted;</strong>
<ul>
<li>all four borders are dotted</li>
</ul>
</li>
</ul>
<p>The border-style property is used in the example above. However, it   also works with border-width   and border-color.</p>
<hr />
<h2>Border &#8211; Shorthand property</h2>
<p>As you can see from the examples above, there are many properties to   consider   when dealing with borders.</p>
<p>To shorten the code, it is also possible to specify all the border   properties in   one property. This is called a shorthand property.</p>
<p>The shorthand property for the border properties is &quot;border&quot;:</p>
<table id="table13" border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td>
<h2>Example</h2>
<table id="table14" border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td> border:5px solid red;</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<p> When using the border property, the order of the values are:</p>
<ul>
<li>border-width</li>
<li>border-style</li>
<li>border-color</li>
</ul>
<p>It does not matter if one of the values above are missing (although,   border-style is   required), as long as the   rest are in the specified order.</p>
<hr />
<h2>All CSS Border Properties</h2>
<p>The number in the &quot;CSS&quot; column indicates in which CSS version the   property is defined (CSS1 or CSS2).</p>
<table border="1" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<th align="left" width="25%">Property</th>
<th align="left" width="45%">Description</th>
<th align="left" width="23%">Values</th>
<th align="left" width="7%">CSS</th>
</tr>
<tr>
<td>border</td>
<td>Sets all the border properties in one declaration</td>
<td><em>border-width<br />
        border-style<br />
        border-color</em></td>
<td>1</td>
</tr>
<tr>
<td>border-bottom</td>
<td>Sets all the bottom border properties in one declaration</td>
<td><em>border-bottom-width<br />
        border-bottom-style<br />
        border-bottom-color</em></td>
<td>1</td>
</tr>
<tr>
<td>border-bottom-color</td>
<td>Sets the color of the bottom border</td>
<td><em>border-color</em></td>
<td>2</td>
</tr>
<tr>
<td>border-bottom-style</td>
<td>Sets the style of the bottom border</td>
<td><em>border-style</em></td>
<td>2</td>
</tr>
<tr>
<td>border-bottom-width</td>
<td>Sets the width of the bottom border</td>
<td><em>border-width</em></td>
<td>1</td>
</tr>
<tr>
<td>border-color</td>
<td>Sets the color of the four borders</td>
<td><em>color_name<br />
        hex_number<br />
        rgb_number<br />
        </em>transparent<br />
        inherit</td>
<td>1</td>
</tr>
<tr>
<td>border-left</td>
<td>Sets all the left border properties in one declaration</td>
<td><em>border-left-width<br />
        border-left-style<br />
        border-left-color</em></td>
<td>1</td>
</tr>
<tr>
<td>border-left-color</td>
<td>Sets the color of the left border</td>
<td><em>border-color</em></td>
<td>2</td>
</tr>
<tr>
<td>border-left-style</td>
<td>Sets the style of the left border</td>
<td><em> border-style</em></td>
<td>2</td>
</tr>
<tr>
<td>border-left-width</td>
<td>Sets the width of the left border</td>
<td><em>border-width</em></td>
<td>1</td>
</tr>
<tr>
<td>border-right</td>
<td>Sets all the right border properties in one declaration</td>
<td><em>border-right-width<br />
        border-right-style<br />
        border-right-color</em></td>
<td>1</td>
</tr>
<tr>
<td>border-right-color</td>
<td>Sets the color of the right border</td>
<td><em>border-color</em></td>
<td>2</td>
</tr>
<tr>
<td>border-right-style</td>
<td>Sets the style of the right border</td>
<td><em>border-style</em></td>
<td>2</td>
</tr>
<tr>
<td>border-right-width</td>
<td>Sets the width of the right border</td>
<td><em>border-width</em></td>
<td>1</td>
</tr>
<tr>
<td>border-style</td>
<td>Sets the style of the four borders</td>
<td>none<br />
        hidden<br />
        dotted<br />
        dashed<br />
        solid<br />
        double<br />
        groove<br />
        ridge<br />
        inset<br />
        outset<br />
        inherit</td>
<td>1</td>
</tr>
<tr>
<td>border-top</td>
<td>Sets all the top border properties in one declaration</td>
<td><em>border-top-width<br />
        border-top-style<br />
        border-top-color</em></td>
<td>1</td>
</tr>
<tr>
<td>border-top-color</td>
<td>Sets the color of the top border</td>
<td><em>border-color</em></td>
<td>2</td>
</tr>
<tr>
<td>border-top-style</td>
<td>Sets the style of the top border</td>
<td><em>border-style</em></td>
<td>2</td>
</tr>
<tr>
<td>border-top-width</td>
<td>Sets the width of the top border</td>
<td><em>border-width</em></td>
<td>1</td>
</tr>
<tr>
<td>border-width</td>
<td>Sets the width of the four borders</td>
<td>thin<br />
        medium<br />
        thick<br />
        <em>length<br />
        </em>inherit</td>
<td>1</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://jaffnacampus.com/css/css-box-model/css-border/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS Box Model</title>
		<link>http://jaffnacampus.com/css/css-box-model/css-box-model/</link>
		<comments>http://jaffnacampus.com/css/css-box-model/css-box-model/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 04:32:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS Box Model]]></category>

		<guid isPermaLink="false">http://jaffnacampus.com/?p=153</guid>
		<description><![CDATA[The CSS Box Model
All HTML elements can be considered as boxes. In CSS, the term &#34;box   model&#34; is [...]]]></description>
			<content:encoded><![CDATA[<h2>The CSS Box Model</h2>
<p>All HTML elements can be considered as boxes. In CSS, the term &quot;box   model&quot; is   used when talking about design and layout.</p>
<p>The CSS box model is essentially a box that wraps around HTML   elements, and   it consists of: margins, borders, padding, and the actual content.</p>
<p>The box model allows us to place a border around elements and space   elements   in relation to other elements.</p>
<p>The image below illustrates the box model:</p>
<p>
<img src="http://jaffnacampus.com/wp-content/image/box-model.gif" alt="" width="536" height="289" border="0" /></p>
<p>Explanation of the different parts:</p>
<ul>
<li><strong>Margin</strong> &#8211; Clears an area around the border. The margin does   not have a   	background color, and it is completely transparent</li>
<li><strong>Border</strong> &#8211; A border that lies around the padding and content.   The   	border is affected by the background color of the box</li>
<li><strong>Padding</strong> &#8211; Clears an area around the content. The   	padding is affected by the background color of the box</li>
<li><strong>Content</strong> &#8211; The content of the box, where text and images   appear</li>
</ul>
<p>In order to set the width and height of an element correctly in all   browsers,   you need to know how the box model works.</p>
<hr />
<h2>Width and Height of an Element</h2>
<p><strong>Important: </strong>When you specify the width and height properties of   an   element with CSS, you   are just setting the width and height of the content area. To know the   full size   of the element, you must also add the padding, border and margin.</p>
<p>The total width of the element in the example below is 300px:</p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td> width:250px;<br />
        padding:10px;<br />
        border:5px solid gray;<br />
        margin:10px; </td>
</tr>
</tbody>
</table>
<p>Let&#8217;s do the math:<br />
  250px (width)<br />
  + 20px (left and right padding)<br />
  + 10px (left and right border)<br />
  + 20px (left and right margin)<br />
  = 300px</p>
<p>Imagine that you only had 250px of space. Let&#8217;s make an element with a   total   width of 250px:</p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td>
<h2>Example</h2>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td> width:220px;<br />
                padding:10px;<br />
                border:5px solid gray;<br />
                margin:0px; </td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<p>The total width of an element should always be calculated like this:</p>
<p>Total element width = width + left padding + right padding + left   border + right border + left margin + right margin</p>
<p>The total height of an element should always be calculated like this:</p>
<p>Total element height = height + top padding + bottom padding + top   border + bottom border + top margin + bottom margin</p>
<hr />
<h2>Browsers Compatibility Issue</h2>
<p>If you tested the previous example in Internet Explorer, you saw that     the total width was not exactly 250px.</p>
<p>IE includes padding and border in the width, when the width property   is   set, <strong>unless a DOCTYPE is declared</strong>.</p>
<p>To fix this problem, just add a DOCTYPE to   the code:</p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td>
<h2>Example</h2>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td>&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;<br />
                &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;<br />
                &lt;html&gt;<br />
                &lt;head&gt;<br />
                &lt;style type=&quot;text/css&quot;&gt;<br />
                div.ex<br />
                {<br />
                width:220px;<br />
                padding:10px;<br />
                border:5px solid gray;<br />
                margin:0px;<br />
                }<br />
                &lt;/style&gt;<br />
                &lt;/head&gt; </td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://jaffnacampus.com/css/css-box-model/css-box-model/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

