<?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>internet mix &#187; background-image</title>
	<atom:link href="http://blog.ninanet.com/tag/background-image/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.ninanet.com</link>
	<description>where&#039;s the salt?</description>
	<lastBuildDate>Wed, 07 Dec 2011 01:19:08 +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>Dress up your forms (pure CSS textarea changing background)</title>
		<link>http://blog.ninanet.com/2010/03/29/dress-up-your-forms3</link>
		<comments>http://blog.ninanet.com/2010/03/29/dress-up-your-forms3#comments</comments>
		<pubDate>Mon, 29 Mar 2010 14:11:51 +0000</pubDate>
		<dc:creator>nina</dc:creator>
				<category><![CDATA[tech mix]]></category>
		<category><![CDATA[background-image]]></category>
		<category><![CDATA[CSS IE 6]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[IE 7]]></category>
		<category><![CDATA[scrolling]]></category>
		<category><![CDATA[textarea]]></category>

		<guid isPermaLink="false">http://blog.ninanet.com/?p=395</guid>
		<description><![CDATA[
3) Dress up your textareas: rounded corners, changing background &#038; fixed scrolling background IE bug
Adding a sprite with rounded corners to add textarea field is almost the exact same procedure as described in Dress up your text fields. 
With one exception: In Internet Explorer 7 the whole background image (in our case the sprite with [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.ninanet.com/wp-content/uploads/2010/03/blogpost1-150x150.jpg" alt="CSS textarea styling" title="CSS Forms" width="150" height="150" class="alignleft size-thumbnail wp-image-203" /></p>
<h3>3) Dress up your textareas: rounded corners, changing background &#038; fixed scrolling background IE bug</h3>
<p>Adding a sprite with rounded corners to add textarea field is almost the exact same procedure as described in <a href='http://blog.ninanet.com/2010/03/24/dress-up-your-forms2'>Dress up your text fields</a>. </p>
<p>With one exception: In Internet Explorer 7 the whole background image (in our case the sprite with both states) in the textarea scrolls by when a user enters text below the specified amount of rows.</p>
<p>An example form without the workaround is here: <a href='http://ninanet.com/ie7form.php'>IE7 textarea scrolling background bug</a> (you have to use IE 7 to see the effect).<br />
<span id="more-395"></span><br />
Create a basic textarea and apply a class (don&#8217;t worry about setting rows and cols, as we will override the settings via CSS):</p>
<pre class='brush:css'>
<textarea  cols="1" rows="1"  class="txtcomment"></textarea>
</pre>
<p>The following CSS is what causes the bug in IE to appear:</p>
<pre class='brush:css'>
textarea.txtcomment {
	border:0;
	overflow:hidden;
	color:#FFFFFF;
	font:1.1em  Verdana, Arial, Helvetica, sans-serif ;
	height:120px;
	width:300px;
	padding:13px;
	background:url("path-to-your-image-file") no-repeat scroll 0 0;
}

textarea.txtcomment:focus {
	background:url("path-to-your-image-file") no-repeat scroll 0 -140px;
}
</pre>
<p>As seen in previous posts, we are simply applying some basic CSS to our textarea: we set the border to 0 to prevent the browser from displaying it, we set the desired font style and size, etc.</p>
<p>By using the pseudo-class :focus which is triggered when the user clicks inside the textarea to enter text, we expect the background to change as specified in line 13. Which happens without a problem in Firefox &#038; Safari, but not in Internet Explorer 7.</p>
<p>IE 7 ignores the pseudo-class :focus, but this doesn&#8217;t seem to be the problem, as ignored declarations are simply dropped. In this case, the whole sprite we&#8217;re using as  background starts scrolling, from top to bottom, eventually showing the element&#8217;s actual background color.<br />
<a href='http://ninanet.com/ie7form.php' target='bwin'>You can see the scrolling background effect on this page</a> (use IE 7 to access it).</p>
<p>A quite simple workaround is to wrap another div around the textarea and apply the initial sprite to the outer div instead of the textarea:</p>
<pre class='brush:css'>
<div id="txt_cont"><textarea cols="1" rows="1" class="txtcomment"></textarea></div>
</pre>
<pre class='brush:css'>
#txt_cont {
	height:140px;
	width:300px;
	margin-top:10px;
	background:url("path-to-your-image-file") no-repeat scroll 0 0;
}

textarea.txtcomment {
	border:0;
	overflow:hidden;
	color:#FFFFFF;
	font:1.1em  Verdana, Arial, Helvetica, sans-serif ;
	height:120px;
	width:300px;
	padding:13px;
}

textarea.txtcomment:focus {
	background:url("path-to-your-image-file") no-repeat scroll 0 -140px;
}
</pre>
<p>We&#8217;ve removed the background-image definition from the textarea, assigned the ID #txt_cont to the outer div and set the background-image of that div to the upper portion of the sprite we initially used as a background-image for the textarea. Everything else stays the same.</p>
<div style='clear:both;height:20px'></div>
<div style="margin-top:20px;">
	<!--<div style="float:left;margin-right:10px;"><fb:send href="http%3A%2F%2Fblog.ninanet.com%2F2010%2F03%2F29%2Fdress-up-your-forms3" font=""></fb:send></div>-->
	<div style="float:left"><div id="fb-root"></div><div id="facebook_like2"> <script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script> <fb:like href=http%3A%2F%2Fblog.ninanet.com%2F2010%2F03%2F29%2Fdress-up-your-forms3 show_faces="true" width="450" send="true"></fb:like></div></div></div>]]></content:encoded>
			<wfw:commentRss>http://blog.ninanet.com/2010/03/29/dress-up-your-forms3/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Dress up your forms (pure CSS color-changing rounded corner input fields)</title>
		<link>http://blog.ninanet.com/2010/03/24/dress-up-your-forms2</link>
		<comments>http://blog.ninanet.com/2010/03/24/dress-up-your-forms2#comments</comments>
		<pubDate>Wed, 24 Mar 2010 14:41:39 +0000</pubDate>
		<dc:creator>nina</dc:creator>
				<category><![CDATA[tech mix]]></category>
		<category><![CDATA[:focus]]></category>
		<category><![CDATA[background-image]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[input]]></category>
		<category><![CDATA[text]]></category>

		<guid isPermaLink="false">http://blog.ninanet.com/?p=368</guid>
		<description><![CDATA[
2) Dress up your input/text fields: rounded corners, changing colors: The easiest way ever
What you need:
a) An image sprite (if you want the colors to change)
b) A CSS class to apply to your text fields
c) The :focus pseudo-class

