<?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>bravemouse</title>
	<atom:link href="http://www.bravemouse.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bravemouse.com</link>
	<description>teach yourself</description>
	<lastBuildDate>Tue, 15 Feb 2011 10:50:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>CSS Positioning Intro Part 1:  Why use CSS Positioning?</title>
		<link>http://www.bravemouse.com/2009/08/11/css-positioning-intro-part-1-why-use-css-positioning/</link>
		<comments>http://www.bravemouse.com/2009/08/11/css-positioning-intro-part-1-why-use-css-positioning/#comments</comments>
		<pubDate>Tue, 11 Aug 2009 12:18:44 +0000</pubDate>
		<dc:creator>klip</dc:creator>
				<category><![CDATA[CSS Positioning]]></category>
		<category><![CDATA[Introduction to CSS Positioning]]></category>

		<guid isPermaLink="false">http://www.bravemouse.com/?p=1259</guid>
		<description><![CDATA[This is the first post in a short series on how to use Cascading Style Sheets to control the layout of HTML web pages.  To get the most out of this series, you should already know some basic HTML &#38; CSS, which you will find in the HTML &#38; CSS Day Course. CSS Positioning is [...]]]></description>
			<content:encoded><![CDATA[<address>This is the first post in a short series on how to use Cascading Style Sheets to control the layout of HTML web pages.  To get the most out of this series, you should already know some basic HTML &amp; CSS, which you will find in the <a href="http://www.bravemouse.com/category/html-css/all-html-css-days/">HTML &amp; CSS Day Course</a>.<br />
</address>
<p>CSS Positioning is the art of using Cascading Style Sheets to control the layout of a web page.  You may already have come across CSS positioning, if you have ever tried to edit your own blog template.  Once you understand the basics of CSS positioning you will be able to edit your own blog template to  create a unique look and feel.</p>
<p>In previous posts, we saw that CSS can be used to control some aspects of your web site&#039;s &#034;look&#034;.  You can use  CSS to specify the size of text, the font used, background colours and so on. The post  &#034;<a href="../2009/06/29/4-1-what-is-css-why-use-it/">why use CSS</a>&#034;  explained how CSS can achieve a level of control not possible with other methods.  And the real power of CSS is in using it to control the entire look of your site, including the layout &#8211; CSS Positioning.<span id="more-1259"></span></p>
<p>Before CSS Positioning came along, people used tables to set the layout of a web page.  Many people still do.  But with CSS Positioning, you can achieve effects that are impossible with tables. Plus &#8211; you can change the layout  an entire website by editing a single document &#8211; your external CSS document. You may find it confusing at first but once you get used to the level of control and flexibility, you wont want to go back to table based layouts.</p>
<p>You may want to read a little bit more about &#034;table-less layouts&#034;.   Not everyone agrees with this view that &#034;tables are old fashioned&#034;.  <a href="http://www.andybudd.com/archives/2004/05/an_objective_look_at_table_based_vs_css_based_design/" target="_blank">Here is an article </a>that looks at the question.</p>
<p>Or the other side of the argument: <a href="http://www.csszengarden.com/" target="_blank"> CSS Zen Garden </a>is a site that exists solely to exhibit the benefits of CSS Positioning.  Their site states: &#034;<span>There is clearly a need for <acronym title="Cascading Style Sheets">CSS</acronym> to be taken seriously by graphic artists. The Zen Garden aims to excite, inspire, and encourage participation.&#034;  <a href="http://www.csszengarden.com/" target="_blank">Have a look</a>, and in particular, try out the &#034;select a design&#034; links on the right to see CSS in action.</span></p>
<p><span>So lets get on with it then!   The next post in this series deals with </span><span>the first concept you have to master:  &#034;The HTML Box model&#034;.<br />
</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bravemouse.com/2009/08/11/css-positioning-intro-part-1-why-use-css-positioning/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS Positioning Intro Part 2:  The Box Model</title>
		<link>http://www.bravemouse.com/2009/08/11/css-positioning-intro-part-2-the-box-model/</link>
		<comments>http://www.bravemouse.com/2009/08/11/css-positioning-intro-part-2-the-box-model/#comments</comments>
		<pubDate>Tue, 11 Aug 2009 12:18:43 +0000</pubDate>
		<dc:creator>klip</dc:creator>
				<category><![CDATA[CSS Positioning]]></category>
		<category><![CDATA[Introduction to CSS Positioning]]></category>

		<guid isPermaLink="false">http://www.bravemouse.com/?p=1268</guid>
		<description><![CDATA[Before leaping straight into how to use CSS to control your page layouts, we first need to have a closer look at how an HTML page is constructed.  I&#039;m talking about something called the &#034;HTML box model&#034;. Sound intimidating? Its actually ridiculously simple.   Understanding the box model is both essential to everything else that follows [...]]]></description>
			<content:encoded><![CDATA[<p>Before leaping straight into how to use CSS to control your page layouts, we first need to have a closer look at how an HTML page is constructed.  I&#039;m talking about something called the <em>&#034;HTML box model</em>&#034;. Sound intimidating? Its actually ridiculously simple.   Understanding the box model is both essential to everything else that follows and incredibly straight forward.</p>
<h4>What is the Box Model?</h4>
<p>The box model is just another way of explaining the <em>structure</em> of an HTML page. According to the HTML box model, every tag can be expressed as a box.  Each box can contain other boxes (in other words, other tags), or content like text or pictures.</p>
<p>Lets use the following HTML page as an example:<span id="more-1268"></span></p>
<blockquote><p>&lt;html&gt;</p>
<p style="padding-left: 30px;">&lt;head&gt;</p>
<p style="padding-left: 60px;">&lt;title&gt; poem &lt;/title&gt;</p>
<p style="padding-left: 30px;">&lt;/head&gt;</p>
<p style="padding-left: 30px;">&lt;body&gt;</p>
<p style="padding-left: 60px;">&lt;h2&gt;  Kitten &lt;/h2&gt;</p>
<p style="padding-left: 60px;">&lt;p&gt; The only problem with a kitten is that &lt;/br&gt; it eventually becomes a cat. &lt;/p&gt;</p>
<p style="padding-left: 30px;">&lt;/body&gt;</p>
<p>&lt;/html&gt;</p></blockquote>
<p>So in the above example, the biggest box of all is the &lt;html&gt; tag.  Inside that, is another &#034;box&#034;, the &lt;head&gt; tag.  This contains yet another box, the &lt;title&gt; tag.  And so on.</p>
<p>Its easier to understand if you  draw each tag as a box, like this:</p>
<p><img class="alignnone size-full wp-image-1270" title="box" src="http://www.bravemouse.com/wp-content/uploads/2009/08/box.gif" alt="box" width="286" height="319" /></p>
<p>Simple, no?</p>
<p><strong>This is the single biggest secret to understanding CSS Positioning.</strong> When constructing a page &#8211; before you do anything else &#8211; draw a HTML box model diagram of that page.  If you get that right, the rest will fall into place much more easily.</p>
<p>We arent quite ready to jump into using CSS Positioning yet.  <a href="http://www.bravemouse.com/2009/08/11/css-positioning-intro-part-3-the-div-tag/">First we need to look at a special tag &#8211; the div tag.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bravemouse.com/2009/08/11/css-positioning-intro-part-2-the-box-model/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS Positioning Intro Part 3:  The DIV tag</title>
		<link>http://www.bravemouse.com/2009/08/11/css-positioning-intro-part-3-the-div-tag/</link>
		<comments>http://www.bravemouse.com/2009/08/11/css-positioning-intro-part-3-the-div-tag/#comments</comments>
		<pubDate>Tue, 11 Aug 2009 12:00:47 +0000</pubDate>
		<dc:creator>klip</dc:creator>
				<category><![CDATA[CSS Positioning]]></category>
		<category><![CDATA[Introduction to CSS Positioning]]></category>

		<guid isPermaLink="false">http://www.bravemouse.com/?p=1273</guid>
		<description><![CDATA[In the previous post, we looked at how an HTML page structure could be expressed as a series of boxes.  In this post I want to show you a new HTML tag that is used a lot in CSS Positioning:  The div tag. CSS Positioning at its simplest, consists of two tasks: Use html to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.bravemouse.com/2009/08/11/css-positioning-intro-part-2-the-box-model/">In the previous post,</a> we looked at how an HTML page structure could be expressed as a series of boxes.  In this post I want to show you a new HTML tag that is used a lot in CSS Positioning:  The <em>div</em> tag.</p>
<p>CSS Positioning at its simplest, consists of two tasks:</p>
<ol>
<li>Use html to Divide each document up into sections .</li>
<li>Use CSS to create styles for these sections that will define where on the page they appear, and what they will look like.</li>
</ol>
<p>The <em>div</em> tag helps you with the first step; dividing the content of a page into separate sections, ready to be styled.</p>
<p>Lets look at this example again:<span id="more-1273"></span></p>
<blockquote><p>&lt;html&gt;</p>
<p style="padding-left: 30px;">&lt;head&gt;</p>
<p style="padding-left: 60px;">&lt;title&gt; poem &lt;/title&gt;</p>
<p style="padding-left: 30px;">&lt;/head&gt;</p>
<p style="padding-left: 30px;">&lt;body&gt;</p>
<p style="padding-left: 60px;">&lt;h2&gt;  Kitten &lt;/h2&gt;</p>
<p style="padding-left: 60px;">&lt;p&gt; The only problem with a kitten is that &lt;/br&gt; it eventually becomes a cat. &lt;/p&gt;</p>
<p style="padding-left: 30px;">&lt;/body&gt;</p>
<p>&lt;/html&gt;</p></blockquote>
<p>Even without any CSS, your browser will display the content of the &lt;h2&gt; tag in a larger font, and will place a line break before and after content contained within a &lt;p&gt; tag.  Its as though these tags come with their own inherent styles.  You can over-write these inherent styles easily, by re-defining the tag with a CSS definition.  For example, you could re-define the h2 tag by using the following CSS definition, which will make the text appear smaller:</p>
<p style="padding-left: 30px;">h2{<span style="color: #000000;">font-size:</span><span style="color: #ff0000;"><span style="color: #000000;">8px;</span> </span>}</p>
<p>But it would be awkward if all the tags had inherent style that had to be over-written in this way.  That is why there are some neutral tags that exist purely to indicate the beginning and end of a section, and carry no inherent style.  One such a tag is the div tag.</p>
<p>I could mark up the content in the HTML example above with a div tag like this:</p>
<blockquote><p>&lt;html&gt;</p>
<p style="padding-left: 30px;">&lt;head&gt;</p>
<p style="padding-left: 60px;">&lt;title&gt; poem &lt;/title&gt;</p>
<p style="padding-left: 30px;">&lt;/head&gt;</p>
<p style="padding-left: 30px;">&lt;body&gt;</p>
<p style="padding-left: 60px;"><span style="color: #0000ff;">&lt;div&gt; </span> Kitten <span style="color: #0000ff;">&lt;/div&gt;</span></p>
<p style="padding-left: 60px;"><span style="color: #0000ff;">&lt;div</span>&gt; The only problem with a kitten is that &lt;/br&gt; it eventually becomes a cat. <span style="color: #0000ff;">&lt;/div&gt;</span></p>
<p style="padding-left: 30px;">&lt;/body&gt;</p>
<p>&lt;/html&gt;</p></blockquote>
<p>My first problem is: how can I get the heading (&#034;Kitten&#034;) to display bigger than the content (&#034;The only problem&#8230;&#034;)? One way would be to <a href="http://www.bravemouse.com/2009/06/29/4-4-redefine-existing-tags-and-create-your-own-class/">re-define the div tag with a CSS rule </a>like this:</p>
<p style="padding-left: 30px;">div{<span style="color: #000000;">font-size:14px </span>}</p>
<p>Then all the content in all div tags on the page will be styled by the same rule &#8211; in this case, both the heading and the content will appear bigger.  This is a problem, as I want only the heading to be bigger, and the body copy of the poem to be formatted quite differently.</p>
<p>So a rule that re-defines the tag does not work for me. Instead, I should define my own <em>class,</em> and then I can apply the class to any tag, as I see fit. You can read more about <a href="http://www.bravemouse.com/2009/06/29/4-4-redefine-existing-tags-and-create-your-own-class/">defining your own class here.</a></p>
<p>In this example, I create my own classes by writing the following CSS definitions:</p>
<p style="padding-left: 30px;"><span style="color: #000000;">.larger{font-size:14px }</span></p>
<p style="padding-left: 30px;"><span style="color: #000000;">.smaller{font-size:10px }</span></p>
<p>Then I  put the references to my new classes into the appropriate div tags in the HTML document like so:</p>
<p style="padding-left: 60px;">&lt;div <span style="color: #0000ff;">class = &#034;larger&#034;</span>&gt;  Kitten &lt;/div&gt;</p>
<p style="padding-left: 60px;">&lt;div<span style="color: #0000ff;"> class = &#034;smaller&#034;</span>&gt; The only problem with a kitten is that &lt;/br&gt; it eventually becomes a cat. &lt;div&gt;</p>
<p>The div tag is useful because it does not carry its own inherent style.  You can use it to divide your content, ready to be styled.</p>
<p>So you know about the HTML box model, and you also know how to use div tags to mark up your content. In the <a href="http://www.bravemouse.com/2009/08/11/css-positioning-intro-part-4-width-and-background-colour/">next post</a> we are going to do some actual CSS Positioning.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bravemouse.com/2009/08/11/css-positioning-intro-part-3-the-div-tag/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS Positioning Intro Part 4:  Width and Background Colour</title>
		<link>http://www.bravemouse.com/2009/08/11/css-positioning-intro-part-4-width-and-background-colour/</link>
		<comments>http://www.bravemouse.com/2009/08/11/css-positioning-intro-part-4-width-and-background-colour/#comments</comments>
		<pubDate>Tue, 11 Aug 2009 11:30:52 +0000</pubDate>
		<dc:creator>klip</dc:creator>
				<category><![CDATA[CSS Positioning]]></category>
		<category><![CDATA[Introduction to CSS Positioning]]></category>

		<guid isPermaLink="false">http://www.bravemouse.com/?p=1287</guid>
		<description><![CDATA[In this post we are finally going to do some CSS positioning.  We will start by creating a simple page that looks like this: OK &#8211; very simple layout indeed!  But we are starting with basics here.  Soon things will get more complicated.  For the moment, what we are trying to achieve is to have [...]]]></description>
			<content:encoded><![CDATA[<p>In this post we are finally going to do some CSS positioning.  We will start by creating a simple page that looks like this:</p>
<p><img class="alignnone size-full wp-image-1335" title="cssposwidth" src="http://www.bravemouse.com/wp-content/uploads/2009/08/cssposwidth.gif" alt="cssposwidth" width="413" height="308" /></p>
<p>OK &#8211; very simple layout indeed!  But we are starting with basics here.  Soon things will get more complicated.  For the moment, what we are trying to achieve is to have two poems, each with a box around it. We will specify what the width of the box is, and what its background colour should be.</p>
<p>You&#039;ve got to crawl before you walk! <img src='http://www.bravemouse.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<address><a href="http://www.bravemouse.com/wp-content/uploads/2009/08/widths.zip">You can download all files used in this exercise here.</a></address>
<p>The HTML for this page looks like this:<span id="more-1287"></span></p>
<blockquote>
<p style="padding-left: 30px;">&lt;html&gt;</p>
<p style="padding-left: 60px;">&lt;head&gt;</p>
<p style="padding-left: 90px;">&lt;title&gt;A Poem &lt;/title&gt;</p>
<p style="padding-left: 90px;"><span style="color: #0000ff;">&lt;link rel=&#034;stylesheet&#034; type=&#034;text/css&#034; href=&#034;style1.css&#034; /&gt;</span></p>
<p style="padding-left: 60px;">&lt;/head&gt;<br />
&lt;body&gt;</p>
<p style="padding-left: 90px;">&lt;div class = <span style="color: #ff00ff;">&#034;redbox&#034;</span>&gt;</p>
<p style="padding-left: 120px;">&lt;div class =<span style="color: #ff00ff;"> &#034;heading&#034;</span>&gt;Peas&lt;/div&gt;</p>
<p>&lt;div class = &#034;<span style="color: #ff00ff;">poem&#034;</span>&gt; I eat my peas with honey &lt;br&gt;<br />
I&#039;ve done it all my life &lt;br&gt;<br />
It makes them taste quite funny &lt;br&gt;<br />
but it keeps them on my knife.<br />
&lt;/div&gt;</p>
<p style="padding-left: 90px;">&lt;/div&gt;</p>
<p>&lt;div class = <span style="color: #ff00ff;">&#034;bluebox&#034;</span>&gt;</p>
<p style="padding-left: 120px;">&lt;div class = &#034;<span style="color: #ff00ff;">heading&#034;</span>&gt; Horse&lt;/div&gt;</p>
<p>&lt;div class = <span style="color: #ff00ff;">&#034;poem&#034;</span>&gt;The horse bit his master &lt;br&gt;<br />
How came this to pass? &lt;br&gt;<br />
It heard the good pastor say:&lt;br&gt;<br />
&#034;All flesh is grass&#034;</p>
<p style="padding-left: 90px;">&lt;/div&gt;</p>
<p style="padding-left: 60px;">&lt;/body&gt;</p>
<p style="padding-left: 30px;">&lt;/html&gt;</p>
</blockquote>
<p>And the CSS looks like this:</p>
<blockquote><p><span style="color: #ff00ff;">.redbox </span>{width:400px;<br />
background-color:#DC143C;<br />
}</p>
<p>.<span style="color: #ff00ff;">bluebox</span> {width:400px;<br />
background-color:#1E90FF;}</p>
<p>.<span style="color: #ff00ff;">heading</span>{font-size: 2em;<br />
font-family:Arial;<br />
font-weight:bold;}</p>
<p>.<span style="color: #ff00ff;">poem</span>{font-size:1.5em;<br />
font-family:Arial}</p></blockquote>
<p><strong>Notice the following:</strong></p>
<p><strong>In the HTML document:<br />
</strong></p>
<ul>
<li>In the head section of the HTML, you find the reference to the external CSS style sheet.  <span style="color: #0000ff;">&lt;link rel=&#034;stylesheet&#034; type=&#034;text/css&#034; href=&#034;style1.css&#034; /&gt;  <span style="color: #000000;">From this, you can see that all the CSS styles have been saved in an external style sheet with the file name style1.css<br />
</span></span></li>
<li><span style="color: #0000ff;"><span style="color: #000000;">The HTML text has been carefully divided by div tags, according to how it will be displayed.For example: Since the heading of each poem must look different from the rest of the text &#8211; a bit bigger and bolder &#8211; it was necessary to create separate div tags for each heading.    If the plan was that the headings should look just like the rest of the poem &#8211; we could have created a single div tag around the heading and the poem.
<p></span></span></li>
<li><span style="color: #0000ff;"><span style="color: #000000;">Each div tag has been linked to a </span></span><span style="color: #0000ff;"><span><br />
</span></span></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.bravemouse.com/2009/08/11/css-positioning-intro-part-4-width-and-background-colour/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS Positioning Intro Part 5:  Margins and Padding</title>
		<link>http://www.bravemouse.com/2009/08/11/css-positioning-intro-part-5-margins-and-padding/</link>
		<comments>http://www.bravemouse.com/2009/08/11/css-positioning-intro-part-5-margins-and-padding/#comments</comments>
		<pubDate>Tue, 11 Aug 2009 11:20:51 +0000</pubDate>
		<dc:creator>klip</dc:creator>
				<category><![CDATA[CSS Positioning]]></category>
		<category><![CDATA[Introduction to CSS Positioning]]></category>
		<category><![CDATA[margin]]></category>
		<category><![CDATA[padding]]></category>

		<guid isPermaLink="false">http://www.bravemouse.com/?p=1291</guid>
		<description><![CDATA[In the previous post you learned the bare bones basics of how to specify the width of an element.  It did not look great.  For one thing,  the text looked uncomfortably squashed right up to the edge of each box.  Lets insert some breathing space for the text.  We will also complicate things a bit [...]]]></description>
			<content:encoded><![CDATA[<p>In the <a href="http://www.bravemouse.com/2009/08/11/css-positioning-intro-part-4-width-and-background-colour/">previous post</a> you learned the bare bones basics of how to specify the width of an element.  It did not look great.  For one thing,  the text looked uncomfortably squashed right up to the edge of each box.  Lets insert some breathing space for the text.  We will also complicate things a bit more by adding another element &#8211; a framing box. The example page will look like this:</p>
<p><img class="alignnone size-full wp-image-1336" title="marginpadding" src="http://www.bravemouse.com/wp-content/uploads/2009/08/marginpadding.gif" alt="marginpadding" width="481" height="376" /></p>
<p>We will need two new CSS properties to create this &#034;breathing space&#034; &#8211; <strong>margin</strong> and <strong>padding</strong>.</p>
<address><a href="http://www.bravemouse.com/wp-content/uploads/2009/08/margins_padding.zip">You can download the files used in this exercise here.</a></address>
<h3>Margin</h3>
<p>Remember the html box model?  <em>Each set of tags is like a box.  Each tag-box can be nested inside other tag-boxes, or have tag-boxes nested inside them</em>.</p>
<p>The &#034;margin&#034; property specifies the distance that a tag-box must be  from the tag-box <em>it is inside of.</em></p>
<p>For example &#8211; if I had HTML like this:<span id="more-1291"></span></p>
<blockquote><p>&lt;div class = &#034;black&#034;&gt;</p>
<p style="padding-left: 30px;">&lt;div class = &#034;red&#034;&gt;  &lt;/div&gt;</p>
<p>&lt;/div&gt;</p></blockquote>
<p>The &#034;red&#034; div tag is nested inside the &#034;black&#034; div tag, right?</p>
<p>If I wrote a CSS definition for the &#034;red&#034; div tag like this:</p>
<p style="padding-left: 30px;">.red{margin:5px; }</p>
<p>This CSS definition gives the &#034;red&#034; box a margin of 5 pixels wide.</p>
<p>That specifies the distance that the &#034;red&#034; box must be positioned from its containing element &#8211; the &#034;black&#034; div.</p>
<p>Without a margin, the red box would sit right up against the edge of the black box.  The margin property ensures that there is a certain distance between the outer edge of the red box and the black box it is inside of.  Like this:</p>
<p><img class="alignnone size-full wp-image-1297" title="margin" src="http://www.bravemouse.com/wp-content/uploads/2009/08/margin.gif" alt="margin" width="459" height="157" /></p>
<h3>Padding</h3>
<p>&#034;Padding&#034; specifies how much distance there should be between and element  and whatever it contains.  Lets look at a slightly different example:</p>
<blockquote><p>&lt;div class = &#034;black&#034;&gt;</p>
<p style="padding-left: 30px;">&lt;div class = &#034;red&#034;&gt;text &lt;/div&gt;</p>
<p>&lt;/div&gt;</p></blockquote>
<p>If we wrote the following CSS definition:</p>
<p>.red{<br />
margin: 5px;<br />
<span style="color: #0000ff;">padding</span>:5px;<br />
}</p>
<p>We know that the <span style="color: #0000ff;">padding </span>property specifies the distance between an element (&#034;red&#034;) and whatever it contains (some text).  Padding would look like this:</p>
<p><img class="alignnone size-full wp-image-1298" title="padding" src="http://www.bravemouse.com/wp-content/uploads/2009/08/padding.gif" alt="padding" width="460" height="155" /></p>
<h4>Applying Margin and Padding in your own example</h4>
<p>Back to the example layout.  We are attempting to achieve a layout like this:</p>
<p><img title="pos2" src="http://www.bravemouse.com/wp-content/uploads/2009/08/pos2.gif" alt="pos2" width="488" height="390" /></p>
<p>We have quite a few boxes (remember, each tag set is considered to be a box).</p>
<p>The HTML for this page looks like this:</p>
<blockquote><p>&lt;html&gt;</p>
<p style="padding-left: 30px;">&lt;head&gt;</p>
<p style="padding-left: 60px;">&lt;title&gt;A Poem &lt;/title&gt;</p>
<p style="padding-left: 30px;">&lt;link href=&#034;style1.css&#034; rel=&#034;stylesheet&#034; type=&#034;text/css&#034;&gt;<br />
&lt;/head&gt;</p>
<p>&lt;body&gt;</p>
<p style="padding-left: 30px;"><span style="color: #0000ff;">&lt;div class = &#034;container&#034;&gt;</span></p>
<p style="padding-left: 60px;">&lt;div class = &#034;redbox&#034;&gt;</p>
<p style="padding-left: 90px;">&lt;div class = &#034;heading&#034;&gt;Peas&lt;/div&gt;</p>
<p style="padding-left: 90px;">&lt;div class = &#034;poem&#034;&gt; I eat my peas with honey &lt;br&gt;<br />
I’ve done it all my life &lt;br&gt;<br />
It makes them taste quite funny &lt;br&gt;<br />
but it keeps them on my knife.<br />
&lt;/div&gt;</p>
<p style="padding-left: 60px;">&lt;/div&gt;</p>
<p>&lt;div class = <span style="color: #ff00ff;">&#034;bluebox&#034;</span>&gt;</p>
<p style="padding-left: 120px;">&lt;div class = &#034;<span style="color: #ff00ff;">heading&#034;</span>&gt; Horse&lt;/div&gt;</p>
<p>&lt;div class = <span style="color: #ff00ff;">&#034;poem&#034;</span>&gt;The horse bit his master &lt;br&gt;<br />
How came this to pass? &lt;br&gt;<br />
It heard the good pastor say:&lt;br&gt;<br />
&#034;All flesh is grass&#034;</p>
<p style="padding-left: 90px;">&lt;/div&gt;</p>
<p style="padding-left: 60px;">&lt;/div&gt;</p>
<p style="padding-left: 30px;">&lt;/div&gt;</p>
<p>&lt;/body&gt;</p>
<p>&lt;/html&gt;</p></blockquote>
<p>The CSS sheet looks like this:</p>
<blockquote><p>.container{<br />
width:450px;<br />
background-color:#000000;<br />
<span style="color: #ff00ff;">padding:10px; </span><br />
}</p>
<p>.redbox {<br />
background-color:#DC143C;<br />
<span style="color: #ff00ff;">padding:5px;<br />
margin:10px;</span><br />
}</p>
<p>.bluebox {<br />
background-color:#1E90FF;<br />
<span style="color: #ff00ff;">padding:5px;<br />
margin:10px;</span><br />
}</p>
<p>.heading{font-size: 2em;<br />
font-family:Arial;<br />
font-weight:bold;<br />
}</p>
<p>.poem{font-size:1.5em;<br />
font-family:Arial;<br />
}</p></blockquote>
<p>Note the following (you may want to compare this with the previous example):</p>
<ul>
<li>In the HTML document: there is a new div tag (&#034;<span style="color: #0000ff;">container</span>&#034;).  This is to create the black area that encloses both &#034;redbox&#034; and &#034;bluebox&#034;.  I included this simply to demonstrate margins and padding more clearly.</li>
<li>You did not have to specify the width of the red or blue boxes. That is because you did specify the width of the black box that contains both of them.  They will expand to fit inside the black box.</li>
<li>Two new properties have been used in the CSS definitions:  Margin and Padding.</li>
<li>The &#034;container&#034; class  has a padding property.  The elements inside the &#034;container&#034; div (like &#034;redbox&#034; for example&#034;) have a margin property.  This means that the total distance between the edge of the &#034;container&#034; div and the elements inside it, is the sum of their padding and margin properties like so:</li>
</ul>
<p><img class="alignnone size-full wp-image-1300" title="margin2" src="http://www.bravemouse.com/wp-content/uploads/2009/08/margin21.gif" alt="margin2" width="480" height="212" /></p>
<p>Next we look at how to create a <a href="http://www.bravemouse.com/2009/08/11/css-positioning-intro-part-6-calculating-columns/">simple layout with columns.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bravemouse.com/2009/08/11/css-positioning-intro-part-5-margins-and-padding/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS Positioning Intro Part 6: Calculating Columns</title>
		<link>http://www.bravemouse.com/2009/08/11/css-positioning-intro-part-6-calculating-columns/</link>
		<comments>http://www.bravemouse.com/2009/08/11/css-positioning-intro-part-6-calculating-columns/#comments</comments>
		<pubDate>Tue, 11 Aug 2009 11:10:36 +0000</pubDate>
		<dc:creator>klip</dc:creator>
				<category><![CDATA[CSS Positioning]]></category>
		<category><![CDATA[Introduction to CSS Positioning]]></category>
		<category><![CDATA[columns]]></category>

		<guid isPermaLink="false">http://www.bravemouse.com/?p=1340</guid>
		<description><![CDATA[This series has covered some of the CSS properties that control the layout of a page.  We looked at how to set the width of a page element and how to set margins and padding to create space between page elements. But so far we can only set up the most basic of layouts &#8211; [...]]]></description>
			<content:encoded><![CDATA[<p>This series has covered some of the CSS properties that control the layout of a page.  We looked at how to set the width of a page element and how to set margins and padding to create space between page elements.</p>
<p>But so far we can only set up the most basic of layouts &#8211; rows that appear one below the other.  What about columns? How do you make a picture or paragraph appear next to another page element?</p>
<p>In this post, we will create a basic layout with one row and two columns:</p>
<p><img class="alignnone size-full wp-image-1344" title="coll" src="http://www.bravemouse.com/wp-content/uploads/2009/08/coll.gif" alt="coll" width="470" height="300" /></p>
<h4>Calculating the widths:<span id="more-1340"></span></h4>
<p>Before we write any CSS, we first need to calculate the widths and other measurements that this page must have.</p>
<p>The layout above already has the following properties:</p>
<ul>
<li>The outside black box has a width of 450 px and a padding of 10px.</li>
<li>The blue and green columns have margins of 10px each.</li>
</ul>
<p>All that is left is to figure out how wide each column should be so that they fit exactly inside the black box.</p>
<p>We can do it like this:<br />
Take the width of the outside box (450 px) .  Subtract from that all the margin and padding properties added together (450 px &#8211; 60 px = 390px).  Divide the result in two, because there are two columns (390 px /2 = 195 px) .</p>
<p><img class="alignnone size-full wp-image-1345" title="floatsum" src="http://www.bravemouse.com/wp-content/uploads/2009/08/floatsum.gif" alt="floatsum" width="454" height="202" /></p>
<p>To fit exactly inside the black container box, each of the columns should be 195 px wide.</p>
<p>Before we plug those values into a CSS definition, lets have a quick look at what the HTML looks like:</p>
<h4>The HTML</h4>
<p>The HTML for this page looks like this:</p>
<blockquote><p>&lt;html&gt;<br />
&lt;head&gt;</p>
<p>&lt;title&gt;A Poem &lt;/title&gt;</p>
<p>&lt;link href=&#034;floatstyle.css&#034; rel=&#034;stylesheet&#034; type=&#034;text/css&#034;&gt;<br />
&lt;/head&gt;</p>
<p>&lt;body&gt;</p>
<p>&lt;div class = &#034;container&#034;&gt;</p>
<p>&lt;div class = &#034;redbox&#034;&gt;</p>
<p>&lt;div class = &#034;heading&#034;&gt;Peas&lt;/div&gt;</p>
<p>&lt;div class = &#034;poem&#034;&gt; I eat my peas with honey &lt;br&gt;<br />
I&#039;ve done it all my life &lt;br&gt;<br />
It makes them taste quite funny &lt;br&gt;<br />
but it keeps them on my knife.<br />
&lt;/div&gt;</p>
<p>&lt;/div&gt;</p>
<p>&lt;div class = &#034;bluebox&#034;&gt;</p>
<p>&lt;div class = &#034;heading&#034;&gt; Horse&lt;/div&gt;</p>
<p>&lt;div class = &#034;poem&#034;&gt;The horse bit its master. &lt;br&gt; How came this to pass? &lt;br&gt;It heard the good pastor say&lt;br&gt; &amp;quot;All flesh is grass&amp;quot;.&lt;/div&gt;</p>
<p>&lt;/div&gt;</p>
<p>&lt;div class = &#034;greenbox&#034;&gt;</p>
<p>&lt;div class = &#034;heading&#034;&gt;Justice&lt;/div&gt;</p>
<p>&lt;div class = &#034;poem&#034;&gt;The rain, it raineth every day &lt;br&gt; Upon the just and unjust fella &lt;br&gt;But it raineth more upon the just&lt;br&gt;<br />
Because the unjust hath the just&#039;s umbrella.&lt;/div&gt;</p>
<p>&lt;/div&gt;<br />
&lt;div class = &#034;stretch&#034;&gt; &lt;/div&gt;</p>
<p>&lt;/div&gt;</p>
<p>&lt;/body&gt;</p>
<p>&lt;/html&gt;</p></blockquote>
<h3>The CSS</h3>
<p>If we put the width we calculated into the CSS definitions, we get this:</p>
<blockquote><p>.container{<br />
width:450px;<br />
background-color:#000000;<br />
padding:10px;<br />
}</p>
<p>.redbox {<br />
background-color:#DC143C;<br />
padding:5px;<br />
margin:10px;<br />
}</p>
<p>.bluebox {width:<span style="color: #3366ff;">195px</span>;<br />
background-color:#1E90FF;<br />
padding:5px;<br />
margin:10px;<br />
}</p>
<p>.greenbox {width:<span style="color: #3366ff;"><span style="color: #3366ff;">195px</span><span style="color: #000000;">;</span></span><br />
background-color:#009966;<br />
padding:5px;<br />
margin:10px;<br />
}<br />
.heading{font-size: 2em;<br />
font-family:Arial;<br />
font-weight:bold;<br />
}</p>
<p>.poem{<br />
font-size:0.8em;<br />
font-family:Arial;<br />
}</p></blockquote>
<p>This will result in a layout like this:</p>
<p><img class="alignnone size-full wp-image-1351" title="coll2" src="http://www.bravemouse.com/wp-content/uploads/2009/08/coll2.gif" alt="coll2" width="470" height="410" /></p>
<p>Which is not what we want.  Yes, the boxes are all the right widths, but that green box needs to pop up next to the blue box.  To do that, we will use a new property &#8211; the &#034;float&#034; property &#8211; which is explained in the <a href="http://www.bravemouse.com/2009/08/11/css-positioning-intro-part-7-float-and-clear/">next post.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bravemouse.com/2009/08/11/css-positioning-intro-part-6-calculating-columns/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS Positioning Intro Part 7: Float and Clear</title>
		<link>http://www.bravemouse.com/2009/08/11/css-positioning-intro-part-7-float-and-clear/</link>
		<comments>http://www.bravemouse.com/2009/08/11/css-positioning-intro-part-7-float-and-clear/#comments</comments>
		<pubDate>Tue, 11 Aug 2009 11:00:29 +0000</pubDate>
		<dc:creator>klip</dc:creator>
				<category><![CDATA[CSS Positioning]]></category>
		<category><![CDATA[Introduction to CSS Positioning]]></category>
		<category><![CDATA[clear]]></category>
		<category><![CDATA[float]]></category>

		<guid isPermaLink="false">http://www.bravemouse.com/?p=1366</guid>
		<description><![CDATA[This is the last post in the &#034;Introduction to CSS Positioning&#034; series.  We look at two new properties that will help us create layouts with columns: &#034;float&#034; and &#034;clear&#034;. You can download the files used in this exercise here. The Float Property Floats take a bit of getting used to.  They are counter-intuitive and can [...]]]></description>
			<content:encoded><![CDATA[<p>This is the last post in the &#034;Introduction to CSS Positioning&#034; series.  We look at two new properties that will help us create layouts with columns: &#034;float&#034; and &#034;clear&#034;.</p>
<address><a href="http://www.bravemouse.com/wp-content/uploads/2009/08/float1.zip">You can download the files used in this exercise here.</a></address>
<h4>The Float Property</h4>
<p>Floats take a bit of getting used to.  They are counter-intuitive and can be confusing.  In this post we will apply them without delving too much into the theory behind them &#8211; lets learn by doing.</p>
<p><em>The float property makes an element move as far as it can to the right or left side of whatever contains it.<br />
</em></p>
<p>So lets try it out.  <span id="more-1366"></span>You may think the thing to do is to make the green box &#034;float&#034; to the right &#8211; but actually, we are going to float both the blue and the green boxes to the left, and the result will be two perfect columns.  Wait and see.</p>
<p>First &#8211; we float the blue box to the left like this:</p>
<blockquote><p>.bluebox {width:195px;<br />
background-color:#1E90FF;<br />
padding:5px;<br />
margin:10px;<br />
<span style="color: #3366ff;">float:left;</span><br />
}</p></blockquote>
<p>Let&#039;s see what effect his has on the layout:</p>
<p><img title="coll3" src="http://www.bravemouse.com/wp-content/uploads/2009/08/coll3.gif" alt="coll3" width="469" height="417" /></p>
<p>Yikes!  That&#039;s not quite what we had in mind.  The green box has shifted up, but it has slipped in behind the blue box.  Why is that?</p>
<p>When you float a page element, it acts as though it has been partially &#034;lifted&#034; out of the html box model, and this changes the way other page elements interact with it.  In this case the green box behaves as though the blue box is no longer there &#8211; it moves to the left just as it would if you had deleted the blue box.  (Notice that the text inside the green box still moves down to make space for the blue box.)</p>
<p>So obviously there is more work to be done here before we have our nicely floating column layout.  To get the green box to sit next to the blue box, we will float it as well.  In this example, we will float it left by adding the same property to the .greenbox style rule:</p>
<p>.greenbox {<br />
width:195px;<br />
background-color:#009966;<br />
padding:5px;<br />
margin:10px;<br />
<span style="color: #3366ff;">float:left;</span><br />
}</p>
<div>But this is still not perfect, as it gives us the following result:</div>
<div><a href="http://www.bravemouse.com/wp-content/uploads/2009/08/float.gif"><img class="alignnone size-full wp-image-1434" title="float" src="http://www.bravemouse.com/wp-content/uploads/2009/08/float.gif" alt="" width="492" height="317" /></a></div>
<p>The &#034;container&#034; div tag now behaves as though the .greenbox and .bluebox div tags are no longer inside it, and has snapped up.  We would like it to stretch down to surround those two div tags.</p>
<p>The simplest way to do this, is to add one last, empty div tag below the .greenbox div tag, and use CSS to style this new div tag so that the float attributes of the two div tags above it is &#034;cleared&#034;.  Since this last div tag does not have a &#034;float&#034; attribute, the .container div tag will stretch down to contain it, and so also contain any div tags that appear above it in the HTML structure.</p>
<p>So &#8211; in the .html file, we add the following div tag below the .greenbox div, but still inside the .container div:</p>
<div class="greenbox">
<div class="heading">
<div id="_mcePaste">&lt;div class = &#034;greenbox&#034;&gt;</div>
<div id="_mcePaste">&lt;div class = &#034;heading&#034;&gt;Justice&lt;/div&gt;</div>
<div id="_mcePaste">&lt;div class = &#034;poem&#034;&gt;The rain, it raineth every day &lt;br&gt; Upon the just and unjust fella &lt;br&gt;But it raineth more upon the just&lt;br&gt;</div>
<div id="_mcePaste">Because the unjust hath the just&#039;s umbrella.&lt;/div&gt;</div>
<div id="_mcePaste">&lt;/div&gt;</div>
<div id="_mcePaste"><span style="color: #3366ff;">&lt;div class = &#034;stretch&#034;&gt; &lt;/div&gt;</span></div>
<div id="_mcePaste">&lt;/div&gt;</div>
</div>
</div>
<p>And in the CSS, the following rule:</p>
<p><span style="color: #3366ff;">.stretch{<br />
clear:both;<br />
}</span></p>
<p>And that should result in a layout like this:</p>
<p><img class="alignnone size-full wp-image-1344" style="border: 0px initial initial;" title="coll" src="http://www.bravemouse.com/wp-content/uploads/2009/08/coll.gif" alt="coll" width="470" height="300" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bravemouse.com/2009/08/11/css-positioning-intro-part-7-float-and-clear/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flash: Create a Spotlight Effect with a Mask Layer</title>
		<link>http://www.bravemouse.com/2009/08/06/flash-create-a-spotlight-effect-with-a-mask-layer/</link>
		<comments>http://www.bravemouse.com/2009/08/06/flash-create-a-spotlight-effect-with-a-mask-layer/#comments</comments>
		<pubDate>Thu, 06 Aug 2009 07:53:55 +0000</pubDate>
		<dc:creator>klip</dc:creator>
				<category><![CDATA[Animating in Flash]]></category>
		<category><![CDATA[mask layer]]></category>

		<guid isPermaLink="false">http://www.bravemouse.com/?p=1228</guid>
		<description><![CDATA[A while ago, I wrote a post about Mask Layers.  Here is the answer to the second challenge in that post: Create a Spotlight Effect using a mask layer. (Click on the play button below to see the animation.) 
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_spotlightmask_282222812"
			class="flashmovie"
			width="134"
			height="179">
	<param name="movie" value="http://www.bravemouse.com/wp-content/uploads/2009/07/spotlightmask.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.bravemouse.com/wp-content/uploads/2009/07/spotlightmask.swf"
			name="fm_spotlightmask_282222812"
			width="134"
			height="179">
	<!--<![endif]-->
		 
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object> Create the Images First you need two versions [...]]]></description>
			<content:encoded><![CDATA[<p>A while ago, I wrote <a href="http://www.bravemouse.com/2009/07/27/flash-work-with-mask-layers/">a post about Mask Layers</a>.  Here is the answer to the second challenge in that post: <em>Create a Spotlight Effect using a mask layer. </em>(Click on the play button below to see the animation.)</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_spotlightmask_2085778895"
			class="flashmovie"
			width="134"
			height="179">
	<param name="movie" value="http://www.bravemouse.com/wp-content/uploads/2009/07/spotlightmask.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.bravemouse.com/wp-content/uploads/2009/07/spotlightmask.swf"
			name="fm_spotlightmask_2085778895"
			width="134"
			height="179">
	<!--<![endif]-->
		<a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<h3>Create the Images<span id="more-1228"></span></h3>
<p>First you need two versions of the same image.  Use an image editor like Photoshop to make the one a bit darker than the other, like this:</p>
<p><img class="alignnone size-full wp-image-1227" title="lightmouse" src="http://www.bravemouse.com/wp-content/uploads/2009/07/lightmouse.gif" alt="lightmouse" width="130" height="139" /> <img class="alignnone size-full wp-image-1226" title="darkmouse" src="http://www.bravemouse.com/wp-content/uploads/2009/07/darkmouse.gif" alt="darkmouse" width="129" height="139" /></p>
<h3>Setting up the Layers</h3>
<ul>
<li>Create three layers.</li>
<li>Turn the top layer into a <em>Mask</em> layer
<ul>
<li>Right click on the little &#034;page&#034; icon next to the layer&#039;s name.</li>
<li>Tick &#034;Mask&#034; from the drop down menu.</li>
<li>You should see the icon of that layer change, and (this is important) the one below it as well.</li>
<li>The top layer is the &#034;Mask&#034; layer,and the one below the &#034;<em>Masked</em>&#034; layer.</li>
<li>The layer just below the <em>masked</em> layer is a normal layer (In the screenshot below its called &#034;dark&#034;)</li>
</ul>
</li>
<li>Put the lighter image in the <em>masked</em> layer.</li>
<li>Put the darker image in the normal layer just below the mask layer. Make sure they are exactly lined up above one another.</li>
</ul>
<p><img class="alignnone size-full wp-image-1222" title="spotlight1" src="http://www.bravemouse.com/wp-content/uploads/2009/07/spotlight1.gif" alt="spotlight1" width="400" height="303" /></p>
<h3>Making the Mask</h3>
<ul>
<li>Create a shape in the mask layer.  In this example I&#039;ve used a simple disk.</li>
<li>The shape must have a fill &#8211; strokes don&#039;t work in a mask.</li>
<li>Your movie will look something like the screenshot below, with the red disk being the mask:</li>
</ul>
<p><img class="alignnone size-full wp-image-1223" title="spotlight2" src="http://www.bravemouse.com/wp-content/uploads/2009/07/spotlight2.gif" alt="spotlight2" width="400" height="300" /></p>
<p><strong>Test the mask</strong> by locking the mask layer and the masked layer:</p>
<ul>
<li>click on the little dot next to the layer name, under the &#034;lock&#034; icon to lock a layer.</li>
<li>With both the mask and masked layers locked, you will be able to preview the spotlight masking effect:</li>
</ul>
<p><img class="alignnone size-full wp-image-1224" title="spotlight3" src="http://www.bravemouse.com/wp-content/uploads/2009/07/spotlight3.gif" alt="spotlight3" width="133" height="136" /></p>
<p><strong>Animate the mask: </strong>You can create animation in the mask layer.  In the example below, I used a motion tween, but you can use classic or shape tweening as well.</p>
<p><img class="alignnone size-full wp-image-1225" title="spotlight5" src="http://www.bravemouse.com/wp-content/uploads/2009/07/spotlight5.gif" alt="spotlight5" width="400" height="301" /></p>
<p>This tutorial was adapted from a tip in<a href="http://www.amazon.com/Macromedia-Flash-Advanced-Windows-Macintosh/dp/0321213416/ref=sr_1_1?ie=UTF8&amp;qid=1249300117&amp;sr=1-1"> Russel Chun and Joe Garraffo&#039;s &#034;Macromedia Flash MX Advanced&#034;</a> which is an excellent book for learning actionscript.   There is a <a href="http://www.amazon.com/Macromedia-Flash-Advanced-Windows-Macintosh/dp/0321349644" target="_blank">more up to date version </a>as well.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bravemouse.com/2009/08/06/flash-create-a-spotlight-effect-with-a-mask-layer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flash: Create a Scribble Effect with a Mask Layer</title>
		<link>http://www.bravemouse.com/2009/08/03/flash-create-a-scribble-effect-with-a-mask-layer/</link>
		<comments>http://www.bravemouse.com/2009/08/03/flash-create-a-scribble-effect-with-a-mask-layer/#comments</comments>
		<pubDate>Mon, 03 Aug 2009 07:30:10 +0000</pubDate>
		<dc:creator>klip</dc:creator>
				<category><![CDATA[Animating in Flash]]></category>

		<guid isPermaLink="false">http://www.bravemouse.com/?p=1210</guid>
		<description><![CDATA[I promised to reveal how to create a &#034;scribble effect&#034; using mask layers in Flash.  If you don&#039;t know what a mask layer is yet, have a look at this post on Mask Layers. So how do you use mask layers to create animated writing like the example below? ( press the play button to [...]]]></description>
			<content:encoded><![CDATA[<p>I promised to reveal how to create a &#034;scribble effect&#034; using mask layers in Flash.  If you don&#039;t know what a mask layer is yet, <a href="http://www.bravemouse.com/2009/07/27/flash-work-with-mask-layers/">have a look at this post on Mask Layers.</a></p>
<p>So how do you use mask layers to create animated writing like the example below? ( press the play button to see the animation)</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_scribblemask_1910121651"
			class="flashmovie"
			width="130"
			height="90">
	<param name="movie" value="http://www.bravemouse.com/wp-content/uploads/2009/07/scribblemask.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.bravemouse.com/wp-content/uploads/2009/07/scribblemask.swf"
			name="fm_scribblemask_1910121651"
			width="130"
			height="90">
	<!--<![endif]-->
		<a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<h4><span id="more-1210"></span></h4>
<address>You can <a href="http://www.bravemouse.com/wp-content/uploads/2009/07/scribblemask2.fla.zip" target="_blank">download the files used in this example here.</a></address>
<h4>Create the layers:</h4>
<ul>
<li>Create two layers.</li>
<li>Turn the top layer into a Mask layer:
<ul>
<li>Right click on the little &#034;page&#034; icon next to the layer&#039;s name.</li>
<li>Tick &#034;Mask&#034; from the drop down menu.</li>
<li>You should see the icon of that layer change, and (this is important) the one below it as well.</li>
</ul>
</li>
</ul>
<p>Your layers should look something like the screen shot below. The top layer is the &#034;Mask&#034; layer,and the one below the &#034;Masked&#034; layer.</p>
<p><img title="mask3" src="http://www.bravemouse.com/wp-content/uploads/2009/07/mask3.gif" alt="mask3" width="202" height="72" /></p>
<p>Notice that both these layers are locked.  Click on the little lock icons to unlock both layers.</p>
<p><strong>Create the writing:</strong></p>
<p>In this example, I&#039;ve re-named the layers.  The top &#034;mask&#034; layer is called &#034;mask&#034;.  The &#034;masked&#034; layer at the bottom, is called &#034;scribble&#034;.</p>
<ul>
<li>Click on the first frame of the layer named <em>scribble</em> &#8211; in other words, the lower, &#034;masked&#034; layer.</li>
<li>Write or type out the entire phrase you want to appear.</li>
<li>Insert some frames to stretch this layer.  It should look something like this:</li>
</ul>
<p><img class="alignnone size-full wp-image-1211" title="scribble1" src="http://www.bravemouse.com/wp-content/uploads/2009/07/scribble1.gif" alt="scribble1" width="419" height="249" /></p>
<address><strong>Gotcha:</strong> If you are using the Type tool to create the writing  you will need to break it apart.  Go to Modify &gt; Break Apart.  Do this <strong>TWICE.</strong> This changes the editable text created by the Type Tool into normal vector shapes.<br />
</address>
<h3>Create the mask animation:</h3>
<ul>
<li>Select the first frame of the &#034;mask&#034; layer.</li>
<li>Use the Brush tool, and paint a small patch of colour covering up the bit of writing that you want to appear first.</li>
<li>You dont need to be very neat &#8211; remember, the mask layer will (eventually) be invisible.</li>
</ul>
<p>In this example, the mask layer is indicated in red:</p>
<p><img class="alignnone size-full wp-image-1212" title="scribble2" src="http://www.bravemouse.com/wp-content/uploads/2009/07/scribble2.gif" alt="scribble2" width="412" height="246" /></p>
<ul>
<li>Insert a new keyframe in the &#034;mask&#034; layer.</li>
<li>Make a splotch of colour over the next part of writing that must be revealed:</li>
</ul>
<p><img class="alignnone size-full wp-image-1213" title="scribble3" src="http://www.bravemouse.com/wp-content/uploads/2009/07/scribble3.gif" alt="scribble3" width="412" height="248" /></p>
<ul>
<li>If you lock both the layers, you will see the mask in action already.  Notice how it does not matter much how &#034;messy&#034; your mask is, as long as you cover all the bits of text you want to have revealed:</li>
</ul>
<p><img class="alignnone size-full wp-image-1214" title="scribble4" src="http://www.bravemouse.com/wp-content/uploads/2009/07/scribble4.gif" alt="scribble4" width="412" height="246" /></p>
<ul>
<li>Carry on inserting keyframes in the mask layer.  At each keyframe, add another patch of colour, gradaully covering up all of the text.</li>
<li>When you are done, your layers should look something like this:</li>
</ul>
<p><img class="alignnone size-full wp-image-1215" title="scribble5" src="http://www.bravemouse.com/wp-content/uploads/2009/07/scribble5.gif" alt="scribble5" width="413" height="246" /></p>
<p>Test it (Control &gt; Test Movie) and see.  Did you get it working?</p>
<p>You can <a href="../wp-content/uploads/2009/07/scribblemask2.fla.zip" target="_blank">download the files used in this example here.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bravemouse.com/2009/08/03/flash-create-a-scribble-effect-with-a-mask-layer/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Flash: Painting with selections</title>
		<link>http://www.bravemouse.com/2009/07/30/flash-painting-with-selections/</link>
		<comments>http://www.bravemouse.com/2009/07/30/flash-painting-with-selections/#comments</comments>
		<pubDate>Thu, 30 Jul 2009 10:08:24 +0000</pubDate>
		<dc:creator>klip</dc:creator>
				<category><![CDATA[Drawing in Flash]]></category>

		<guid isPermaLink="false">http://www.bravemouse.com/?p=1170</guid>
		<description><![CDATA[Once you get the hang of it drawing in Flash can be a lot of fun.  Especially if you take advantage of the &#034;Brush Mode&#034; menu.    You will find the Brush Mode like this: Select the Brush Tool Have a look at the bottom of the Tool palette.  (You may have to expand the [...]]]></description>
			<content:encoded><![CDATA[<p>Once you get the hang of it drawing in Flash can be a lot of fun.  Especially if you take advantage of the &#034;Brush Mode&#034; menu. </p>
<p><img class="alignnone size-full wp-image-1241" title="kittybit" src="http://www.bravemouse.com/wp-content/uploads/2009/07/kittybit.gif" alt="kittybit" width="297" height="307" /></p>
<p> </p>
<p>You will find the Brush Mode like this:<span id="more-1170"></span></p>
<ul>
<li>Select the Brush Tool</li>
<li>Have a look at the bottom of the Tool palette.  (You may have to expand the palette a bit to see all the buttons.)</li>
<li>Look for the &#034;Brush Mode&#034; button:<br />
<img class="alignnone size-full wp-image-1197" title="brushmode" src="http://www.bravemouse.com/wp-content/uploads/2009/07/brushmode.gif" alt="brushmode" width="60" height="52" /></li>
</ul>
<p> My favourite  brush mode is <strong>&#034;Paint Selection&#034;:</strong></p>
<p>First I draw a basic shape:</p>
<p><img class="alignnone size-full wp-image-1206" title="kitty1" src="http://www.bravemouse.com/wp-content/uploads/2009/07/kitty11.gif" alt="kitty1" width="350" height="356" /></p>
<p>Then I select one of the colours.  In the example below, the orange area is selected, and the black and brown eyes and nose are not selected:</p>
<p><img class="alignnone size-full wp-image-1198" title="kitty2" src="http://www.bravemouse.com/wp-content/uploads/2009/07/kitty21.gif" alt="kitty2" width="293" height="231" /></p>
<p>I set the &#034;Brush Mode&#034; to &#034;Paint Selection&#034;.  This means that I can scribble over the entire canvas, and the brush will only paint onto the selected areas:</p>
<p><img class="alignnone size-full wp-image-1203" title="kitty3" src="http://www.bravemouse.com/wp-content/uploads/2009/07/kitty32.gif" alt="kitty3" width="241" height="256" /></p>
<p>They eyes and nose are protected from editing, so I can scribble right over them.  I dont have to worry about staying inside the shape either.</p>
<p>Now I can select the new colour, (for example, the stripes on the cat)  and paint only on that.</p>
<p>The &#034;Paint Selection&#034; mode is a quick and easy way to improve your Flash drawing.</p>
<p><img class="alignnone size-full wp-image-1208" title="kitty5" src="http://www.bravemouse.com/wp-content/uploads/2009/07/kitty52.gif" alt="kitty5" width="436" height="440" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bravemouse.com/2009/07/30/flash-painting-with-selections/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

