Documentos de Académico
Documentos de Profesional
Documentos de Cultura
What is HTML?
y HTML or HyperText Markup Language, is how a World Wide
Web browser displays multimedia documents. The documents themselves are plain text files with special tags or codes that the WWW browser (e.g. Netscape, Internet Explorer) knows how to interpret and display on your screen.
About HTML?
y Hyper Text Markup Language.
Constitutes a collection of platform independent styles
that define the various components of a web document. Styles indicated by markup tags.
y What is HTML really?
Plain-text documents can be created using any text
commands in the text. To describe how the text should be displayed / printed.
HTML Tags
y The left and right angle brackets (< and > signs )
are used to enclose all special instructions, called tags. y Two classes of tags:
Those which appear in pairs.
<img src=baby.jpg> y Browsers interpret the tags to display a HTML page in properly formatted form.
what to do and when to do it. The first part of the tag <tag name> turns the tag on The ending part of the tag, </tag name>, contains the "/" slash character. This "/" slash tells a WWW browser to stop tagging the text. Many HTML tags are paired this way. Think of the tag as a container. If you forget the backslash, a WWW browser will continue the tag for the rest of the text in your document,producing undesirable results.
Some points
y HTML files must end with the extension .htm or .html y Tags are case insensitive
document. y Why? Browsers have to reformat the document to fit in the current display area.
y It is good practice to use white spaces in a HTML
define some additional characteristics of the tag. <body text=#FFFFFF bgcolor=#0000FF> <body text=white bgcolor=blue>
<!--- A comment here ---> <!--- Another comment in two lines --->
Head
Contains information about the document, like the title and meta data describing the contents.
Body
Contains the actual matter of the document. Gets displayed within the browser window.
<html> </html>
Used to bracket an entire HTML document. <html> is an opening tag </html> is a closing tag (note the direction of the slash!) text between the opening and closing tag is called the element
<head> </head>
placed at the top of document immediately after the <html> tag Used to provide information about a web page. Nests within itself other tags like <meta> and <title>.
13
<body> </body>
included as the second element inside the <html></html> tags. follows the <head></head> portion of the document contains the information to be displayed in the browser window any attributes set on this tag will apply to the entire page
14
Body Section
Attributes Attribute
Content name
Value
Text author description keywords
description
Specifies the content of the meta information Provides a name for the information in the content attribute
Example
<head> <meta name="description" content="Free Web tutorials" /> <meta name="keywords" content="HTML,CSS,XML,JavaScript" /> <meta name="author" content="Hege Refsnes" /> </head>
body.
<body> . </body>
y Attributes: y background=url specifies an image file to be used as tiling background. y bgcolor=color Sets the background color of the document. y text=color Sets the default color for the normal text in the document. y alink=color Sets the color of active links in the document. y link=color Sets the default color for all the links in a document. y vlink=color Sets the color for the visited links in the document.
Example:
aqua black blue fuchsia gray green lime maroon navy olive purple red silver teal yellow white
y y
y <P>.</p> y Paragraph marker, used to separate text into paragraphs. y End tag </P> is optional. y A series of paragraph tags <p> <p><p> with no intervening text is treated as a single <p>.
y <P>
Attributes
Attribute Align Value left right center justify description Specifies the alignment of the text within a paragraph
Example <p align= left >This is the first paragraph.</p> <p align=center>This is another paragraph.</p>
y <BR>
Used to indicate that the text following <BR> should begin on the next line. y The amount of line spacing is less than that of a <P> break. y Example:
y
This is the first line. <br> This is the second line. <br> This is the third.
Example
y <HR> y Produces a horizontal line, which can be used to delimit sections. y Length of the line can be specified. y Attributes
Attribute Align
Size Width
y <HR> Examples:
Example
y <address> . </address> y Supplies the contact information of the author. y Generally formatted in italics, with a line break above and below. y Example:
<address> Prof. Indranil Sen Gupta <br> Dept. of Computer Science & Engg. <br> I.I.T. Kharagpur, INDIA <br> Email: isg@hotmail.com </address>
Example
Appearance of Text
y <b> . </b>
y y
y <i> . </i>
y y
y <u> . </u>
y y
y <sub> . </sub> y Displays the enclosed text as subscript. y <sup> . </sup> y Displays the enclosed text as superscript. y <center> . </center> y Centers the enclosed elements horizontally on the page
Attribute
Color
Value rgb(x,x,x)
#xxxxxx color name font_family number
description
Specifies the color of text
Face Size
Specifies the font of text Specifies the size of text [1 to 7; 3 is the default] [can also specify as +n or n]
Example
<font size="3" face="verdana" color="green">This is some text!</font>
y <pre> . </pre> y Allows browser to display carefully laid out text. y Text in a pre element is displayed in a fixed-width font , and it preserves both spaces and line breaks. y Example:
Example 1
<html> <head> <title> Title of the Document </title> </head> <body text="white" bgcolor=blue> This is the content of the document. This is an <i> italic </i> font, and this is <b> bold </b>. </body> </html>
Example 2
<html> <head><title>Demonstration of Headings </title></head> <body text="#FFFFFF" bgcolor="#0000FF"> <h1>This is a first level heading. </h1> <h2>The second level</h2> <h3>The third level</h3> <h4>Fourth level. </h4> <h5>Fifth level.</h5> <h6>And, finally, the sixth .</h6> A small amount of plain non-heading text. </body> </html>
Example 3
<html> <head><title>Paragaph Aligning</title></head> <body text=white bgcolor=blue> <h3> <P ALIGN=CENTER> This paragraph will be aligned at the center. Even as the browser window size changes, the alignment remains the same. </P> <P ALIGN=LEFT>This demonstrates left alignment. </P> <P ALIGN=RIGHT>How about aligning by the right margin? </P> </h3> </body> </html>
Example 4
<html> <head><title>Layout Features 1</title></head> <body text=yellow bgcolor=blue> <h2> <pre> begin if (a > b) then max := a; else max := b; end; </pre> </h2> <hr size=8 width=50%> <hr> <hr size=20 width="75%" noshade> </body> </html>
Example 5
<html> <head><title> Superscript and Subscript </title></head> <body text=white bgcolor=blue> <h1> y = x <sup> 3 </sup> + 2 x <sup> 2 </sup> + 4 </h1> <br> <h2> W <sub> total </sub> = x <sup> 2 </sup> - 5 <h2> </body> </html>