Chap 02 - Intro To HTML
Chap 02 - Intro To HTML
Introduction to HTML
Prepared for:
CSC264 – Introduction to Web and Mobile Application
OVERVIEW OF THIS CHAPTER
HTML document is a plain text file that consists of HTML tags which can
be displayed by the web browsers
A HTML document may also include:
• Cascading style sheets (CSS):
Used for adding style to optimize the layout or look of web pages
• Javascript:
Used for on-page actions (will make web pages look dynamic)
• PHP:
Allows you to retrieve and display information from server
INTRODUCTION TO HTML
2. Web Browser:
To test your HTML tags
HTML VERSIONS
HTML Versions:
Since the early days of the web, there have been many versions of HTML:
To display a document correctly, the browser Version Year
must know the version of HTML used
HTML 1991
To do this, you need to declare the HTML 2.0 1995
HTML document HTML 3.2 1997
XHTML:
HTML TAGS
HTML Tags:
Are keywords (tag names) surrounded by angle brackets < >
The tag names tell the browser how to display the content
Inside it, you can put any information regarding your web page such as:
1. Title of your web page:
It is shown at the top of your browser window when the page is loaded
HTML PAGE STRUCTURE: HEAD
3. Other information that is relevant to your page such as the use of:
CSS, PHP,or Javascript
HTML PAGE STRUCTURE: BODY
The Document Body:
The HTML element for a document body is:
<body> content </body>
It contains all that can be seen when the user loads the page:
HTML STRUCTURE: BODY
Heading Tags:
There are 6 levels of heading in HTML:
Higher Level <h1> , <h2> , <h3> , <h4> , <h5> , <h6> Lower Level
The syntax for a heading:
<h1> content </h1>
Will create a space between any text or images preceding the enclosed text
Creates a
space
HTML STRUCTURE: BODY
Line Break Tag:
The syntax for line break tag (NO end tag):
<br> content
<body>
Only the <body> area is
<h1>This is a heading</h1> displayed by the browser:
<p>This is a paragraph</p>
Here is where you place
all of the tags, words, and
<p>This is another paragraph</p> graphics that comprise
</body> your page
</html>
HTML ATTRIBUTES
HTML Attributes:
Some HTML elements can have attributes
It provide additional information about an element
Are always specified in the start tag
Has the following syntax:
attributename = “value”
start tag
Attribute value
name
EXAMPLE
Property Purpose
background-color Used for background colour
color Used for text colour
font-family Used for text fonts
font-size Used for text sizes
text-align Used for text alignment
HTML ATTRIBUTES
Style Attribute (CSS):
Can also be
left or right
HTML ATTRIBUTES
Style Attribute (CSS):
HTML COMMENTS
HTML Comments:
Are text that will be ignored and not displayed by the browser
A comment has the following syntax:
For example:
HTML DATE AND TIME
HTML Date and Time:
Uses the <time> element in HTML:
Represents a machine-readable date, time, or duration
Useful for creating event scheduling, archiving,and other time-based
functions
HTML DATE AND TIME
HTML Date and Time:
For example:
<time> element
datetime attribute
HTML DATE AND TIME
HTML Date and Time:
The time element and datetime attribute have the following syntax:
For example:
< represents the sign <
> represents the sign >
© represents the copyright symbol ©