Does it sound weird? Well this, however, is the head and the body (it's not an intern expression, just a way for me to tell you that it's both head and body). Let's begin-this will be your first webpage!
HeadFirst off, let's fill the head with content. How do we do this? It's easy! Just-simply-put in the head-info between the head-tags as following:
<head>
INSERT YOUR HEAD-CONTENT HERE!
</head>
Doesn't that make a picture, eh? However, this isn't very good code, it's just "
INSERT YOUR HEAD-CONTENT HERE!", and we don't want that, eh? Let's piff it up a little bit-let's make a title:
<head>
<title>My First Webpage!</title>
</head>
This will effect the web browser in that way so that the name-list (the bar where the "_ ? X"-minimise, maximise, close window) will display your word in stead of "
Internet Explorer" or what it, to a default, would say. You could also say that the title-tag defines the webpage's name.
Now, all we got to do is to save this file with an html extension. Name the file
index.html
and we can continue.
Note: Did you notice the space before the title-tag? This is a kind of organising which are often used by scripters to easier figure out to what it belongs and stuff. More about this in a later section.Now, open up your saved file and look at the browsers name-list. Can you see your own text? Can you see
My First Webpage!
or not? Hope so! If it didn't, you must have made something wrong. Maybe you forgot to save it with the right extension-although, if that were the problem, you probably wouldn't have been able to open it up in the browser at all.
However, this is how it should look on an IE (Internet Explorer) browser.
Goody goody, eh? Now it's our own title displayed in the name-list! However, this was all for now on this point-let's continue with the in-between the body-tags.
BodyEverything has a body-even a website! As you should already know, the body is where all the visible content is (plus, of course, comments) and also where most of the work is done. Let's start with putting in one or two paragraphs of "
Lorem Ipsum" and see what happens. Are you ready?
First of all, open up your HTML file again-unless it's already up:
index.html
Now let the title-tag in the head stay and go directly to the body. Fill in one paragraph of "
Lorem Ipsum"
<body>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec imperdiet fermentum tellus.
Mauris egestas nisl quis purus. Vivamus laoreet nibh iaculis dui. Suspendisse pulvinar,
metus ac condimentum suscipit, mauris lectus ultrices ligula, vitae cursus neque felis et wisi.
In hendrerit turpis ut quam. Nam id sapien eu metus gravida dictum. Suspendisse mattis consequat
turpis. Nullam eleifend, eros sit amet faucibus rhoncus, justo tortor scelerisque nulla,
eget mollis urna dolor et diam. Aliquam dui eros, euismod ac, scelerisque non, pharetra eu,
ligula. Ut id felis. Ut in pede sed ante lobortis commodo. Morbi aliquam consectetuer ante.
Quisque tempus mattis orci. Aenean fringilla, tortor ac pharetra interdum,
sapien neque ultrices mauris, eget pharetra odio quam non enim. Fusce venenatis lacus.
Sed scelerisque tortor et eros. Suspendisse tempor, est et venenatis hendrerit,
est tortor auctor pede, eu ultricies magna eros eget quam.</p>
</body>
and then save the file and open it in your web browser again. How does it look? You can see the tex, right? Although, it's not very nice to look at as it's only text on a plain white background, right? Want to fix this? Well, FORGET IT! At least for a couple of lessons. We'll come to designing with just HTML and with CSS-but not just yet! Okay, I know it won't make much difference, but as I said earlier, we're going to insert TWO "
Lorem Ipsum" paragraphs, and not just one. So let's arrange this by putting in the next paragraph to:
<body>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec imperdiet fermentum tellus.
Mauris egestas nisl quis purus. Vivamus laoreet nibh iaculis dui. Suspendisse pulvinar,
metus ac condimentum suscipit, mauris lectus ultrices ligula, vitae cursus neque felis et wisi.
In hendrerit turpis ut quam. Nam id sapien eu metus gravida dictum. Suspendisse mattis consequat
turpis. Nullam eleifend, eros sit amet faucibus rhoncus, justo tortor scelerisque nulla,
eget mollis urna dolor et diam. Aliquam dui eros, euismod ac, scelerisque non, pharetra eu,
ligula. Ut id felis. Ut in pede sed ante lobortis commodo. Morbi aliquam consectetuer ante.
Quisque tempus mattis orci. Aenean fringilla, tortor ac pharetra interdum,
sapien neque ultrices mauris, eget pharetra odio quam non enim. Fusce venenatis lacus.
Sed scelerisque tortor et eros. Suspendisse tempor, est et venenatis hendrerit,
est tortor auctor pede, eu ultricies magna eros eget quam.</p>
<p>Proin eu felis. Curabitur ipsum tortor, auctor sit amet, sollicitudin eu, lobortis sed,
leo.
Suspendisse a odio vel pede commodo mollis. Sed sagittis nibh id ante. Integer iaculis lacus.
Proin ut pede eu lectus tristique porttitor. Duis sed sapien. Aenean risus nulla,
facilisis ut, placerat eu, convallis et, pede. Etiam odio odio, suscipit eget,
bibendum a, venenatis et, urna. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Ut vel mauris. Nam at lectus eget ante lobortis lobortis. Cras erat nulla, dictum nec,
placerat aliquet, semper ut, turpis. Ut condimentum. Vivamus est tellus, rhoncus at,
lacinia euismod, adipiscing vestibulum, turpis. Sed sed lectus.
Mauris pellentesque interdum ante. Curabitur ut magna quis nunc vehicula pellentesque.</p>
</body>
Now we have inserted one more paragraph so that the "
Lorem Ipsum" has become a bit bigger. Now let's take another look. Do you see what the paragraph-tags do to the text? You see it makes a row-jump without even having to input a tag for it!
Now you know what a what a head and a body is in HTML and what's supposed to go in them. In the head, put important stuff that's non-visible for the visitors of your page, and in the body, put stuff to be seen on the page! Now, let's move on-it's time to learn a bit about organising your script!