Basically we are using almost the same method as in the first part of the series, Dressing up [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.ninanet.com/wp-content/uploads/2010/03/blogpost1-150x150.jpg" alt="CSS Forms" title="CSS Forms" width="150" height="150" class="alignleft size-thumbnail wp-image-203" /></p>
<h3>2) Dress up your input/text fields: rounded corners, changing colors: The easiest way ever</h3>
<p>What you need:<br />
a) An image sprite (if you want the colors to change)<br />
b) A CSS class to apply to your text fields<br />
c) The :focus pseudo-class<br />
<span id="more-368"></span><br />
Basically we are using almost the same method as in the first part of the series, <a href='http://blog.ninanet.com/2010/03/22/dress-up-your-forms1'>Dressing up your Submit button</a> in which we use the :hover pseudo-class to change the background image for the submit button when the users moves the mouse over it. </p>
<p>We cannot use the :hover class for text fields, we will be using the :focus pseudo-class instead. :focus gets triggered when a user places the cursor inside a text field (related to JavaScript&#8217;s focus() method). </p>
<p>The sprite we are using is the following:<br />
<a href="http://blog.ninanet.com/wp-includes/images//txtfld1.png" rel="wp-prettyPhoto[g368]"><img alt="Textfield Sprite" src="http://blog.ninanet.com/wp-includes/images//txtfld1.png" title="Textfield Sprite" class="alignnone" width="274" height="60" /></a></p>
<p>Let&#8217;s create a simple text input field and assign the class &#8220;txtfld&#8221; to it:</p>
<pre class='brush:css'>
<input type="text" value="" size="22" class="txtfld"/>
</pre>
<p>The CSS gives the field its refined look:</p>
<pre class='brush:css'>
.txtfld {
	font:1.1em  Verdana, Arial, Helvetica, sans-serif ;
	width:274px;
	height:24px;
	border:0;
	background:url("path-to-your-image-file") no-repeat 0 0;
	color:#FFFFFF;
}
</pre>
<p>1: Define the txtfld class<br />
2: Font declaration shorthand:<br />
enlarge font size to 1.1<br />
use Verdana, Arial, Helvetica and make sure if none of these are available that we are still using a font without serifs (sans-serif)<br />
3: Set the width of the field<br />
4: Set the height of the field<br />
5: Set the border to 0, otherwise the browser will display the default border around the element<br />
6: Shorthand background definition:<br />
Set the path to the sprite<br />
Don&#8217;t repeat the image<br />
Start displaying the image 0px from the top and 0px from the left (you can always use &#8220;top&#8221; and &#8220;left&#8221; instead of 0px &#8212; without the quotes)<br />
7: Set the font color for the text inside the field (white)</p>
<p>Similar to the technique used to change the background image for the submit button, we use another pseudo-class to change the background image when the user places the cursor inside:</p>
<pre class='brush:css'>
.txtfld:focus {
	background:url("path-to-your-image-file") no-repeat 0 -30px;
}
</pre>
<p>All this code does is tell the browser to display a different part of the sprite, starting at 0px from the left (like before) but only show the part of the image starting 30px from the top. You can use &#8220;left -30px&#8221; to achieve the same result.</p>
<p>You can see the effect when you click in one of the field in the comment form at the bottom of this post.</p>
<div style='clear:both:height:15px;'></div>
<p>Note/Disclaimer:<br />
IE 6 AND IE 7 will display the background image, but since they don&#8217;t recognize the :hover pseudo-class the background does not change.<br />
IE 7 finally does understand Alpha transparency in PNG files, but again, if you do want your form fields to look halfway decent in IE 6, create the images with a matching background. </p>
<div style='clear:both:height:20px;'></div>
<div style="margin-top:20px;">
	<!--<div style="float:left;margin-right:10px;"><fb:send href="http%3A%2F%2Fblog.ninanet.com%2F2010%2F03%2F24%2Fdress-up-your-forms2" font=""></fb:send></div>-->
	<div style="float:left"><div id="fb-root"></div><div id="facebook_like4"> <script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script> <fb:like href=http%3A%2F%2Fblog.ninanet.com%2F2010%2F03%2F24%2Fdress-up-your-forms2 show_faces="true" width="450" send="true"></fb:like></div></div></div>]]></content:encoded>
			<wfw:commentRss>http://blog.ninanet.com/2010/03/24/dress-up-your-forms2/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Dress up your forms (pure CSS submit button)</title>
		<link>http://blog.ninanet.com/2010/03/22/dress-up-your-forms1</link>
		<comments>http://blog.ninanet.com/2010/03/22/dress-up-your-forms1#comments</comments>
		<pubDate>Mon, 22 Mar 2010 20:20:20 +0000</pubDate>
		<dc:creator>nina</dc:creator>
				<category><![CDATA[tech mix]]></category>
		<category><![CDATA[background-image]]></category>
		<category><![CDATA[button]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[hover]]></category>
		<category><![CDATA[submit]]></category>

		<guid isPermaLink="false">http://blog.ninanet.com/?p=201</guid>
		<description><![CDATA[
The days where forms had to be boring are definitely over. Instead, forms can and should be part of the overall design. 
We are not designers, we just like pretty things (and pretty code). And we like it best if it all is functional and adds to the experience without limiting it. And while we [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.ninanet.com/wp-content/uploads/2010/03/blogpost1-150x150.jpg" alt="" title="CSS Forms" width="150" height="150" class="alignleft size-thumbnail wp-image-203" /><br />
The days where forms had to be boring are definitely over. Instead, forms can and should be part of the overall design. </p>
<p>We are not designers, we just like pretty things (and pretty code). And we like it best if it all is functional and adds to the experience without limiting it. And while we do use jQuery for certain effects on other sites, these a pure CSS solutions.<br />
<span id="more-201"></span><br />
Everything described here we are using in the comments form at the bottom of this page.</p>
<div style='clear:both'></div>
<h3>1) Dress up your Submit button (<em>without using input type=&quot;image&quot;</em>): The easiest way ever</h3>
<p>What you need:<br />
a) an image sprite<br />
b) a class/id to identify your submit button<br />
c) the pseudo-class :hover</p>
<p>We are using a sprite (an image containing our button&#8217;s two *states*) to avoid loading another image (plus we promised not to use any JavaScript); we are simply shifting the visible part of the image when :hover is called (the user moves the mouse over the button).</p>
<p>We are using a blank sprite (without any text); this way we can simply assign what we want to appear *on the button* to the button&#8217;s value in our HTML code instead of having to create a variety of different images. We are NOT using the <a href="http://www.alistapart.com/articles/slidingdoors//" target='bwin'>sliding doors technique</a> (first introduced in 2003) to create variable width buttons.</p>
<p>Our sprite is 150&#215;50 and will definitely accommodate the text *submit comment*:<br />
<a href='http://blog.ninanet.com/wp-includes/images/s_buttons5.png' rel="wp-prettyPhoto[g201]"><img alt="Submit sprite" src="http://blog.ninanet.com/wp-includes/images/s_buttons5.png" title="Submit sprite" class="alignnone" width="150" height="50" /></a></p>
<p>We create a submit button, and (we like it simple) add an id with the value *submit*. If you have more submit buttons on your site, create a class for them and automatically apply the definitions to all your submit buttons. Remember: an id must be unique to the page.</p>
<p>The HTML:</p>
<pre class='brush:html'>
<input type="submit" id="submit" value="submit comment" /></pre>
<p>We need some CSS:</p>
<pre class='brush:css'>
#submit {
	border:0;
	width:150px;
	height:25px;
	color:#111111;
	font-size:11px;
	background:url("path-to-the-image-file") no-repeat 0 0;
}
</pre>
<p>What is happening here?<br />
1: Add a selector for the previously assigned id &#8220;submit&#8221; (#submit).<br />
2: Set the border to 0. Otherwise, your browser will display the default border around the element.<br />
3: Set the width of the button (150px &#8211; same width as the sprite)<br />
4: Set the height of the button (50px &#8211; 50% of the sprite&#8217;s height)<br />
5: The color for the foreground font (the color you want the text on the button to be)<br />
6: The font size<br />
7: Shorthand background definitions:<br />
Path to the sprite (url)<br />
do not repeat the image<br />
start displaying the image starting at 0 px from the left and 0 px from the top (You can also use &#8220;top left&#8221; instead of 0 0).</p>
<p>In the :hover declaration for the id &#8220;submit&#8221; (#submit) we change the foreground color (the color for the text) and tell the browser to display a different part of the image: start at 0 px from the left (same as above) and 25 px from the top:</p>
<pre class='brush:css'>
#submit:hover {
	color:#a2eb41;
	background:url("path-to-the-image-file") no-repeat 0 -25px ;
}
</pre>
<div style='clear:both;height:15px'></div>
<p>Note/Disclaimer: While IE 6 will display the background image, it does not recognize Alpha transparency in PNG files. If you need to match the background-color of your element, create your sprite with a matching background.<br />
IE 6 also does NOT recognize the :hover pseudo-class. Font color and background image do not change in IE 6. IE 7 does recognize :hover, but still doesn&#8217;t recognize :focus (which we will use in the next part).</p>
<div style='clear:both;height:20px'></div>
<div style="margin-top:20px;">
	<!--<div style="float:left;margin-right:10px;"><fb:send href="http%3A%2F%2Fblog.ninanet.com%2F2010%2F03%2F22%2Fdress-up-your-forms1" font=""></fb:send></div>-->
	<div style="float:left"><div id="fb-root"></div><div id="facebook_like6"> <script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script> <fb:like href=http%3A%2F%2Fblog.ninanet.com%2F2010%2F03%2F22%2Fdress-up-your-forms1 show_faces="true" width="450" send="true"></fb:like></div></div></div>]]></content:encoded>
			<wfw:commentRss>http://blog.ninanet.com/2010/03/22/dress-up-your-forms1/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
