Professional Documents
Culture Documents
Web Development Lec 2
Web Development Lec 2
Web Development Lec 2
The World Wide Web is about communication between web clients and
web servers.
Clients are often browsers (Chrome, Edge, Safari), but they can be any type
of program or device.
Servers are most often computers in the cloud(refers to servers that are
accessed over the Internet, and the software and databases that run on those
servers).
HTTP Request / Response
HTML uses predefined tags and elements that tell the browser how to display
the content. HTML elements include an opening tag, some content, and a
closing tag.
Remember to include closing tags. If omitted, the browser applies the effect
of the opening tag until the end of the page.
HTML Page Structure
The basic structure of an HTML page is shown below. It contains the essential
building-block elements (i.e. doctype declaration, HTML, head, title, and
body elements) upon which all web pages are created.
HTML History
An HTML element is a start tag and an end tag with content in between:
<h1>This is a Heading</h1>
The purpose of a web browser (Chrome, Edge, Firefox, Safari) is to read HTML
documents and display them correctly.
A browser does not display the HTML tags, but uses them to determine how to
display the document:
HTML Editors
Web pages can be created and modified by using professional HTML editors.
However, for learning HTML we recommend a simple text editor like Notepad
(PC) or TextEdit (Mac).
A Simple HTML Document
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
</body>
</html>
Example Explained
The HTML document itself begins with <html> and ends with </html>.
The visible part of the HTML document is
between <body> and </body>.
HTML Headings
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
Never Skip the End Tag
Some HTML elements will display correctly, even if you forget the end tag:
<html>
<body>
<p>This is a paragraph
<p>This is a paragraph
</body>
</html>
However, never rely on this! Unexpected results and errors may occur if
you forget the end tag!
Empty HTML Elements
<!DOCTYPE html>
<html>
<body>
</body>
</html>
HTML is Not Case Sensitive
HTML tags are not case sensitive: <P> means the same as <p>.
The HTML standard does not require lowercase tags,
HTML Tag Reference
Tag Description
<html> Defines the root of an HTML
document
<body> Defines the document's body
<h1> to <h6> Defines HTML headings
HTML Attributes
The <a> tag defines a hyperlink. The href attribute specifies the URL of the page the link goes to:
Example:
<a href="">Name of the website</a>
The style Attribute
The style attribute is used to add styles to an element, such as color, font, size, and more.
Example:
<p style="color:red;">This is a red paragraph.</p>
HTML Headings
Search engines use the headings to index the structure and content of your web pages.
Users often skim a page by its headings. It is important to use headings to show the document structure.
<h1> headings should be used for main headings, followed by <h2> headings, then the less important <h3>, and so on.