Tuesday, 23 December 2014

Structuring Documents for the Web

Together, the <html>, <head>, and <body> elements make up the skeleton of an HTML document—
they are the foundation upon which every web page is built.
Inside the <head> element of the first example page, you see a <title> element:
<head>
<title>Popular Websites: Google</title>
</head>
Between the opening <title> tag and the closing </title> tag are the words “Popular Websites:
Google,” or the title of this web page. Figure 1-1 shows the words at the top of the browser window,
which is where browsers such as Internet Explorer, Firefox, and Chrome display the title of a document.
It is also the name they use when you save a page in your Favorites List, and it helps search
engines understand what your page is about. The <title> element is mandatory for all web pages.
The real content of your page is held in the <body> element, which is what you want users to read,
and this is shown in the main browser window.
WARNING The <head> element contains information about the document, which
is not displayed within the main page. The <body> element holds the actual content
of the page viewed in your browser.
You may have noticed that the tags in this example appear in a symmetrical order. If you want to
have one element inside another, both the element’s opening and closing tags must be inside the
containing element. For example, the following is allowed:
<p> This paragraph contains some <em>emphasized text.</em></p>
whereas the following is wrong because the closing </em> tag is not inside the paragraph element:
<p> This paragraph contains some <em>emphasized text. </p></em>
In other words, if an element is to contain another element, it must wholly contain that element.
This is referred to as nesting your elements correctly.
Attributes Tell You about Elements
Attributes in HTML are much like the attributes you experience every day. They are the qualities
that describe a person or thing, such as a tall man or a brown dog. Similarly, HTML elements can
be described in ways that web browsers can understand. This section looks at attributes, starting
with the most important one that beats at the heart of the web.
What differentiates web documents from standard documents are the links (or hyperlinks) that take
you from one web page to another. Look at a link by adding one to the example you just looked at.
Links are created using an <a> element. (The a stands for anchor.)

No comments:

Post a Comment

SQL Server Services and Tools

  Microsoft provides both data management and business intelligence (BI) tools and services together with SQL Server. For data management, S...