<?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>Christina Fowler &#187; css</title>
	<atom:link href="http://christinafowler.com/tag/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://christinafowler.com</link>
	<description>Portfolio &#38; more</description>
	<lastBuildDate>Tue, 25 Oct 2011 19:30:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Horizontal stripes</title>
		<link>http://christinafowler.com/tutorial/horizontal-stripes/</link>
		<comments>http://christinafowler.com/tutorial/horizontal-stripes/#comments</comments>
		<pubDate>Fri, 05 Feb 2010 21:50:18 +0000</pubDate>
		<dc:creator>Christina</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[stripes]]></category>

		<guid isPermaLink="false">http://www.christinafowler.com/?p=236</guid>
		<description><![CDATA[In this tutorial I will show you how to create never ending horizontal stripes in your web design using CSS. View the demo &#124; Download the demo I first got the idea for horizontal stripes from Elliot Jay Stocks&#8216; book, Sexy Web Design, where he produces a web design that has horizontal stripes running off [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.christinafowler.com/demo/stripes/"><img class="alignright size-thumbnail wp-image-252" title="Picture 3" src="http://www.christinafowler.com/wp-content/uploads/2010/02/Picture-3-160x110.png" alt="" width="160" height="110" /></a>In this tutorial I will show you how to create never ending horizontal stripes in your web design using CSS.</p>
<p><a href="http://www.christinafowler.com/demo/stripes/">View the demo</a> | <a href="http://www.nodoubtscrapbook.com/stripes.zip">Download the demo</a></p>
<p>I first got the idea for horizontal stripes from <a href="http://elliotjaystocks.com/">Elliot Jay Stocks</a>&#8216; book, <a href="https://sitepoint.com/bookstore/neworderform.php?SSLSESSID=76cebc756ba0e6b9806cddc0fe048bac">Sexy Web Design</a>, where he produces a web design that has horizontal stripes running off the browser page. I then implemented it myself in the design of <a href="http://www.oldschoolnodoubt.com/">oldschoolnodoubt.com</a>.</p>
<p>More recently, <a href="http://neutroncreations.com/">Neutron Creations</a> launched a new design, again by Elliot Jay Stocks with CSS implemented by <a href="http://benbodien.info/">Ben Bodien</a> which features the effect both horizontally and vertically.<span id="more-236"></span></p>
<h2>Right stripes</h2>
<p>Here&#8217;s the html for a stripe that starts in the middle and heads off to the right side of the screen, let&#8217;s keep it simple:</p>
<pre><code>&lt;div id="container"&gt;
&lt;p class="horizontal right"&gt;Horizontal stripe&lt;/p&gt;
&lt;/div&gt;</code></pre>
<p>Here&#8217;s the css:</p>
<pre><code>.horizontal {
width:100%;
position:absolute;
margin:20px 0;
padding:20px;
}

.right {
left:50%;
margin-left:-100px;
text-align:left;
}</code></pre>
<p>Ok, let&#8217;s break down the css. Firstly <code>width:100%;</code> this will make sure that your stripe is always the width of the user&#8217;s browser so, no matter how humongous their screen is your stripes will always go off their page.</p>
<p>In order to make sure we can start the stripe from wherever we like we use <code>position:absolute;</code> and use <code>margin:20px 0;</code> to place it vertically. Finally, we use <code>padding:20px;</code> because, well, everything needs a bit of padding.</p>
<p>Now we position the stripe horizontally. For a stripe that heads off to the right we set <code>left:50%;</code> which will give you a stripe that starts in the exact center of the page and continues on forever.</p>
<p>But, I want my stripe to start off center, in fact 100px towards the left of where it is now so I set <code>margin-left:-100px;</code>. If I want it to be off center and 100px towards the right I will use <code>margin-left:100px;</code>.</p>
<p>I then align my text with <code>text-align:left;</code> because I want the text to be next to the end of the stripe.</p>
<p>At this point you probably have a long stripe that heads off in the direction you want but you also have a horizontal scrollbar and that&#8217;s rarely a good thing. So now we need to do some work on the container <code>div</code> to get rid of that scroll bar.</p>
<p>Here is the css to go with that:</p>
<pre><code>#container {
width:100%;
overflow:hidden;
position:relative;
height:200px;
}</code></pre>
<p>We want the stripes to head off the browser page so the containing <code>div</code> must be the full width of the browser with <code>width:100%;</code> and in order to get rid of the scroll bar we use <code>overflow:hidden;</code> hiding the excess of the stripe.</p>
<p>You will now have a blank screen beacuse the stripes have a <code>position:absolute;</code> and as there is no content in the containing <code>div</code> we need to set a <code>height:200px;</code> and <code>position:relative;</code> to make sure that the stripes are visible.</p>
<h2>Left stripes</h2>
<p>To acheive a stripe that starts on the left and stops in the middle I add replace the right class with a class of left on the <code>p</code>:</p>
<pre><code>&lt;div id="container"&gt;
&lt;p class="horizontal left"&gt;Horizontal stripe&lt;/p&gt;
&lt;/div&gt;</code></pre>
<p>I then reverse all the right stripe styling:</p>
<pre><code>.left {
right:50%;
margin-right:-100px;
text-align:right;
}</code></pre>
<p>Please note: If you are using an inline element (<code>span</code>, <code>strong</code>, <code>em</code>, <code>a</code>), instead of the <code>p</code> to create your stripes you will also need a <code>display:block;</code> in your css.</p>
<p><strong>19 FEB 10 &#8211; EDIT: Added a demo suitable for download.</strong></p>
<p><strong>22 FEB 10 &#8211; EDIT: Credited <a href="http://benbodien.info/">Ben Bodien</a> for the CSS implementation of <a href="http://neutroncreations.com/">Neutron Creations</a>.<br />
</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://christinafowler.com/tutorial/horizontal-stripes/feed/</wfw:commentRss>
		<slash:comments>26</slash:comments>
		</item>
	</channel>
</rss>

