Anda di halaman 1dari 5

HTML

SEMINAR 1
HTML is an acronym derived from Hypertext Markup Language, which is the name
of a language in which web pages are written. Web pages are HTML files with the
extension ".html" or ".htm". Being a markup language, HTML does not use
instructions (as Pascal, VB or C programming languages) or commands (like Fox
does), but labels, which are called balises, or tags.
Any HTML document begins with the tag <html> and ends with the tag </ html>.
By convention, all information starts with an open angle bracket "<" and ends with
an angle bracket ">". Tags of these brackets transmit commands to the browser to
display the page in a certain way.
A tag may have one or more attributes with certain values. For example, a tag with
two attributes is as follows:

<Tag_name attribut1 = "value1" attribut2 = "value2">

The general structure of a file with HTM or HTML extension is:

The beginning and the


<html> end of html document
<head>

<title> ……………</title> The header


The title

</head>

<body>
…….. Document content
……..
……..
</body>
</html>

HTML is not case sensitive, meaning a label can be written both lowercase and
uppercase.
Example: <HTML> = <html> = <html>.
Characters "space" and "CR / LF" (carriage return & line feed = end of line and
new row) displayed between the beginning tag and the end tag of an HTML
element are ignored by the browser. For example, if you enter more lines in an
HTML document, the browser will display everything on one line, because the
characters "CR / LF" are ignored by the browser. Switching to a new line must be
an explicit command, which must appear on the html page. This command is given
by the <br> element (from "break row" - line break).

The simplest way to create a web page:

1. Start NOTEPAD App.

2. Edit the source code (HTML elements) in Notepad text editor.

1
HTML
Save the source code as a file with the extension HTM or HTML (required). The
file will be saved in a known location.

File Save As

3. Find the file saved in step 2 with the Windows Explorer (the file will have
distinctive icon: ).

4. Run the file with the extension HTM or HTML (to see how the tags written
in Notepad are interpreted Internet) - double click on the file and it will open
in the default browser application.

If there is no mark "<" and ">" in the content of a web page, then the HTML parser
will interpret it as simple text and displays it accordingly on the screen.
The content of the element <title> ... </ title> will appear in the title bar of your
browser window. If this element is missing in an HTML page, then in the title bar
of the browser window the name of HTML file will appear.
Preformatted blocks
For the browser to correctly interpret the characters "space", "tab" and "CR / LF"
that must be displayed in an web page, this text should be included inside the
element <pre> ... </ pre>.
<html>
<head>
<title>Preformatted block </title>
</head>
<body><pre>
First line
Second line
Third line

2
HTML
</pre></body>
</html>

Background color of an web page


A color may be specified in 2 ways:
 By using a color name. There are al least 16 color name available: aqua,
black, fuchsia, gray, green lime, maroon, navy, olive, purple, red, silver,
teal, white and yellow.
 By "#rrggbb" construction where r (red), g (green), and b (blue) are
hexadecimal characters: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, A, b, B, c, C, d, D, e,
E, f, F; in this way one may define 65536 colors.

The color of the background of an webpage may be specified using the bgcolor
attribute of <body> HTML element. The following example creates an web page
with gray background.

<html>
<head>
<title>Background of the web page </title>
</head>
<body bgcolor=gray>
This is an web page with gray background!!!
</body>
</html>

Displaying and formatting text blocks


Elements for text blocks:
These elements does not refer to the particularities of characters that compose the
text, but to the functions that a block of text may have within a Web page.

1. Paragraphs inside a document:


The <p> tag defines a paragraph.
<html>
<head>
<title> Paragraphs blocks</title>
</head>
<body>
First line of document
<p>First paragraph of the document.</p>
<p style=”align:right”> The text in this paragraph is aligned to the right
margin of the document. </p>
</body>
</html>

3
HTML
Browsers automatically add some space (margin) before and after each <p>
element. The margins can be modified with CSS (with the margin
properties).

2. Title blocks
In a text, chapter headings can be entered using tags: <Hi>.......</Hi>, where
i may take values from 1 to 6. <h1>, <h2>, <h3>, <h4>, <h5>, <h6>.

<h1> defines the most important heading, <h6> defines the least important
heading.

3. Divisions inside a HTML document:


The <div> tag defines a division or a section in an HTML document. The <div>
tag is used to group block-elements to format them with CSS.

<div style="color:#0000FF">
<h3>This is a heading of the document</h3>
<p>This is a paragraph inside this section.</p>
</div>

4. HTML 5 elements to organize the structure of a page


 <section> - defines a section inside an HTML document
 <header> - defines a header for a document or a section
 <hgroup> - can be used to group h1 ... h6 heading elements
 <nav> - defines an area for a possible navigation menu inside a document
 <article> - defines a section for an article that presents multiple sections
of the document.
 <aside> - defines a lateral area in relation to the content of the document
 <footer> - the area for displaying the footer of the document.

4
HTML
In order to group inline-elements inside a block of text the <span>…</span>
element may be used. It provides no visual change by itself. In exchange, it
provides a way to add a hook to a part of a text or a part of a document. When a
text is hooked in a <span> element, you can style it with CSS.

Example:
<p>I have a <span style="color:blue">difficult</span>
exam.</p>

Anda mungkin juga menyukai