Jumat, 11 Oktober 2013

ayahsaba76.blogspot.com
you want to make a Web Page!
Lesson 9

Have a look at this...
<body>
Something        really        cool
</body>
Something really cool
The browser won't recognize more than 1 space. I know at first this might all seem pretty stupid for it to be this way, but really, it's better like this. It gives you absolute control over the document's appearance.
There is a nifty little code that means "space" to the browser: &nbsp;
Try this instead...
<body>
Something&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
really&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
cool
</body>
Something         really         cool
The & means we are beginning a special character, the ; means ending a special character, and the letters in between are sort of an abbreviation for what it's for. There are quite a few of these special characters. Here are five more. (Note: these should always be lower case.)
   &nbsp;   non-breaking space
   &lt;     < less-than symbol
   &gt;     > greater-than symbol
   &amp;    & ampersand
   &quot;   " quotation mark
You don't need to use them all the time, just when typing the real character would confuse the browser. How do you know when that is? No hard and fast 'rule' that I can think of. It will just come with a little practice and a few screw-ups. I will say this... the only ones you're really going to need to remember are the non-breaking space (because it's the simplest way to add a few spaces) and less-than & greater-than <> (because a stray one of those in your web page can really cause you some grief).
By the way, some thoughts on mistakes & screw-ups. There are those that are of the opinion that mistakes are bad. They are afraid to try anything new for fear of messing it up. Making the same mistake over and over might be a little dumb, but especially while you are learning, don't be afraid to screw everything all up. Mistakes are our friends :-) If you are not screwing something up then you are not learning anything and probably not doing anything. Remember, messing things up is a perfectly acceptable part of learning!
OK, enough babbling. There are other special characters too. You won't use them very often, but when you do need one, it's good thing to know.
Let's go over the last couple points real quick because if you're at all like me, it will get confusing. The browser will dispay your text in a steady stream unless you tell it otherwise with line breaks, etc. It will reduce any empty areas to 1 space. If you want more spaces, you must use the space code (&nbsp;). Here's a tidbit that we didn't cover... If you hit Return (or Enter) while you are typing, most browsers will interpret that as a space... unless there is already a space there.
One more quick example...
<body>
Something<br>really<br>cool<br>like<br>an<br>icecube!
</body>
Something
really
cool
like
an
icecube!
Pretty clear?? I hope so. I gave it my best shot!