WRITING MARKUP WITH HTML AND XHTML

2:53:00 PM |

Programming Web

What would the Web be without web pages? What are web pages, anyway? It’s obvious
that web pages have a lot of stuff in them and that they consist of a variety of
different kinds of this stuff. For instance, lots of web pages have text, and lots also
have images. Some web pages have videos. Yet others have tables full of price lists or
comparison charts.
All this stuff that’s in web pages consists of, like the Lego sets you may have played
with as a child, lots of different pieces, called elements, that when put together in a
certain way result in the page you see. Thus, a single web page can really be broken
down into many different individual elements. In fact, that’s exactly what web developers
do when they build web pages—they put lots of different pieces together in a certain way.Before we show how to start building whole web pages, though, we’ll first talk about these individual elements and show how they fit together.

What are web pages, really?
It may take you by surprise that even though the web pages you look at are full of
pictures and videos and things like that, underneath it all every page is just a single
(albeit possibly very long) string of text. Not all of it is in English, of course, because
computer programs such as your web browser don’t actually speak or understand

English. Nevertheless, your web browser does understand a kind of language, the Hypertext Markup
Language (HTML).
When you go to a website in your web browser, you’re actually telling your web browser to download
a file. This file, called an HTML document, is nothing more complicated than a bunch of text that’s
written in this HTML that your web browser knows how to read. The HTML you download is then
interpreted by your web browser and displayed to you as a web page.
If it’s all just a single string of text, you might be wondering, how does the web browser know that a
picture should go in the top-left corner or that these two pieces of text are in different paragraphs?
The answer is that in addition to all the content that’s in the HTML document (such as the text of the
two paragraphs), there’s also information about the content. This information about the content isn’t
actually visible on the web page, but trust us. It’s there.
It’s all that extra information, called markup, that tells the web browser what kinds of things the content
pieces are, where they begin and where they end in that long string of text, and what they are
called.
If you think about it for a moment, you’ll realize that this isn’t so different from what you do whenever
you write a letter or talk to your friends on the phone. When you write a letter, you usually end
it with your name on a line of its own, and readers can recognize that part of the letter as identifying
the sender. Similarly, you don’t say “period” at the end of every sentence when you talk to your
friends; you just kind of lower your tone a little. Your friends know that this means you’re done
talking.
Web browsers do the same thing, only they don’t have tone of voice or lines of text in specific places
(like the end) to go by to get these hints about what the content they have is. Instead, they use all that
invisible markup to figure it out.


0 comments: