Sams Teach Yourself HTML, CSS & JavaScript Web Publishing in One Hour a Day

(singke) #1
ptg16476052

46 LESSON 3: Introducing HTML and CSS



Not all HTML tags have both an opening and a closing tag. Some tags are only one-
sided, and still other tags are containers that hold extra information and text inside the
brackets. You’ll learn the proper way to open and close the tags as the book progresses.
Some HTML tags have additional text inside them that provides additional information
about the tags. These are called attributes, and they are usually defined as name=value
pairs that follow the tag name separated by a space. An HTML tag with an attribute looks
something like this:
<thetagname theattribute="theattributevalue">affected text</thetagname>
HTML tags are not case sensitive; that is, you can specify them in uppercase, in lower-
case, or in any mixture. So, <HTML> is the same as <html>, which is the same as <HtMl>.
This is true for attributes as well.

Exercise 3.1: Creating Your First HTML Page


Now that you’ve seen what an HTML tag looks like, it’s your turn to create a web page
that uses a few. Start with a simple example so that you can get a basic feel for HTML.
To get started writing HTML, you don’t need a web server, web hosting, or even a con-
nection to the Internet. All you really need is an application in which you can create your
HTML files and a browser to view them. You can write, link, and test whole suites of
web pages without even touching a network. In fact, that’s what you’re going to do for
the majority of this book. Later, I discuss publishing everything on the Web so that other
people can see your work.

Many word processors are including HTML modes or mechanisms
for creating HTML or XML code. This feature can produce unusual
results or files that simply don’t behave as you expect. Using a word
processor to generate HTML is not a good idea if you plan on editing
the web pages later. They also don’t provide the opportunity to learn
HTML, so they make a poor companion for this book. When you work
on the examples in this book, you should use a regular text editor.

CAUTION

Open your text editor and type the following code. You don’t have to understand what
any of it means at this point. You’ll learn more about much of this in this lesson and the
following lesson. This simple example is just to get you started:
<!DOCTYPE html>
<html>
▼<head>
Free download pdf