<?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>csslearn.com &#187; backgrounds in CSS</title>
	<atom:link href="http://csslearn.com/tag/backgrounds-in-css/feed" rel="self" type="application/rss+xml" />
	<link>http://csslearn.com</link>
	<description>learn style with style</description>
	<lastBuildDate>Mon, 01 Mar 2010 02:17:37 +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>Web page backgrounds in CSS</title>
		<link>http://csslearn.com/web-page-backgrounds-in-css</link>
		<comments>http://csslearn.com/web-page-backgrounds-in-css#comments</comments>
		<pubDate>Tue, 24 Nov 2009 19:11:16 +0000</pubDate>
		<dc:creator>kunal</dc:creator>
				<category><![CDATA[CSS Basic]]></category>
		<category><![CDATA[backgrounds in CSS]]></category>

		<guid isPermaLink="false">http://csslearn.com/?p=47</guid>
		<description><![CDATA[Backgrounds are added to web page elements using a number of properties, as described
in the sections that follow.  background-color This property sets the background color of the element. In the following example, the page’s body background color has been set to #ffffff (which is hex for white):
body {
background-color: #ffffff;
}
background-image
This property sets a background image for [...]


Related posts:<ol><li><a href='http://csslearn.com/using-property-values' rel='bookmark' title='Permanent Link: Using Property Values'>Using Property Values</a> <small>Property values come in the following forms: constant text, constant...</small></li>
<li><a href='http://csslearn.com/the-css-box-model-explained' rel='bookmark' title='Permanent Link: The CSS box model explained'>The CSS box model explained</a> <small>The box model is something every designer working with CSS...</small></li>
<li><a href='http://csslearn.com/using-shorthand-properties-in-css' rel='bookmark' title='Permanent Link: Using Shorthand Properties in CSS'>Using Shorthand Properties in CSS</a> <small>Your body rule should now look like this: body {...</small></li>
</ol>

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Backgrounds are added to web page elements using a number of properties, as described<br />
in the sections that follow.  background-color This property sets the background color of the element. In the following example, the page’s body background color has been set to #ffffff (which is hex for white):</p>
<p>body {<br />
background-color: #ffffff;<br />
}</p>
<h4>background-image</h4>
<p>This property sets a background image for the relevant element:<br />
body {<br />
background-image: url(background_image.jpg);<br />
}</p>
<p>By using this CSS, you end up with a tiled background,</p>
<h4>background-repeat</h4>
<p>The properties explored so far mimic the range offered by deprecated HTML attributes, but CSS provides you with control over the background’s tiling and positioning. The background-repeat property can take four values, the default of which is repeat, creating the tiled background.</p>
<h4>background-attachment</h4>
<p>This property has two possible values: scroll and fixed. The default is scroll, in which the background works as normal, scrolling with the rest of the page. If you set the value to fixed, the background image remains stationary while the remainder of the page scrolls.</p>
<h4>background-position</h4>
<p>This property’s values set the origin of the background by using two values that relate to the horizontal and vertical position. The default background-position value is 0 0 (the top left of the web page). Along with keywords (center, left, and right for horizontal positioning; center, top, and bottom for vertical positioning), you can use percentages and pixel values. It’s possible to use a combination of percentages and pixel sizes, but you cannot mix keywords with<br />
either. Therefore, it’s recommended that designers stick with using percentages and pixel values—after all, keyword positioning can be emulated with numbers anyway (left top being the same as 0 0, for instance). When setting values, they should always be defined in the order horizontal-vertical. When using keywords, it’s also recommended to use the order horizontal-vertical, because both percentage- and pixel-based background positioning use this order, and it’s simpler to remember a single rule. In the following example, the background would be positioned on the left of the web page and positioned in the vertical center of the content:</p>
<p>body {<br />
background-image: url(background_image.gif);<br />
background-repeat: no-repeat;<br />
background-position: left center;<br />
}<br />
Again, when using percentages or pixel values, the first value relates to the horizontal position and the second to the vertical. So, to create the equivalent of the keyword example, you’d use the following CSS:<br />
body {<br />
background-image: url(background_image.gif);<br />
background-repeat: no-repeat;<br />
background-position: 0 50%;<br />
}<br />
Note, however, when using background-position with the body element, that browsers disagree slightly on where the background should be positioned vertically if the page content isn’t taller than the viewing area. Internet Explorer and Safari assume the body is the full view area height when there’s no content, thereby setting an image with a<br />
background-position value of 50% 50% directly in the center of the viewing area. Firefox and Opera instead assume the body has an effective height of 0, thereby placing the background vertically at the top of the view area (in fact, you only see the bottom half). For consistency across browsers in this case, you can define both background-position and<br />
background-attachment (as fixed), although this means the background will not scroll with the page content.</p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fcsslearn.com%2Fweb-page-backgrounds-in-css&amp;linkname=Web%20page%20backgrounds%20in%20CSS"><img src="http://csslearn.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>

<p>Related posts:<ol><li><a href='http://csslearn.com/using-property-values' rel='bookmark' title='Permanent Link: Using Property Values'>Using Property Values</a> <small>Property values come in the following forms: constant text, constant...</small></li>
<li><a href='http://csslearn.com/the-css-box-model-explained' rel='bookmark' title='Permanent Link: The CSS box model explained'>The CSS box model explained</a> <small>The box model is something every designer working with CSS...</small></li>
<li><a href='http://csslearn.com/using-shorthand-properties-in-css' rel='bookmark' title='Permanent Link: Using Shorthand Properties in CSS'>Using Shorthand Properties in CSS</a> <small>Your body rule should now look like this: body {...</small></li>
</ol></p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://csslearn.com/web-page-backgrounds-in-css/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
