<?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>Poiesis Web Development &#187; background-color</title>
	<atom:link href="http://www.poiesis.co.za/index.php/tag/background-color/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.poiesis.co.za</link>
	<description>Becasue IT matters</description>
	<lastBuildDate>Mon, 14 Jun 2010 12:33:03 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>CSS Background Properties</title>
		<link>http://www.poiesis.co.za/index.php/2009/05/css-background-properties/</link>
		<comments>http://www.poiesis.co.za/index.php/2009/05/css-background-properties/#comments</comments>
		<pubDate>Tue, 26 May 2009 19:53:44 +0000</pubDate>
		<dc:creator>Brent</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[background-attachment]]></category>
		<category><![CDATA[background-color]]></category>
		<category><![CDATA[background-image]]></category>
		<category><![CDATA[background-position]]></category>
		<category><![CDATA[background-repeat]]></category>
		<category><![CDATA[web design]]></category>

		<guid isPermaLink="false">http://www.poiesis.co.za/?p=31</guid>
		<description><![CDATA[Now that our first WordPress Theme is done, we can start discussing designing your own site. When designing your site, the first thing you need to consider your layout and your background. With CSS these can be two separate things with your background being your page and your layout being your divs that you place [...]]]></description>
			<content:encoded><![CDATA[<p>Now that <a href="http://www.poiesis.co.za/index.php/2009/05/simply-smart/">our first WordPress Theme</a> is done, we can start discussing designing your own site. When designing your site, the first thing you need to consider your layout and your background. With <strong>CSS</strong> these can be two separate things with your background being your page and your layout being your <code>div</code>s that you place and position over the page. Background properties can also be applied to your divs, but then they will be restricted to the divs that contain them. In this tutorial we&#8217;ll look at the background properties that can go in the <code>body</code> element of your <em>stylesheet.css</em> file.</p>
<h3>Backgrounds Colors</h3>
<p><span id="more-31"></span>The most common item in the <code>body</code> element is the background, which can be a solid color, an image, or both. Let&#8217;s look a common <code>background</code> property, namely <code>background-color</code>. This sets the color for the entire page and can be either one of 17 standard color names or the <strong>RGB value</strong> of the color in hexadecimal notation.</p>
<p>The 17 standard color names are:</p>
<div style="margin-left:9px;float:left;background-color:transparent;height:10px;width:10px;border:solid 1px #ccc;"></div>
<div style="margin-top:-3px;margin-left:30px;">transparent</div>
<div style="margin-left:9px;float:left;background-color:aqua;height:10px;width:10px;border:solid 1px #ccc;"></div>
<div style="margin-top:-3px;margin-left:30px;">aqua</div>
<div style="margin-left:9px;float:left;background-color:black;height:10px;width:10px;border:solid 1px #ccc;"></div>
<div style="margin-top:-3px;margin-left:30px;">black</div>
<div style="margin-left:9px;float:left;background-color:blue;height:10px;width:10px;border:solid 1px #ccc;"></div>
<div style="margin-top:-3px;margin-left:30px;">blue</div>
<div style="margin-left:9px;float:left;background-color:fuchsia;height:10px;width:10px;border:solid 1px #ccc;"></div>
<div style="margin-top:-3px;margin-left:30px;">fuchsia</div>
<div style="margin-left:9px;float:left;background-color:gray;height:10px;width:10px;border:solid 1px #ccc;"></div>
<div style="margin-top:-3px;margin-left:30px;">gray</div>
<div style="margin-left:9px;float:left;background-color:green;height:10px;width:10px;border:solid 1px #ccc;"></div>
<div style="margin-top:-3px;margin-left:30px;">green</div>
<div style="margin-left:9px;float:left;background-color:lime;height:10px;width:10px;border:solid 1px #ccc;"></div>
<div style="margin-top:-3px;margin-left:30px;">lime</div>
<div style="margin-left:9px;float:left;background-color:maroon;height:10px;width:10px;border:solid 1px #ccc;"></div>
<div style="margin-top:-3px;margin-left:30px;">maroon</div>
<div style="margin-left:9px;float:left;background-color:navy;height:10px;width:10px;border:solid 1px #ccc;"></div>
<div style="margin-top:-3px;margin-left:30px;">navy</div>
<div style="margin-left:9px;float:left;background-color:olive;height:10px;width:10px;border:solid 1px #ccc;"></div>
<div style="margin-top:-3px;margin-left:30px;">olive</div>
<div style="margin-left:9px;float:left;background-color:purple;height:10px;width:10px;border:solid 1px #ccc;"></div>
<div style="margin-top:-3px;margin-left:30px;">purple</div>
<div style="margin-left:9px;float:left;background-color:red;height:10px;width:10px;border:solid 1px #ccc;"></div>
<div style="margin-top:-3px;margin-left:30px;">red</div>
<div style="margin-left:9px;float:left;background-color:silver;height:10px;width:10px;border:solid 1px #ccc;"></div>
<div style="margin-top:-3px;margin-left:30px;">silver</div>
<div style="margin-left:9px;float:left;background-color:teal;height:10px;width:10px;border:solid 1px #ccc;"></div>
<div style="margin-top:-3px;margin-left:30px;">teal</div>
<div style="margin-left:9px;float:left;background-color:white;height:10px;width:10px;border:solid 1px #ccc;"></div>
<div style="margin-top:-3px;margin-left:30px;">white</div>
<div style="margin-left:9px;float:left;background-color:yellow;height:10px;width:10px;border:solid 1px #ccc;"></div>
<div style="margin-top:-3px;margin-left:30px;">yellow</div>
<p>These colors can be used as in <code> background-color: red;</code> to set the page color to red, or <code> background-color: blue;</code> to set the color to blue. The default color is set to transparent and will show whatever is below the current element, in this case it will show the background color of the browser, which is white by default, but can be set to another color by the user. Therefore, you should always specify a background color for your page.</p>
<p>Alternatively, you could set the page color by using the RGB values in hexadecimal notation preceded by a &#8216;<code>#</code>&#8216; as in <code>background-color: #ffffff;</code> for white or <code>background-color: #000000;</code> for black. These values use the six-digit RGB notation (<code>#rrggbb</code>). If the two-digit values for Red are the same, and the two-digit values for Green are the same, and the two-digit values for Blue are the same, as in <code>background-color: #0066cc;</code> for example, then the six-digit RGB notation can be abbreviated to the three-digit RGB notation (<code>#rgb</code>) as in <code>background-color: #06c;</code>. However, you cannot abbreviate the RGB notation if any of the three RGB color pairings have differing values. Thus, <code>background-color: #0066cf;</code> cannot be abbreviated to <code>background-color: #06cf;</code> as this has four digits. Only three or six digits are permitted.</p>
<h3>Background Image</h3>
<p>Another common background property is <code>background-image</code>, which uses the <code>url()</code> keyword to specify the path to the image as in <code>background-image: url(images/myImage.bmp)</code> for a relative path or <code>background-image: url(http://poiesis.co.za/css/images/myImage.bmp)</code> for a fixed path. But things really become interesting when using <code>background-image</code> with other <code>background </code> elements such as <code>background-position</code>, <code>background-repeat</code>, and <code>background-attachment</code>.</p>
<h4>Background-repeat</h4>
<p>The <code>background-repeat</code> property controls the repetition of the background image. This can be one of four values:</p>
<ul>
<li><code>repeat</code>, which is the default and repeats (tiles) the image both vertically and horizontally</li>
<li><code>no-repeat</code>, which does not repeat (tile) the image and results in a single background image</li>
<li><code>repeat-x</code>, which repeats (tiles) the image horizontally along the x-axis</li>
<li><code>repeat-y</code>, which default and repeats (tiles) the image vertically along the y-axis</li>
</ul>
<h4>Background-position</h4>
<p>The <code>background-position</code> property controls the horizontal and vertical positioning of the background image. This can two values; one for the <strong>horizontal position</strong> and another for the <strong>vertical position</strong>, and can be specified as values keywords, percentages or units, such as pixels or ems.</p>
<p>The keywords values are top, left, center, right and bottom and can be combined as follows:</p>
<ul>
<li><code>top left</code></li>
<li><code>top center</code></li>
<li><code>top right</code></li>
<li><code>center left</code></li>
<li><code>center center</code></li>
<li><code>center right</code></li>
<li><code>bottom left</code></li>
<li><code>bottom center</code></li>
<li><code>bottom right</code></li>
</ul>
<p>
The default values are <code>center center</code>, thus if one or more of the values are not specified, center is used. For example <code>background-position: top;</code> is the same as <code>background-position: top center;</code> and if no <code>background-position</code> is specified, <code>background-position: center center;</code> is used.</p>
<p>When a percentages are specified, they specify the position of the image in relation to the screen resolution or size of the browser window. This is useful for a liquid design. If only one value is provided, as in <code>background-position: 25%;</code> this value is read as the horizontal position and the vertical passion defaults to <code>50%</code>. However, the horizontal and vertical positions are taken from the top left corner so 0% 0% places the top left corner of the image against the top left corner of the browser window, and 100% 100% places the bottom right corner of the image against the bottom right corner of the window.</p>
<p>Units can be used to specify the exact positioning of the image from the left and top margins of the page. Thus, <code>background-position: 20px 25px;</code> places the top left edge corner of the images 20 pixels in from the left margin of the pages and 25 pixels in from the top margin. As with using percentages to specify the horizontal and vertical values; if only one value is provided, as in <code>background-position: 20px;</code> this value is read as the horizontal position and the vertical passion defaults to <code>50%</code>.</p>
<h4>Background-attachment</h4>
<p>Finally, the <code>background-attachment</code> property controls the scrolling behavior of the background images, allowing the background image to either scroll with the page or to remain static with the content scrolling over the background. As you can imagine, this property can be either <code>scroll</code>, which is the default setting and allows the background to scroll with the page content, or <code>fixed</code>, which causes the background to remain static while the page content scrolls over it.</p>
<h4>Putting it all together</h4>
<p>All four background properties can be combined into a single property using the format:</p>
<p><code>background-color background-image background-repeat background-attachment background-position</code></p>
<p>Thus, the <strong>CSS</strong> code:</p>
<p><code>background-color: aqua;<br />
background-image: url(Images/myImage.gif);<br />
background-repeat: no-repeat;<br />
background-attachment: fixed;<br />
background-position: top center;</code></p>
<p>can be replaced with the single <code>background</code> property as follows:</p>
<p><code>background: aqua url(Images/myImage.gif) no-repeat fixed top center;</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.poiesis.co.za/index.php/2009/05/css-background-properties/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
