<?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>Newbie Website Design &#187; HTML / CSS</title>
	<atom:link href="http://www.newbiewebsitedesign.com/category/html-css/feed" rel="self" type="application/rss+xml" />
	<link>http://www.newbiewebsitedesign.com</link>
	<description></description>
	<lastBuildDate>Tue, 03 May 2011 07:03:32 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.3</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Learning some shorthand CSS (MFW#7)</title>
		<link>http://www.newbiewebsitedesign.com/learning-some-shorthand-css</link>
		<comments>http://www.newbiewebsitedesign.com/learning-some-shorthand-css#comments</comments>
		<pubDate>Sun, 13 Sep 2009 03:02:16 +0000</pubDate>
		<dc:creator>David R - Admin</dc:creator>
				<category><![CDATA[HTML / CSS]]></category>
		<category><![CDATA[My First Website]]></category>

		<guid isPermaLink="false">http://www.newbiewebsitedesign.com/?p=1718</guid>
		<description><![CDATA[&#8220;My First Website&#8221; series navigation: first post &#8212; whole series
In the last post in this series we centered our web page, added some padding and margins, and put a border around it all. But, in order to do so, it took about 13 lines of CSS code. Ouch! Most people, after seeing that much coding, [...]]]></description>
			<content:encoded><![CDATA[<p><span class="seriesnavi">&#8220;My First Website&#8221; series navigation: <a href="/getting-started-my-first-website">first post</a> &#8212; <a href="/category/my-first-website">whole series</a></span><br />
<br/><img src="http://www.newbiewebsitedesign.com/wp-content/uploads/2009/08/mfw7.jpg" alt="mfw7" title="mfw7" width="144" height="123" class="leftphoto" />In the last post in this series we centered our web page, added some padding and margins, and put a border around it all. But, in order to do so, it took about 13 lines of CSS code. Ouch! Most people, after seeing that much coding, would give up the idea of hand-coding a website and run to a WYSIWYG visual editor.</p>
<p>Never fear, there are actually a few ways to take that obnoxiously long CSS code and shrink it down to only 4 lines! In this post, you&#8217;ll learn how to miniaturize your CSS code and &mdash; as promised &mdash; talk about some spacing anomalies.</p>
<p><span id="more-1718"></span></p>
<h2>Recap: the full CSS code</h2>
<p>Here&#8217;s the full CSS code for our &#8220;style.css&#8221; file we ended up with in the last post:</p>
<div class="codesnippet">
#pagewrap {<br />
&nbsp;&nbsp;&nbsp;&nbsp;width: 800px;<br/><br />
&nbsp;&nbsp;&nbsp;&nbsp;border-top: 1px solid #000000;<br />
&nbsp;&nbsp;&nbsp;&nbsp;border-right: 1px solid #000000;<br />
&nbsp;&nbsp;&nbsp;&nbsp;border-bottom: 1px solid #000000;<br />
&nbsp;&nbsp;&nbsp;&nbsp;border-left: 1px solid #000000;<br/><br />
&nbsp;&nbsp;&nbsp;&nbsp;margin-left: auto;<br />
&nbsp;&nbsp;&nbsp;&nbsp;margin-right: auto;<br />
&nbsp;&nbsp;&nbsp;&nbsp;margin-top: 30px;<br />
&nbsp;&nbsp;&nbsp;&nbsp;margin-bottom: 30px;<br/><br />
&nbsp;&nbsp;&nbsp;&nbsp;padding-top: 50px;<br />
&nbsp;&nbsp;&nbsp;&nbsp;padding-right: 50px;<br />
&nbsp;&nbsp;&nbsp;&nbsp;padding-bottom: 50px;<br />
&nbsp;&nbsp;&nbsp;&nbsp;padding-left: 50px;<br />
}
</div>
<p>We won&#8217;t be making the &#8220;width&#8221; declaration any shorter because we can&#8217;t (so I won&#8217;t be including it in the following examples) but everything else can! Here we go&#8230;</p>
<h2>The quick border code</h2>
<p>We can quickly replace all four lines of the CSS code that makes the square border with this simple shorthand line of code:</p>
<div class="codesnippet">
&nbsp;&nbsp;&nbsp;&nbsp;border: 1px solid #000000;
</div>
<p>If we don&#8217;t specify top, right, bottom, or left in the border <strong>property</strong>, then a complete square border will be created.</p>
<h2>Easy padding</h2>
<p>The padding code can be shorted to one line:</p>
<div class="codesnippet">
&nbsp;&nbsp;&nbsp;&nbsp;padding: 50px;
</div>
<p>Just like the border property above, this will add 50 pixels of padding all around.</p>
<h2>Minimized margin</h2>
<p>Differing from the padding and border code, the margin code is a little longer:</p>
<div class="codesnippet">
&nbsp;&nbsp;&nbsp;&nbsp;margin: 30px auto 30px auto;
</div>
<p>What does it all mean? Read on&#8230;</p>
<h2>Tick-tock, think like a clock</h2>
<p>The four <strong>values</strong> in the margin declaration list the margin distances in this order: top, right, bottom, left. The easy way to remember this is to imagine a clock:<br />
<center><br />
<img src="http://www.newbiewebsitedesign.com/wp-content/uploads/2009/08/clock.jpg" alt="clock" title="clock" width="227" height="164" class="alignnone size-full wp-image-1722" /><br />
</center><br />
Here&#8217;s a little more detail:<br />
<center><br />
<img src="http://www.newbiewebsitedesign.com/wp-content/uploads/2009/08/margin.jpg" alt="margin" title="margin" width="503" height="121" class="alignnone size-full wp-image-1723" /><br />
</center></p>
<p>Each value can be different. For example: <strong>margin: 10px 50px 25px 30px;</strong> is perfectly fine. Also, padding can be written this way if each value is different.</p>
<h2>A little shorter</h2>
<p>The margin declaration can be shortened even further:</p>
<div class="codesnippet">
&nbsp;&nbsp;&nbsp;&nbsp;margin: 30px auto;
</div>
<p>In this case, the first value of &#8220;30px&#8221; is for the top and bottom. The second value of &#8220;auto&#8221; is for left and right. You can use this shorthand for padding as well.</p>
<h2>The final cleanup</h2>
<p>We can now replace all of that lengthy CSS code for the #pagewrap with the following:</p>
<div class="codesnippet">
#pagewrap {<br />
&nbsp;&nbsp;&nbsp;&nbsp;width: 800px;<br />
&nbsp;&nbsp;&nbsp;&nbsp;border: 1px solid #000000;<br />
&nbsp;&nbsp;&nbsp;&nbsp;margin: 30px auto;<br />
&nbsp;&nbsp;&nbsp;&nbsp;padding: 50px;<br />
}
</div>
<p>If you haven&#8217;t done so already, update your &#8220;style.css&#8221; file to the above code. You can then look at your &#8220;index.html&#8221; file in your browser. If all went well, you shouldn&#8217;t see any difference!</p>
<h2>Some spacing anomalies</h2>
<p>We declared that the padding should be 50 pixels all around. But if you look carefully you&#8217;ll notice that the padding at the top and the bottom look larger than on the sides (i.e. there is a greater distance between the top border and the &#8220;A Level 1 Heading&#8221; than there is between the left border and the text.) Here&#8217;s the web page to check out:</p>
<p><a href="/mfw-examples/post-6-4.html">View the web page</a></p>
<p>The reason is the <strong>&lt;h1&gt;</strong> heading and the <strong>&lt;p&gt;</strong> paragraphs have their own margins and padding. Both of these come from your browser&#8217;s default style sheet. You can change them by making your own style declarations in your &#8220;style.css&#8221; file. Let&#8217;s do that now by adding the following code:</p>
<div class="codesnippet">
h1 {<br />
&nbsp;&nbsp;&nbsp;&nbsp;margin: 0;<br />
&nbsp;&nbsp;&nbsp;&nbsp;padding: 0 0 10px 0;<br />
}
</div>
<p>This CSS code will remove the margins on the <strong>&lt;h1&gt;</strong> heading and add 10px of padding at the bottom to give us some space between the heading and the first paragraph.</p>
<p><a href="/mfw-examples/post-7-1.html">View the result</a></p>
<p>While this is closer to what we want, it&#8217;s still not perfect. There is still the issue of <strong>line-height</strong> that is adding some extra space above our heading and the issue of extra padding after the last paragraph. But since we&#8217;ve covered a lot of ground today, let&#8217;s cover those topics in a later post, shall we? <img src='http://www.newbiewebsitedesign.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<h2>Your homeowork</h2>
<p>As always, take some time to play around with the values for the padding and the margins. If you&#8217;re feeling adventurous, add some CSS to the h3 heading.</p>
<p>In the next post we&#8217;ll take a look at dividing up our web page even further by creating a separate header section for our website&#8217;s title and adding a little background color as well.</p>
<p>See you then! </p>
]]></content:encoded>
			<wfw:commentRss>http://www.newbiewebsitedesign.com/learning-some-shorthand-css/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>HTML line break tag &#8211; when and how to use it</title>
		<link>http://www.newbiewebsitedesign.com/html-line-break-tag-cod</link>
		<comments>http://www.newbiewebsitedesign.com/html-line-break-tag-cod#comments</comments>
		<pubDate>Tue, 04 Aug 2009 13:16:20 +0000</pubDate>
		<dc:creator>David R - Admin</dc:creator>
				<category><![CDATA[Design and Layout]]></category>
		<category><![CDATA[Glossary of Confusing Stuff]]></category>
		<category><![CDATA[HTML / CSS]]></category>

		<guid isPermaLink="false">http://www.newbiewebsitedesign.com/?p=1629</guid>
		<description><![CDATA[A lot of beginners to website design want to know how to create a line break using HTML. And while the tag used to create a line break is easy to remember, knowing when and how to use it correctly is a little more complicated. In addition, there are many times when you shouldn&#8217;t even [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.newbiewebsitedesign.com/wp-content/uploads/2009/08/html-line-break-code.jpg" alt="HTML line break code" title="HTML line break code" width="144" height="123" class="leftphoto" />A lot of beginners to website design want to know how to create a line break using HTML. And while the tag used to create a line break is easy to remember, knowing when and how to use it correctly is a little more complicated. In addition, there are many times when you shouldn&#8217;t even use the HTML line break code at all.</p>
<p>In this post we&#8217;ll take a look at line breaks, what is the HTML tag for one, and when to <em>and not to</em> use them.</p>
<p>(By the way, if this is your first time visiting Newbie Website Design, then I encourage you to check out the <a href="/category/my-first-website">My First Website series</a> to learn how to build websites the right way.)</p>
<p>Let&#8217;s get learn more about HTML line breaks, shall we?</p>
<p><span id="more-1629"></span></p>
<h2>What is a line break?</h2>
<p>A <strong>line break</strong> is a special HTML tag that will force the very next the next character (or sentence or paragraph) to appear on a new line right below the one above. It is similar to pressing the &#8220;return&#8221; key when using a word processor.</p>
<h2>It isn&#8217;t gonna work</h2>
<p>If you&#8217;re using a text editing program like Notepad (Windows) or TextEdit (Mac) to write the HTML for your website, then pressing the return key in order to create line breaks isn&#8217;t going to work. You could press the return key a hundred times and you still won&#8217;t see those line breaks when you view your website with a browser. To get the desired line-breaking space that you want you either have to use the special HTML line break code or use <a href="/cascading-style-sheets-css">CSS</a> to do it for you.</p>
<h2>The HTML for a line break</h2>
<p>Here&#8217;s the HTML tag you need in order to make a line break:</p>
<div class="codesnippet">
&lt;br /&gt;
</div>
<p>Pretty simple, huh? Just plop this where you want a line break and you&#8217;re done!</p>
<p>Or are you&#8230;</p>
<h2>The wrong way to do line breaks</h2>
<p>Now, before you go adding the HTML line break code all over your layout, just remember this: if you ever decide to change the design of your website, then you may have to go through <em>all of your pages</em> and do some nasty hunt and replace.</p>
<p><em>For example:</em></p>
<p>Let&#8217;s say that you added two line breaks after all of the <strong>&lt;h1&gt;</strong> heading tags on your website. Later, if you decide that you only want one line break after the heading tags, then you have to erase all of the extra HTML line break code from every page. And if you have added line breaks after subheadings, paragraphs, and other layout elements, then let the editing nightmare begin!</p>
<h2>The better way to do line breaks</h2>
<p>Instead of relying on HTML for your line breaks, let an external CSS file handle the task. You won&#8217;t be using the <strong>&lt;br /&gt;</strong> tag. In its place you&#8217;ll be using a <strong>padding-bottom</strong> to get the job done right. By using CSS in an external file, you can control the height of this &#8220;padding&#8221; all throughout your website from one location.</p>
<p>(NOTE: to learn more about what an external CSS file is and how to make one, I strongly suggest going through the <a href="/category/my-first-website">My First Website series</a> here on Newbie Website Design. Post #5 talks specifically about how to add an <a href="/adding-css-to-a-website">external CSS file</a>. )</p>
<h2>The &#8220;non line break&#8221; line break</h2>
<p>Okay. Okay. So we&#8217;re not technically going to be adjusting the line breaks. But what we are going to do is control how much white space occurs after an element such as a heading or a paragraph. We do this by using <strong>padding-bottom</strong> in our CSS. It&#8217;s easy. Take a look:</p>
<div class="codesnippet">
h1 {<br />
&nbsp;&nbsp;&nbsp;&nbsp;padding-bottom: 20px;<br />
}
</div>
<p>This CSS simply tells the browser that all <strong>&lt;h1&gt;</strong> headings will have an extra 20 pixels of padding below it &mdash; right after the closing <strong>&lt;/h1&gt;</strong> tag. Any text that follows the heading will be pushed down by 20 pixels. You can do this after paragraphs, too:</p>
<div class="codesnippet">
p {<br />
&nbsp;&nbsp;&nbsp;&nbsp;padding-bottom: 15px;<br />
}
</div>
<p>The <strong>p</strong> represents the paragraph tags in your HTML. After a closing paragraph tag (<strong>&lt;/p&gt;</strong>) the very next element &mdash; be it a subheading or another paragraph &mdash; is pushed down 15 pixels.</p>
<h2>When to use an HTML line break</h2>
<p>Personally, there are only two times when I use an actual HTML line break in my designs&#8230;</p>
<h3>#1: One-shot deals</h3>
<p>If I need a little extra space in a design and I know 100% for certain that it won&#8217;t be repeated on other web pages I&#8217;ll use the <strong>&lt;br /&gt;</strong> tag. Before you add an HTML line break, be certain that it will never become a repeated part of every page of your layout.</p>
<h3>#2: Proper text layout</h3>
<p>There are times when you just have to make sure that the text of your layout flows correctly. Since all browsers won&#8217;t display your text exactly the same way, you can use HTML line breaks to ensure a clean look. A good example of this is when you have a centered heading that contains a lot of text. For example, this looks just horrible:</p>
<p><center><br />
<img src="http://www.newbiewebsitedesign.com/wp-content/uploads/2009/08/heading-bad.gif" alt="heading-bad" title="heading-bad" width="450" height="77" /><br />
</center></p>
<p>The word &#8220;system&#8221; hangs like deadweight at the bottom &mdash; stranded and all alone. But with a few line breaks we can make it look much, much better:</p>
<p><center><br />
<img src="http://www.newbiewebsitedesign.com/wp-content/uploads/2009/08/heading-good.gif" alt="heading-good" title="heading-good" width="398" height="78" /><br />
</center></p>
<p>Here&#8217;s the code (keep your eyes peeled for the HTML line break code):</p>
<div class="codesnippet">
&lt;h1&gt;Lose 20 pounds in 5 days with&lt;br /&gt;our 100% safe, all-natural&lt;br /&gt;weight-loss system!&lt;/h1&gt;
</div>
<h2>Conclusion</h2>
<p>Line breaks aren&#8217;t that hard to create with HTML. Because of that, they are extremely easy to add to a design. The downside is that by using them too much you might make updating or altering your website&#8217;s design and layout a major pain down the road. Start off right by adjusting the <strong>padding-bottom</strong> in an external CSS file and all future headaches will never cross your furrowed brow.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.newbiewebsitedesign.com/html-line-break-tag-cod/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Margins, padding, and borders oh my! Plus centering a website with CSS (MFW#6)</title>
		<link>http://www.newbiewebsitedesign.com/margins-padding-borders-centering-website-with-css</link>
		<comments>http://www.newbiewebsitedesign.com/margins-padding-borders-centering-website-with-css#comments</comments>
		<pubDate>Mon, 03 Aug 2009 05:26:56 +0000</pubDate>
		<dc:creator>David R - Admin</dc:creator>
				<category><![CDATA[HTML / CSS]]></category>
		<category><![CDATA[My First Website]]></category>

		<guid isPermaLink="false">http://www.newbiewebsitedesign.com/?p=1529</guid>
		<description><![CDATA[&#8220;My First Website&#8221; series navigation: first post &#8212; whole series
In this post of the &#8220;My First Website&#8221; series, we&#8217;re not going to touch the HTML of our website at all! Instead, we will focus only on the CSS. Specifically, how to add margins, padding, and borders. In addition, we are going to take our web [...]]]></description>
			<content:encoded><![CDATA[<p><span class="seriesnavi">&#8220;My First Website&#8221; series navigation: <a href="/getting-started-my-first-website">first post</a> &#8212; <a href="/category/my-first-website">whole series</a></span><br />
<br/><img src="http://www.newbiewebsitedesign.com/wp-content/uploads/2009/08/mpb.jpg" alt="mpb" width="118" height="139" class="leftphoto" />In this post of the &#8220;My First Website&#8221; series, we&#8217;re not going to touch the HTML of our website at all! Instead, we will focus only on the <a href="/cascading-style-sheets-css">CSS</a>. Specifically, how to add margins, padding, and borders. In addition, we are going to take our web page (which was stuck hard and fast to the left side of the browser window) and center it using some simple CSS.</p>
<p>If you haven&#8217;t done so already, fire up Notepad (Windows) or TextEdit (Mac), open the document called &#8220;style.css&#8221;, and get your &#8220;index.html&#8221; loaded up in your browser to view your results as you go through this tutorial&#8230;</p>
<p><span id="more-1529"></span></p>
<h2>Adding a border using CSS</h2>
<p>The first thing we&#8217;re going to do to our &#8220;style.css&#8221; file is to add a border to #pagewrap. Here is what you should have written already for the #pagewrap id:</p>
<div class="codesnippet">
#pagewrap {<br />
&nbsp;&nbsp;&nbsp;&nbsp;width: 800px;<br />
}
</div>
<p>Next, we&#8217;re going to add four more lines of code to create a border around our page. Take a look at what your #pagewrap should look like with the new code:</p>
<div class="codesnippet">
#pagewrap {<br />
&nbsp;&nbsp;&nbsp;&nbsp;width: 800px;<br/><br />
&nbsp;&nbsp;&nbsp;&nbsp;border-top: 1px solid #000000;<br />
&nbsp;&nbsp;&nbsp;&nbsp;border-right: 1px solid #000000;<br />
&nbsp;&nbsp;&nbsp;&nbsp;border-bottom: 1px solid #000000;<br />
&nbsp;&nbsp;&nbsp;&nbsp;border-left: 1px solid #000000;<br />
}
</div>
<p>The &#8220;border-???&#8221; determines where the border will appear: top, right, bottom, or left. The &#8220;1px&#8221; means that the border will be 1 pixel in width. The &#8220;solid&#8221; means that the border will be a solid line (there are a few more styles of borders that I&#8217;ll get to in a minute.) And the #000000 is the <a href="/what-are-web-safe-hex-colors-html-chart">hex color code</a> for pure black.</p>
<p>Save your &#8220;style.css&#8221; file, fire up your browser, and view the file called &#8220;index.html&#8221; in your browser to see the result. It should look like this:</p>
<p><a href="/mfw-examples/post-6-1.html">View the result</a></p>
<h2>Different kinds of CSS borders</h2>
<p>There are actually nine different kinds of borders you can create using CSS, but four of the five require a different kind of code than what is listed above (and, in my opinion, look horrible) and one we we&#8217;ll get into in a later post. So, for now, here is a list of the most-often used borders that can be created with the above code:</p>
<ul>
<li><strong>solid</strong></li>
<li><strong>dotted</strong></li>
<li><strong>dashed</strong></li>
<li><strong>double</strong></li>
</ul>
<p>Here&#8217;s what they look like:</p>
<p><span style="border: 1px solid #000000; padding: 8px;">A solid border.</span><br />
<br/><br />
<span style="border: 1px dotted #000000; padding: 8px;">A dotted border.</span><br />
<br/><br />
<span style="border: 1px dashed #000000; padding: 8px;">A dashed border.</span><br />
<br/><br />
<span style="border: 3px double #000000; padding: 8px;">A double border.</span><br/><br />
(NOTE: The double border requires a minimum of 3px to display &mdash; 1px for one line, 1px for the other line, and 1px of white space between the two.)</p>
<h2>Adding margins and centering our website with CSS</h2>
<p>Let&#8217;s get our web page centered in the browser window. It&#8217;s quite easy, actually. Just add these two lines of CSS code after the border code:</p>
<div class="codesnippet">
&nbsp;&nbsp;&nbsp;&nbsp;margin-left: auto;<br />
&nbsp;&nbsp;&nbsp;&nbsp;margin-right: auto;
</div>
<p>As before, save your &#8220;style.css&#8221; and reload the &#8220;index.html&#8221; file in your browser to see the results. It should look like this:</p>
<p><a href="/mfw-examples/post-6-2.html">View the result</a></p>
<p>The &#8220;auto&#8221; means &#8220;automatic&#8221;, so the browser will automatically adjust the left-right margins of our web page. If you resize your browser window, the position of the web page will adjust accordingly.</p>
<p>Next, let&#8217;s put a little distance between the top and bottom of our web page and the browser window. Depending on your browser, there might already be a little space. This is because all browsers have quite a few default CSS settings. But when you create your own CSS, it will override the default settings. Add these two lines of code:</p>
<div class="codesnippet">
&nbsp;&nbsp;&nbsp;&nbsp;margin-top: 30px;<br />
&nbsp;&nbsp;&nbsp;&nbsp;margin-bottom: 30px;
</div>
<p>And here&#8217;s the result:</p>
<p><a href="/mfw-examples/post-6-3.html">View the result</a></p>
<h2>Adding padding</h2>
<p>Finally we&#8217;re going to add some padding. The concept of padding is a little strange when you first begin using it. All it does is add some space between your content and the border. The strange part comes from how it changes the size of our #pagewrap.</p>
<p>We declared that our #pagewrap is to be 800px (pixels) wide. Adding the margins didn&#8217;t change its width &mdash; it&#8217;s still 800px wide. But when we add padding, the actual size of the page WILL change. The content will still be 800px wide, but the padding will add more pixels around the content.</p>
<p>Add this code to your CSS:</p>
<div class="codesnippet">
&nbsp;&nbsp;&nbsp;&nbsp;padding-top: 50px;<br />
&nbsp;&nbsp;&nbsp;&nbsp;padding-right: 50px;<br />
&nbsp;&nbsp;&nbsp;&nbsp;padding-bottom: 50px;<br />
&nbsp;&nbsp;&nbsp;&nbsp;padding-left: 50px;
</div>
<p>Here&#8217;s the result:</p>
<p><a href="/mfw-examples/post-6-4.html">View the result</a></p>
<h2>Adding it all up</h2>
<p>Time to do the math. As I said above, margins don&#8217;t change the size of the page itself. But then we added 50px of padding all around. That means we now have an extra 50px of width on the left and an extra 50px of width on the right making our web page 900px wide.</p>
<p>But wait! Did you for get that we added a 1px border around the whole thing? Now we have to add 1px of width from the left side and one 1px of width from the right side.</p>
<p>The grand total is 902px wide!</p>
<p>Keep this in mind when you set the width of something using CSS. Margins don&#8217;t change the width, but adding a border or padding WILL!</p>
<h2>A GREAT way to view the CSS box model!</h2>
<p>Here&#8217;s a website that has a wonderful interactive representation of the CSS box model to help you understand all about margins, borders, padding, and more. Make sure to move the &#8220;perspective&#8221; slider at the bottom to see the full effect!</p>
<p><a href="http://redmelon.net/tstme/box_model/">>> The CSS box model <<</a></p>
<h2>The full CSS code</h2>
<p>This is what your &#8220;style.css&#8221; file should look like now:</p>
<div class="codesnippet">
#pagewrap {<br />
&nbsp;&nbsp;&nbsp;&nbsp;width: 800px;<br/><br />
&nbsp;&nbsp;&nbsp;&nbsp;border-top: 1px solid #000000;<br />
&nbsp;&nbsp;&nbsp;&nbsp;border-right: 1px solid #000000;<br />
&nbsp;&nbsp;&nbsp;&nbsp;border-bottom: 1px solid #000000;<br />
&nbsp;&nbsp;&nbsp;&nbsp;border-left: 1px solid #000000;<br/><br />
&nbsp;&nbsp;&nbsp;&nbsp;margin-left: auto;<br />
&nbsp;&nbsp;&nbsp;&nbsp;margin-right: auto;<br />
&nbsp;&nbsp;&nbsp;&nbsp;margin-top: 30px;<br />
&nbsp;&nbsp;&nbsp;&nbsp;margin-bottom: 30px;<br/><br />
&nbsp;&nbsp;&nbsp;&nbsp;padding-top: 50px;<br />
&nbsp;&nbsp;&nbsp;&nbsp;padding-right: 50px;<br />
&nbsp;&nbsp;&nbsp;&nbsp;padding-bottom: 50px;<br />
&nbsp;&nbsp;&nbsp;&nbsp;padding-left: 50px;<br />
}
</div>
<p><em>That&#8217;s a lot for just one pagewrap!</em></p>
<p>But, there actually is an easier way to write this so that it only takes up 4 lines instead of 13! (I&#8217;ll show you how in the next post in this series.) Besides, if I show you the short hand method first, then you might not know about the CSS code above (it is used quite often.)</p>
<h2>Your homework</h2>
<p>We covered a lot of material in this post (and thank goodness our web page is actually starting to look like a real page!) Go ahead an play with some of the numbers. Make your borders thicker, remove one or more of them, or change their style. Add more padding or take away some. Play with the width of #pagewrap to see what happens.</p>
<p><a href="/learning-some-shorthand-css">In the next post</a>, I&#8217;ll talk about the shorthand way to write all of the above CSS code as well as discuss some of the spacing issues you may have already caught (i.e. did you notice that there appears to be more padding on the top than on the sides? In the next post, you&#8217;ll discover the reason!)</p>
<p>Until next time!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.newbiewebsitedesign.com/margins-padding-borders-centering-website-with-css/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Adding some CSS to our website (MFW#5)</title>
		<link>http://www.newbiewebsitedesign.com/adding-css-to-a-website</link>
		<comments>http://www.newbiewebsitedesign.com/adding-css-to-a-website#comments</comments>
		<pubDate>Tue, 28 Jul 2009 12:22:00 +0000</pubDate>
		<dc:creator>David R - Admin</dc:creator>
				<category><![CDATA[HTML / CSS]]></category>
		<category><![CDATA[My First Website]]></category>

		<guid isPermaLink="false">http://www.newbiewebsitedesign.com/?p=1320</guid>
		<description><![CDATA[&#8220;My First Website&#8221; series navigation: first post &#8212; whole series
It&#8217;s time for the moment you&#8217;ve all been waiting for: adding CSS to our website! In the previous post in this series we finally were able to get some very basic content on our first website. Unfortunately, as far as websites go, it&#8217;s pretty lame &#8212; [...]]]></description>
			<content:encoded><![CDATA[<p><span class="seriesnavi">&#8220;My First Website&#8221; series navigation: <a href="/getting-started-my-first-website">first post</a> &#8212; <a href="/category/my-first-website">whole series</a></span><br />
<br/><img src="http://www.newbiewebsitedesign.com/wp-content/uploads/2009/07/css-baby.jpg" alt="css-baby" title="css-baby" width="118" height="139" class="leftphoto" />It&#8217;s time for the moment you&#8217;ve all been waiting for: adding CSS to our website! In the <a href="/filling-out-webpage-with-html">previous post</a> in this series we finally were able to get some very basic content on our first website. Unfortunately, as far as websites go, it&#8217;s pretty lame &mdash; no styling, no colors, and what we got was one long <strong>liquid layout</strong> (a layout whose width varies with the width of the browser window.)</p>
<p>So roll up your sleeves, get Notepad, TextEdit, or your favorite text-digesting software ready to go, because we&#8217;re gonna add some CSS!</p>
<p><span id="more-1320"></span></p>
<h2>Adding an External Style Sheet</h2>
<p>The first thing we need to do is start a blank document in either Notepad or TextEdit. You&#8217;re going to name this file &#8220;style.css&#8221; (without the quotes) and save it in the same folder with the &#8220;index.html&#8221; file you created in the previous post. (Design Projects – My First Website – website.)</p>
<p>The naming of this file isn&#8217;t really that important. You can call it &#8220;mainsheet.css&#8221; or &#8220;stylesheet.css&#8221; or even &#8220;frankie.css&#8221; if that&#8217;s your preference. The only thing you MUST have is the &#8220;.css&#8221; at the end. Also, don&#8217;t use spaces or upper-case letters. Instead of spaces, you can use a dash ( &#8211; ) or an underscore ( _ ). For example: &#8220;style_version1.css&#8221; Make sure to save it as a UTF-8 as you learned in the <a href="/filling-out-webpage-with-html">previous post</a>.</p>
<h2>Linking your web page to the external CSS file</h2>
<p>Next, we&#8217;re going to link our web page to the CSS file we just created. We do so using this line of mark up:</p>
<div class="codesnippet">
&lt;link rel=&quot;stylesheet&quot; href=&quot;style.css&quot; type=&quot;text/css&quot;&gt;
</div>
<p>Now, open your &#8220;index.html&#8221; and add that line of mark up anywhere between the <strong>&lt;head&gt; &lt;/head&gt;</strong> tags. Like this: (I made it red to make it easier to spot.)</p>
<div class="codesnippet">
&lt;head&gt;<br />
&lt;title&gt;My First Website&lt;/title&gt;<br />
&lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html;charset=UTF-8&quot; /&gt;<br />
<span style="color: #CC0000; font-weight: bold;">&lt;link rel=&quot;stylesheet&quot; href=&quot;style.css&quot; type=&quot;text/css&quot;&gt;</span><br />
&lt;/head&gt;<br/>
</div>
<h2>Wrapping our web page</h2>
<p>It&#8217;s time to add our first &#8220;box&#8221; to our web page. This box will encompass or &#8220;wrap&#8221; the whole page itself. We will do so by adding <strong>&lt;div&gt; &lt;/div&gt;</strong> tags. But before we do that, we need to name our <strong>&lt;div&gt;</strong> so we can use our CSS file to change how it will appear.</p>
<p>To name this <strong>&lt;div&gt;</strong>, we&#8217;re going to give it a unique <strong>id</strong>. &#8220;Id&#8221;s can have any name at all, just make sure it is descriptive enough to you so you know what is does. For example, this <strong>&lt;div&gt;</strong> is going to wrap our web page, so let&#8217;s give it an id with the name of &#8220;pagewrap&#8221;. And we write it like this:</p>
<div class="codesnippet">
&lt;div id=&quot;pagewrap&quot;&gt;
</div>
<p>Now add both the opening tag and the closing tag to your &#8220;index.html&#8221; file. See below (to make it shorter, I left out all of the content you created in the <a href="/filling-out-webpage-with-html">previous post</a>.)</p>
<div class="codesnippet">
&lt;body&gt;<br/><br />
&lt;div id=&quot;pagewrap&quot;&gt;<br/><br />
&lt;h1&gt;A Level 1 Heading&lt;/h1&gt;<br />
(Here&#8217;s all the content from before)<br/><br />
 &lt;/div&gt;<br />
&lt;/body&gt;
</div>
<p>Save your &#8220;index.html&#8221; file.</p>
<h2>Finally! Some CSS!</h2>
<p>Go back to your &#8220;style.css&#8221; file and enter (or copy and paste) the following:</p>
<div class="codesnippet">
#pagewrap {<br />
&nbsp;&nbsp;&nbsp;&nbsp;width: 800px;<br />
}
</div>
<p>What this does is declare that the id called &#8220;pagewrap&#8221; (the # sign means &#8220;id&#8221; in CSS lingo) will have a width of 800px (the &#8220;px&#8221; means pixels.) The opening and closing curly brackets &mdash; { }  &mdash; must surround the CSS code and don&#8217;t forget the semicolon at the end of the line!</p>
<p>Save your &#8220;style.css&#8221; file.</p>
<h2>Take a look</h2>
<p>If all went well, then when you view your &#8220;index.html&#8221; file in your browser (remember how to do that?) It should look like this:</p>
<p><a href="/mfw-examples/post-5.html">View the web page</a></p>
<p>If your web page looks like the one above then congratulations! If not, go back an check all of the code and mark up for mistakes. Here is the full mark up of the &#8220;index.html&#8221; file for you to compare against:</p>
<div class="codesnippet">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot;<br />
&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;<br />
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;<br/><br />
&lt;head&gt;<br />
&lt;title&gt;My First Website&lt;/title&gt;<br />
&lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html;charset=UTF-8&quot; /&gt;<br />
&lt;link rel=&quot;stylesheet&quot; href=&quot;style.css&quot; type=&quot;text/css&quot;&gt;<br />
&lt;/head&gt;<br/><br />
&lt;body&gt;<br/><br />
&lt;div id=&quot;pagewrap&quot;&gt;<br/><br />
&lt;h1&gt;A Level 1 Heading&lt;/h1&gt;<br/><br />
&lt;p&gt;Morbi non erat non ipsum pharetra tempus. Donec orci. Proin in ante. Pellentesque sit amet purus. Cras egestas diam sed ante. Etiam imperdiet urna sit amet risus. Donec ornare arcu id erat.&lt;/p&gt;<br/><br />
&lt;p&gt;Aliquam et nisl vel ligula consectetuer suscipit. Morbi euismod enim eget neque. Donec sagittis massa. Vestibulum quis augue sit amet ipsum laoreet pretium. Nulla facilisi. Duis tincidunt, felis et luctus placerat, ipsum libero vestibulum sem, vitae elementum wisi ipsum a metus.&lt;/p&gt;<br/><br />
&lt;h3&gt;A Level 3 Heading&lt;/h3&gt;<br/><br />
&lt;p&gt;Morbi non erat non ipsum pharetra tempus. Donec orci. Proin in ante. Pellentesque sit amet purus. Cras egestas diam sed ante. Etiam imperdiet urna sit amet risus. Donec ornare arcu id erat.&lt;/p&gt;<br/><br />
&lt;p&gt;Aliquam et nisl vel ligula consectetuer suscipit. Morbi euismod enim eget neque. Donec sagittis massa. Vestibulum quis augue sit amet ipsum laoreet pretium. Nulla facilisi. Duis tincidunt, felis et luctus placerat, ipsum libero vestibulum sem, vitae elementum wisi ipsum a metus.&lt;/p&gt;<br/><br />
&lt;/div&gt;<br/><br />
&lt;/body&gt;
</div>
<h2>Conclusion</h2>
<p>We&#8217;ve now taken our <strong>liquid layout</strong> (a layout that changes width with the browser window) and made it into a <strong>fixed-width layout</strong> (a layout whose width is unaffected by the width of the browser window). Still it&#8217;s not much to look at, but we&#8217;re getting there!</p>
<p>In the next post titled <a href="/margins-padding-borders-centering-website-with-css">Margins, padding, and borders oh my! Plus centering a website with CSS</a> I&#8217;ll introduce you to the gory details of the CSS box model by adding some padding, some margins, and even a border to surround our web page.</p>
<p>Until next time!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.newbiewebsitedesign.com/adding-css-to-a-website/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Filling out our webpage with HTML (MFW#4)</title>
		<link>http://www.newbiewebsitedesign.com/filling-out-webpage-with-html</link>
		<comments>http://www.newbiewebsitedesign.com/filling-out-webpage-with-html#comments</comments>
		<pubDate>Thu, 16 Jul 2009 01:37:07 +0000</pubDate>
		<dc:creator>David R - Admin</dc:creator>
				<category><![CDATA[HTML / CSS]]></category>
		<category><![CDATA[My First Website]]></category>

		<guid isPermaLink="false">http://www.newbiewebsitedesign.com/?p=1015</guid>
		<description><![CDATA[&#8220;My First Website&#8221; series navigation: first post &#8212; whole series

In this installment of My First Website, we&#8217;ll build upon the simple web page we created in the previous post in the series. You&#8217;ll learn about headings and how to create them as well as dividing up your content into paragraphs. Yes, slowly but surely we [...]]]></description>
			<content:encoded><![CDATA[<p><span class="seriesnavi">&#8220;My First Website&#8221; series navigation: <a href="/getting-started-my-first-website">first post</a> &#8212; <a href="/category/my-first-website">whole series</a></span><br />
<br/><br />
<img src="http://www.newbiewebsitedesign.com/wp-content/uploads/2009/07/mfw4.jpg" alt="HTML headings and paragraphs" title="HTML headings and paragraphs" width="118" height="139" class="leftphoto" />In this installment of My First Website, we&#8217;ll build upon the simple web page we created in the <a href="/first-web-page-html-examples">previous post in the series</a>. You&#8217;ll learn about headings and how to create them as well as dividing up your content into paragraphs. Yes, slowly but surely we are getting into more of the &#8220;meat and potatoes&#8221; of HTML!</p>
<p>But before we can tuck in our napkin and dine on some HTML goodness, let&#8217;s get your web page ready to be viewed on your own browser. And it&#8217;s very easy to do.</p>
<p>Let&#8217;s begin&#8230;</p>
<p><span id="more-1015"></span></p>
<div class="clear"></div>
<h2>Getting ready</h2>
<p>The first thing you need to do is to take the mark up you learned in &#8220;My first Website #3&#8243;, copy and paste it into a new document in either NotePad (Windows) of TextEdit (Mac), and then save it. Here&#8217;s that mark up if you missed it:</p>
<div class="codesnippet">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot;<br />
&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;<br/><br />
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;<br/><br />
&lt;head&gt;<br />
&lt;title&gt;My First Website&lt;/title&gt;<br />
&lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html;charset=UTF-8&quot; /&gt;<br />
&lt;/head&gt;<br/><br />
&lt;body&gt;<br />
&lt;p&gt;Here is some sample text that will appear in your browser.&lt;/p&gt;<br />
&lt;/body&gt;<br/><br />
&lt;/html&gt;
</div>
<p>Now you need to save it. But you have to make sure to save it in a special way. The webpage itself is encoded using <em>UTF-8</em> so you need to save the file using UTF-8. Take a gander below&#8230;</p>
<h3>NotePad:</h3>
<p>After copying and pasting the above mark up, choose &#8220;Save As&#8230;&#8221; from the file menu in NotePad. Then, in the &#8220;Encoding&#8221; drop down menu choose UTF-8. Enter the filename as <strong>index.html</strong>. Finally, save it the folder called &#8220;website&#8221; that you created in &#8220;<a href="/getting-started-my-first-website">My First Website #1</a>&#8220;. (Design Projects &#8211; My First Website &#8211; website.) Done!</p>
<h3>TextEdit:</h3>
<p>First, make sure that your new document is a <em>plain text</em> document. Look in the &#8220;Format&#8221; menu at the top. If you see &#8220;Make Rich Text&#8221; then your document is already in plain text. If you see &#8220;Make Plain Text&#8221; in the menu, choose that. </p>
<p>After copying and pasting the above mark up, choose &#8220;Save As&#8230;&#8221; from the file menu in TextEdit. Then, in the &#8220;Encoding&#8221; drop down menu choose UTF-8. Enter the filename as <strong>index.html</strong>. Finally, save it the folder called &#8220;website&#8221; that you created in &#8220;<a href="/getting-started-my-first-website">My First Website #1</a>&#8220;. (Design Projects &#8211; My First Website &#8211; website.) Done!<br/><br/></p>
<h2>Viewing &#8216;index.html&#8217; in your browser</h2>
<p>It&#8217;s very easy to see what this webpage will look like without the need to have it <a href="/what-is-hosting-a-website">hosted</a> somewhere. All you have to do is start up your favorite flavor of browser (FireFox, Safari, Internet Explorer, etc.), go to the &#8220;File&#8221; menu, choose &#8220;Open File&#8230;&#8221; and then find the <strong>index.html</strong> document that you just created. Tada! You should be able to see our rather scanty webpage.</p>
<p>Now let&#8217;s spice it up a little!</p>
<h2>Add a heading</h2>
<p>Right after the opening <strong>&lt;body&gt;</strong> tag, we&#8217;re going to add a level 1 heading. It&#8217;s made using these opening and closing tags: <strong>&lt;h1&gt; &lt;/h1&gt;</strong>. Let&#8217;s put one in! (To save space in this and subsequent posts, I&#8217;m not going to repeat the full markup. Ok?)</p>
<div class="codesnippet">
&lt;body&gt;<br/><br />
&lt;h1&gt;A Level 1 Heading&lt;/h1&gt;<br />
&lt;p&gt;Here is some sample text that will appear in your browser.&lt;/p&gt;<br/><br />
&lt;/body&gt;
</div>
<p>Don&#8217;t worry about the empty lines in-between the tags. I could put 100 empty lines and the result would be the same. Why? Because if you want empty lines, you have to tell the browser using HTML!</p>
<p>View the result: <a href="/mfw-examples/post-4-1.html">Level 1 Heading</a></p>
<h2>Add some more paragraphs</h2>
<p>Next, using some <a href="/what-is-lorem-ipsum-why-should-you-use-it">Lorem Ipsum</a>, we&#8217;ll add a few paragraphs with the <strong>&lt;p&gt; &lt;/p&gt;</strong> paragraph tags. (By all means, please copy and paste the text below, I would never expect you to type out Lorem Ipsum!)</p>
<div class="codesnippet">
&lt;body&gt;<br/><br />
&lt;h1&gt;A Level 1 Heading&lt;/h1&gt;<br/><br />
&lt;p&gt;Morbi non erat non ipsum pharetra tempus. Donec orci. Proin in ante. Pellentesque sit amet purus. Cras egestas diam sed ante. Etiam imperdiet urna sit amet risus. Donec ornare arcu id erat.&lt;/p&gt;<br/><br />
&lt;p&gt;Aliquam et nisl vel ligula consectetuer suscipit. Morbi euismod enim eget neque. Donec sagittis massa. Vestibulum quis augue sit amet ipsum laoreet pretium. Nulla facilisi. Duis tincidunt, felis et luctus placerat, ipsum libero vestibulum sem, vitae elementum wisi ipsum a metus.&lt;/p&gt;<br/><br />
&lt;/body&gt;
</div>
<p>View the result: <a href="/mfw-examples/post-4-2.html">Two Paragraphs</a></p>
<h2>Add a subheading and more paragraphs</h2>
<p>Headings have 6 levels: 1 being the largest and 6 being the smallest. You write them this way:</p>
<p><strong>&lt;h1&gt; &lt;/h1&gt;</strong><br />
<strong>&lt;h2&gt; &lt;/h2&gt;</strong><br />
<strong>&lt;h3&gt; &lt;/h3&gt;</strong><br />
<strong>&lt;h4&gt; &lt;/h4&gt;</strong><br />
<strong>&lt;h5&gt; &lt;/h5&gt;</strong><br />
<strong>&lt;h6&gt; &lt;/h6&gt;</strong></p>
<p>View an example here: <a href="/mfw-examples/post-4-3.html">Headings list</a></p>
<p>Each browser will size them differently unless you use some CSS to change how they appear. You can mix and match any number of levels and even use the same level many times on a single webpage &mdash; there aren&#8217;t any rules. So, let&#8217;s add a subheading using an <strong>&lt;h3&gt; &lt;/h3&gt;</strong> tag along with some more paragraphs:</p>
<div class="codesnippet">
&lt;body&gt;<br/><br />
&lt;h1&gt;A Level 1 Heading&lt;/h1&gt;<br/><br />
&lt;p&gt;Morbi non erat non ipsum pharetra tempus. Donec orci. Proin in ante. Pellentesque sit amet purus. Cras egestas diam sed ante. Etiam imperdiet urna sit amet risus. Donec ornare arcu id erat.&lt;/p&gt;<br/><br />
&lt;p&gt;Aliquam et nisl vel ligula consectetuer suscipit. Morbi euismod enim eget neque. Donec sagittis massa. Vestibulum quis augue sit amet ipsum laoreet pretium. Nulla facilisi. Duis tincidunt, felis et luctus placerat, ipsum libero vestibulum sem, vitae elementum wisi ipsum a metus.&lt;/p&gt;<br/><br />
&lt;h3&gt;A Level 3 Heading&lt;/h3&gt;<br/><br />
&lt;p&gt;Morbi non erat non ipsum pharetra tempus. Donec orci. Proin in ante. Pellentesque sit amet purus. Cras egestas diam sed ante. Etiam imperdiet urna sit amet risus. Donec ornare arcu id erat.&lt;/p&gt;<br/><br />
&lt;p&gt;Aliquam et nisl vel ligula consectetuer suscipit. Morbi euismod enim eget neque. Donec sagittis massa. Vestibulum quis augue sit amet ipsum laoreet pretium. Nulla facilisi. Duis tincidunt, felis et luctus placerat, ipsum libero vestibulum sem, vitae elementum wisi ipsum a metus.&lt;/p&gt;<br/><br />
&lt;/body&gt;
</div>
<p>View the result: <a href="/mfw-examples/post-4-4.html">Subheading</a></p>
<h2>Your homework</h2>
<p>Have some fun playing around with the 6 different levels of headings as well as adding more paragraphs. I know that our website still doesn&#8217;t look like much, but we&#8217;re getting there!</p>
<p>In the next post we&#8217;ll finally take a look at <a href="/adding-css-to-a-website">adding CSS to our web page</a>. See you then!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.newbiewebsitedesign.com/filling-out-webpage-with-html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>First web page with HTML (MFW#3)</title>
		<link>http://www.newbiewebsitedesign.com/first-web-page-html-examples</link>
		<comments>http://www.newbiewebsitedesign.com/first-web-page-html-examples#comments</comments>
		<pubDate>Fri, 03 Jul 2009 02:13:18 +0000</pubDate>
		<dc:creator>David R - Admin</dc:creator>
				<category><![CDATA[HTML / CSS]]></category>
		<category><![CDATA[My First Website]]></category>

		<guid isPermaLink="false">http://www.newbiewebsitedesign.com/?p=608</guid>
		<description><![CDATA[&#8220;My First Website&#8221; series navigation: first post &#8212; whole series

Now it&#8217;s time to make our first web page with HTML! This, of course, is going to be a very, very basic web page. But it&#8217;s important to understand exactly what the HTML of a basic web page looks like and how each HTML element and [...]]]></description>
			<content:encoded><![CDATA[<p><span class="seriesnavi">&#8220;My First Website&#8221; series navigation: <a href="/getting-started-my-first-website">first post</a> &#8212; <a href="/category/my-first-website">whole series</a></span><br />
<br/><br />
<img src="http://www.newbiewebsitedesign.com/wp-content/uploads/2009/07/MFW-post-3.jpg" alt="My First Website 3" title="My First Website 3" width="118" height="139" class="leftphoto" />Now it&#8217;s time to make our first web page with HTML! This, of course, is going to be a very, very basic web page. But it&#8217;s important to understand exactly what the HTML of a basic web page looks like and how each HTML <strong>element</strong> and <strong>tag</strong> function.</p>
<p>So let&#8217;s dive right in, cut to the chase, get to the point, (and any other expressions that you know of that make good transitions in writing&#8230; <img src='http://www.newbiewebsitedesign.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  )</p>
<h2>All HTML web pages MUST have these</h2>
<p>All web pages must contain certain &#8220;elements&#8221; or &#8220;items&#8221; that allow browsers to recognize them as being web pages. As you may have experienced, your browser can <strong>render</strong> (display on your screen) many kinds of files such as single images, .PDF files, audio-only pages, and a multitude of others. So, in order for your browser to know that your web page really IS a web page, it must contain the following:</p>
<p><span id="more-608"></span></p>
<ul>
<li>a <em>doctype</em></li>
<li>an &lt;html&gt; tag</li>
<li>a &lt;head&gt; tag</li>
<li>a &lt;title&gt; tag</li>
<li>a &lt;body&gt; tag</li>
</ul>
<p>Let&#8217;s take a closer look at each of these so we can finally feel intelligent about HTML website design!</p>
<h2>The doctype (Document Type Declaration)</h2>
<p>The <strong>Document Type Declaration</strong> or <strong>doctype</strong> for short, basically says <em>&#8220;Yo browser! This is a web page. It&#8217;s written in XHTML. Render it this way. Got it?&#8221;</em> Since there are many different types of files that a browser can render and just as many types of HTML and XHTML, the doctype is a must-have.</p>
<p>The position of the doctype is very important. It absolutely, positively must be located at the very top of your web page since your browser can&#8217;t do anything with your web page file until it knows exactly what it is.</p>
<p>Here is what the complex doctype looks like:</p>
<div class="codesnippet">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot;<br />
 &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;
</div>
<p>Don&#8217;t worry about trying to memorize this jumble of HTML code. Most professional website designers do what I do: just copy and paste it to the top of every web page.</p>
<h2>The &lt;html&gt; element</h2>
<p>Now that the browser has a clue about what kind of file our web page is, we need to give it some HTML! If you read the post on what is HTML (you can <a href="/what-is-html-and-xhtml">read it here</a>) then you know that all tags must have an opening and a closing. The opening tag says <em>&#8220;begin here&#8221;</em> and the closing tag says <em>&#8220;end here&#8221;</em>. Following is the &lt;html&gt; that you need for your web page:</p>
<div class="codesnippet">
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
</div>
<p>Again, don&#8217;t worry about memorizing this, just copy and paste.</p>
<h2>The &lt;head&gt; element</h2>
<p>The <strong>head</strong> element is where you store information about your web page. Some information may include the web page&#8217;s title, a description of your web page (used by search engines), a keyword list (also used by search engines), a link to your <a href="/cascading-style-sheets-css">CSS file</a>, and others. For the time being, we will only concentrate on two of these: the <strong>title tag</strong> and the <strong>charaset meta element</strong>.</p>
<h2>The &lt;title&gt; element</h2>
<p>The title element tells the browser the name of your web page. This name appears in many places:</p>
<ul>
<li>At the top of the browser window</li>
<li>In the Windows Taskbar or the Mac Dock</li>
<li>In the Favorites or Bookmarks menu of your browser</li>
<li>In the search engine results page (the page you see when searching on Google, Yahoo, etc.) </li>
</ul>
<p>Because the title tag can give vital information about your web page, it&#8217;s important to make it more detailed than just &#8220;Home&#8221;. (More on proper title tag construction in future posts.)</p>
<h2>The charaset meta element</h2>
<p>There are actually many ways to display text on a computer, and each way has its own <strong>encoding</strong>. The <strong>meta element</strong> of <strong>charaset</strong> (which is short for <em>character set</em>) tells the browser to read your text as &#8220;UTF-8&#8243;. <strong>UTF-8</strong> is a globally recognized encoding for text that all browsers can read &mdash; perfect!</p>
<p>As a newbie to website design, it really isn&#8217;t important to fully understand text encoding. Just make sure to use the code listed below and all will be fine. Speaking of which, here is the complete head section of your web page:</p>
<div class="codesnippet">
&lt;head&gt;<br />
&lt;title&gt;My First Website&lt;/title&gt;<br />
&lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html;charset=UTF-8&quot; /&gt;<br />
&lt;/head&gt;
</div>
<h2>Where it all happens: the &lt;body&gt; element</h2>
<p>This is it! In-between the &lt;body&gt;&lt;/body&gt; tags is where you put all of the actual content (text, images, and other goodies) that will be visible to your website&#8217;s visitors. Since this is our first example of a web page, let&#8217;s keep it simple by only using the <strong>paragraph</strong> tags: &lt;p&gt; &lt;/p&gt;</p>
<div class="codesnippet">
&lt;body&gt;<br />
&lt;p&gt;Here is some sample text that will appear in your browser.&lt;/p&gt;<br />
&lt;/body&gt;
</div>
<h2>One last thing</h2>
<p>I&#8217;d like to show you the whole HTML markup for this web page, but I can&#8217;t just yet. There is one last thing. We still have to put the closing &lt;/html&gt; tag at the bottom of the page!</p>
<div class="codesnippet">
&lt;/html&gt;
</div>
<h2>Putting it all together</h2>
<p>Now we&#8217;re done! Here is the complete markup for our very first (and very simple) web page:</p>
<div class="codesnippet">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot;<br />
&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;<br/><br />
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;<br/><br />
&lt;head&gt;<br />
&lt;title&gt;My First Website&lt;/title&gt;<br />
&lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html;charset=UTF-8&quot; /&gt;<br />
&lt;/head&gt;<br/><br />
&lt;body&gt;<br />
&lt;p&gt;Here is some sample text that will appear in your browser.&lt;/p&gt;<br />
&lt;/body&gt;<br/><br />
&lt;/html&gt;
</div>
<p><a href="/mfw-examples/post-3.html">View the actual web page</a></p>
<p>Note: after clicking on the above link, right-click on that web page and choose &#8220;View Source&#8221; to see the HTML markup. It&#8217;s the same as what we created above! </p>
<h2>Conclusion</h2>
<p>Yes, I do realize that this is by far the most basic web page in the world &mdash; no color, no images, no links, and pathetic text to read &mdash; but it is necessary to understand what makes up an HTML web page before moving into the really cool stuff.</p>
<p><a href="/filling-out-webpage-with-html">In the next installment</a> in the &#8220;My First Website&#8221; series, we&#8217;ll start playing around with the &lt;body&gt; element to add some headings and text.</p>
<p>Until next time!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.newbiewebsitedesign.com/first-web-page-html-examples/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Cascading Style Sheets &#8211; CSS</title>
		<link>http://www.newbiewebsitedesign.com/cascading-style-sheets-css</link>
		<comments>http://www.newbiewebsitedesign.com/cascading-style-sheets-css#comments</comments>
		<pubDate>Wed, 06 May 2009 09:46:25 +0000</pubDate>
		<dc:creator>David R - Admin</dc:creator>
				<category><![CDATA[Glossary of Confusing Stuff]]></category>
		<category><![CDATA[HTML / CSS]]></category>

		<guid isPermaLink="false">http://www.newbiewebsitedesign.com/?p=351</guid>
		<description><![CDATA[In the previous post, you learned what is HTML and XHTML and a few of the most commonly used tags. If you simply added a few more tags to your HTML vocabulary you could make some decent websites. But why would you want to stop there when there is the wide and wonderful world of [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.newbiewebsitedesign.com/wp-content/uploads/2009/05/css-photo.jpg" alt="CSS-cascading style sheets" title="CSS-cascading style sheets" width="118" height="139" class="leftphoto" />In the <a href="/what-is-html-and-xhtml">previous post</a>, you learned what is HTML and XHTML and a few of the most commonly used tags. If you simply added a few more tags to your HTML vocabulary you could make some decent websites. But why would you want to stop there when there is the wide and wonderful world of <strong>Cascading Style Sheets</strong> (CSS) just over the horizon&#8230;</p>
<div class="clear"></div>
<h2>Pre-CSS: the dark age of website design</h2>
<p>Before Cascading Style Sheets came into being in the world of website design, designers had to put detailed HTML tags into every web page. These tags controlled things like font size, font color, background color, line height, lists, etc. etc. etc. This was all fine and dandy if your website only had a few pages.</p>
<p>As the web grew so did the size of websites. Gone were the days of sites that had a dozen or two pages only. The next generation of websites grew to hundreds and hundreds of pages. News sites are a prime example.</p>
<p>Now imagine this:<br />
<span id="more-351"></span><br />
For months and months you&#8217;ve slaved over a new website. On this particular day you just completed the 81st article page&#8230; then your boss walks in.<em> &#8220;David, I need you to do me a favor. The headings of the article titles are just a little too small. Could you make them a touch bigger? Oh, and while you&#8217;re at it, make the font color a little more&#8230; uh&#8230; cornflower blueish.&#8221;</em></p>
<p>Well, after uttering a few choice four letter words under your breath, you hit the keyboard. You see, poor David now has to edit ALL 81 PAGES of the website for the new changes to occur.</p>
<p>There&#8217;s gotta be an easier way&#8230; and there is. It&#8217;s called CSS.</p>
<h2>Life in the golden age of website design</h2>
<p>The beauty of CSS lies in the fact that you can actually separate the style that handles how a web page is to be layed out and displayed from the actual content (text, images, graphics, etc.). Let&#8217;s take a gander at an image to clear it up a bit:</p>
<p><img src="http://www.newbiewebsitedesign.com/wp-content/uploads/2009/05/before.gif" alt="before" title="before" width="510" height="207" class="alignnone size-full wp-image-354" /></p>
<p>As stated above, the old way combined the style and the content together. But with CSS, you create an external file that holds all of the styles for the ENTIRE website. They are global styles. So now, even if you have dozens and dozens of pages and want to change some part of the style, then all you have to do is edit the one style sheet and all of the individual web pages will immediately show the new style:</p>
<p><img src="http://www.newbiewebsitedesign.com/wp-content/uploads/2009/05/css.gif" alt="css" title="css" width="452" height="176" class="alignnone size-full wp-image-355" /></p>
<p>This method of CSS uses an <strong>external style sheet</strong>. It is by far the most commonly used method. Each web page has a tiny little bit of HTML in it that tells the browser where to find the external CSS file and to use it to control the layout and style of the web page.</p>
<p>Simple, yet powerful!</p>
<p>There are two other ways to utilize CSS: <strong>inline styles</strong> and <strong>embedded styles</strong>. Both have the right place and time for their use&#8230; which in my experience isn&#8217;t too often (with that said, Newbie Website Design will mainly focus on the use of the external style sheet.)</p>
<h2>So, what is that whole &#8216;cascading&#8217; thingy?</h2>
<p>The &#8216;cascading&#8217; part of Cascading Style Sheets is sort of like trickle-down economics (if you&#8217;re old enough to know what that is.) If not, here&#8217;s a better explanation:</p>
<p>With CSS, once you declare a style &mdash; for example, the H1 heading will be the color blue &mdash; all H1 headings will be that color no matter where they are located on your website. The only way to make other H1 headings a different color is to declare those in a special way. In other words, the style will <em>cascade</em> all throughout your website unless you say otherwise. (You&#8217;ll learn how to do that in later posts.)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.newbiewebsitedesign.com/cascading-style-sheets-css/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>What is HTML and XHTML?</title>
		<link>http://www.newbiewebsitedesign.com/what-is-html-and-xhtml</link>
		<comments>http://www.newbiewebsitedesign.com/what-is-html-and-xhtml#comments</comments>
		<pubDate>Sat, 02 May 2009 07:39:29 +0000</pubDate>
		<dc:creator>David R - Admin</dc:creator>
				<category><![CDATA[Glossary of Confusing Stuff]]></category>
		<category><![CDATA[HTML / CSS]]></category>

		<guid isPermaLink="false">http://www.newbiewebsitedesign.com/?p=328</guid>
		<description><![CDATA[To the newbie website designer, acronyms like HTML and XHTML can seem like strange and wild foreign languages that only people with the &#8220;tech&#8221; gene turned on can fathom. But they are not that hard to understand at all. And you certainly don&#8217;t need to undergo gene therapy to master them.
HTML stands for &#8220;HyperText Markup [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.newbiewebsitedesign.com/wp-content/uploads/2009/05/html-xhtml.jpg" alt="What is HTML and XHTML?" title="What is HTML and XHTML?" width="118" height="139" class="leftphoto" />To the newbie website designer, acronyms like <strong>HTML</strong> and <strong>XHTML</strong> can seem like strange and wild foreign languages that only people with the &#8220;tech&#8221; gene turned on can fathom. But they are not that hard to understand at all. And you certainly don&#8217;t need to undergo gene therapy to master them.</p>
<p>HTML stands for <em>&#8220;HyperText Markup Language&#8221;</em>. XHTML  stands for <em>&#8220;Extensible HyperText Markup Language&#8221;</em>.</p>
<p>Yada. Yada. Yada.</p>
<p>Let&#8217;s find out what those actually mean.<br />
<span id="more-328"></span></p>
<h2>HTML &#8211; Text on caffeine</h2>
<p>First there was text&#8230; Then there was <em>hypertext</em>! Normal text can&#8217;t do anything but be read. But hypertext can actually DO more. What&#8217;s that? Be clicked (basically).</p>
<p>The &#8220;markup language&#8221; part of HTML is a kind of code &mdash; <em>that really isn&#8217;t code</em> &mdash; which is used to tell a browser how to display text. Here&#8217;s how to tell the difference between &#8220;markup language&#8221; and &#8220;code&#8221;: </p>
<p>Markup language, using a very simple <strong>tag</strong> structure, says to the browser <em>&#8220;Hey! Make this text italic!&#8221;</em> Code, on the other hand, consists of many lines of confusing words and symbols that actually tell the computer exactly HOW to make those words become italic.</p>
<p>See the difference?</p>
<p>There are two reasons why I&#8217;m telling you this. First: because many professional website designers get all up in arms when someone accidentally calls HTML &#8220;code&#8221; (I&#8217;m not one of them, though). And my personal favorite: &#8220;markup language&#8221; sounds much less complex and threatening than &#8220;code&#8221; does.</p>
<p>Here are some examples of the HTML markup language:</p>
<p><strong>&#60;h1&#62; &#60;/h1&#62;</strong> &#8211; These make a heading for you.</p>
<p><strong>&#60;p&#62; &#60;/p&#62;</strong> &#8211; These make a paragraph for you.</p>
<p><strong>&#60;em&#62; &#60;/em&#62;</strong> &#8211; This pair changes text to <em>italics</em>.</p>
<p><strong>&#60;strong&#62; &#60;/strong&#62;</strong> &#8211; This pair changes text to <strong>bold</strong>.</p>
<p>Simple, right? And not as hard as code!</p>
<p>Most tags come in pairs; an opening tag and a closing tag. You can tell which one is the closing tag because it has a &#8220;/&#8221; and it comes at the end.</p>
<p>To make some text bold using HTML all you have to do is surround that text with &#60;strong&#62;&#60;/strong&#62;. Like this:</p>
<p>&#60;strong&#62;This is bold text&#60;/strong&#62;</p>
<p>Which produces this: <strong>This is bold text</strong></p>
<p>Got it? Good! Moving on&#8230;</p>
<h2>XHTML &#8211; Text on even more caffeine</h2>
<p>XHTML is actually a combination of XML and HTML and has become the new standard for building websites. I won&#8217;t bore you to tears with the long history nor will I try to explain the advanced features of XHTML. It&#8217;s simply enough to say that when you are ready for the advanced features of XHTML, they will be waiting for you.</p>
<h2>I&#8217;ll be teaching you XHTML</h2>
<p>All of the lessons and tutorials on Newbie Website Design will actually be built using XHTML since the foundation of XHTML is HTML itself! This means that all of your websites can enjoy all the beauty that HTML has to offer and still be up-to-date with the latest standards.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.newbiewebsitedesign.com/what-is-html-and-xhtml/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

