Professional Documents
Culture Documents
Hypertext Markup Language is the most widely used language to write Web Pages. Hypertext
refers to the way in which Web pages are linked together. Thus, the link available on a webpage
is called Hypertext. HTML is being widely used to format web pages with the help of different
tags available in HTML language. Using html you can simply mark-up a text document with tags
that tell a Web browser how to structure it to display.
To learn HTML, you will need to study various tags and understand how they behave, while
formatting a textual document. Learning HTML is simple as users have to learn the usage of
different tags in order to format the text or images to make a beautiful webpage. In html various
tags are available to format the content of a web page. These tags are enclosed within angle braces
<Tag Name>. Except few tags, most of the tags have their corresponding closing tags. Widely
used html tags are summarized in the following table
Represents a paragraph
<p> </p>
Offers a way to structure your text into different
paragraphs
Line break tag
Anything following it starts from the next line
<br /> Not need
Has a space between the characters br and the
forward slash
Put any content in the center of the page or any
<center> </center>
table cell
Used to visually break-up sections of a document
<hr /> Not need
Creates a line from the current position in the
document to the right
Preserve the formatting of the source document
<pre> </pre>
Follow the exact format of how it is written in the
html document
Attribute names and attribute values are case-insensitive. The essential attributes that can be used
on the majority of HTML elements are described in the following table.
The <style> tag is used to define style information for an HTML document. Inside the <style>
element you specify how HTML elements should render in a browser. Each HTML document
can contain multiple <style> tags. To link to an external style sheet, it use the <link> tag. Style
tag attributes are presented in the following table.
Attribute Value Description
Specifies what media/device the media resource is
media media_query optimized for
The following html code shows how to use <style> element in an HTML document
<head>
<style type = "text/css">
.mycss { color: red;
<tr>
<td> Used to create data cells <td>Row 2, Column 1</td>
<td>Row 2, Column 2</td>
</tr>
</table>
<tr>
<th>Name</th>
<th> Define a table heading <th>Salary</th>
</tr>
<thead>
<tr>
<thead> Create a separate table header <td colspan = "4">……</td>
</tr>
</thead>
<tbody>
<tr>
<tbody> Indicate the main body of the table <td>…………………</td>
</tr>
</tbody>
<tfoot>
<tr>
<tfoot> Create a separate table footer <td colspan = "4">.....</td>
</tr>
</tfoot>
<table border = "1" width =
caption A title or explanation for the table and "100%">
it shows up at the top of the table <caption> Internet
Programming</caption>
2.10.2 Frames
2.10.3 Layouts
A Webpage layout is very important to give better look to your website. It takes considerable time
to design a website's layout with great look and fee. You can create a good layout using simple
HTML tables or division tags in combination with other formatting tags.
Example 1: A webpage layout using html table tag
<body>
<table width = "100%" border = "0">
<tr>
<td colspan = "2" bgcolor = "#b5dcb3">
<h1>This is Web Page Main title</h1>
</td>
</tr>
<tr valign = "top">
<td bgcolor = "#aaa" width = "20%">
<b>Main Menu</b><br />
HTML<br />
PHP<br />
You activate a hyperlink by clicking a designated bit of text or a graphic that, depending on the
link, takes you to a different location on the page, opens a different Web page, starts an e-mail
message, downloads a file, lets you view a movie or listen to a sound clip, starts a Web-based
program, and so on. You have probably clicked thousands of hyperlinks, perhaps without thinking
much about the coding behind them.
No matter what type of hyperlink you want to create, the basic syntax is the same. It starts with
the <a> tag, and then uses an href= attribute which provides the URL or the path to the
destination. It has the following syntax:
The most important attribute of the <a> element is the href attribute, which indicates the link's
destination. The link text is the part that will be visible to the reader. Clicking on the link text, will
send the reader to the specified URL address. The following example shows how to create a link
to Werabe University Website:
<!DOCTYPE html>
<html>
<body>
<h1>HTML Links</h1>
<p><a href=" https://www.wru.edu.et/ ">Visit wru.edu.et </a></p>
</body>
</html>
By default, links will appear as follows in all browsers, but Links can of course be styled with
CSS, to get another look!
An unvisited link is underlined and blue
A visited link is underlined and purple
An active link is underlined and red
The target Attribute
By default, the linked page will be displayed in the current browser window. To change this, you
must specify another target for the link. The target attribute specifies where to open the linked
document. The target attribute can have one of the following values:
_self - Default. Opens the document in the same window/tab as it was clicked
_blank - Opens the document in a new window or tab
_parent - Opens the document in the parent frame
_top - Opens the document in the full body of the window
Example
<html>
<body>
Paths that contain a complete address that anyone can use to get to that page are called absolute
paths. Absolute paths are very reliable, but they are also long and awkward to type. For example:
<a href="https://www.wru.edu.et/institute-of-
technology/computer-science.html">Visit WRU CS</a>
When you are linking to files in the same Web site as the link itself, you do not need to include the
complete path to the file; you can simply provide its name. When the file is in the same folder, you
need only supply the file name. For example, if the home.html and registrar.html pages of The
Werabe University Web site were in the same folder, in the home.htm file, you could refer to
registrar.htm like the following:
This is called a relative path, because the destination file is relative to the current file’s location.
Relative paths make it easier to develop and test your Web site in a different file location than the
one where it will eventually be stored.
When creating a link to a file that’s stored in a subfolder of the current one, you can point to that
subfolder but otherwise leave the path relative. For example, suppose that index.htm is stored in a
folder called c:\main, and foliage.htm is stored in c:\main\articles, which would be considered a
subfolder (or child folder) of it. To refer to foliage.htm from within index.htm, you would use a
tag like this:
You can also create a link to a file that is up one level (a parent folder) with a relative reference.
For example, suppose you wanted to refer to index.htm from within foliage.htm (both in the same
<a href="../index.htm">Home</a>
<!DOCTYPE html>
<html>
<body>
<h2>Image as a Link</h2>
</body>
</html>
Link Titles
The title attribute specifies extra information about an element. The information is most often
shown as a tooltip text when the mouse moves over the element.
Example
<html lang="en-US">
<body>
<h2>Link Titles</h2>
</body>
</html>
The <img> tag is used to add or embed the images to a webpage/website. The “img” tag is an
empty tag, which means it can contain only a list of attributes and it has no closing tag. The addition
of the images improves the quality along with enhancing the design structure, appearance of the
webpage. Nowadays, a website does not directly add images to a web page, as the images are
linked to web pages by using the <img> tag which holds space for the image.
Example
o If you have your images in a sub-folder, you must include the folder name in the src
attribute:
o Some web sites point to an image on another server.To point to an image on another
server, you must specify an absolute (full) URL in the src attribute:
<img src="https://www.w3schools.com/images/w3schools_green.jpg"
alt="W3Schools.com">
Example
height and width: Iused to specify the height and width of the image.
Example
The width, height, and style attributes are all valid in HTML. However, we suggest using
the style attribute. It prevents styles sheets from changing the size of images:
Example
Image Floating:- Use the CSS float property to let the image float to the right or to the left of
a text
Example
Here are the most common image file types, which are supported in all browsers (Chrome, Edge,
Firefox, Safari, Opera):
There are three basic html elements which are required for creating a mapped image.
Determining Image size: - determining the size of the image is very important because if the
size of the image is changed then the area coordinates will also require updating.
Determine the coordinates of the areas that you want to map: - It can be done in three shapes
which are rectangle, circle and polygon.
Example
<!DOCTYPE html>
<html>
<body>
<h2>Image Maps</h2>
<p>Click on the computer, the phone, or the cup of coffee to go
to a new page and read more about the topic:</p>
<img src="workplace.jpg" alt="Workplace" usemap="#workmap"
width="400" height="379">
<map name="workmap">
<area shape="rect" coords="34,44,270,350" alt="Computer"
href="computer.htm">
<area shape="rect" coords="290,172,333,250" alt="Phone"
href="phone.htm">
<area shape="circle" coords="337,300,44" alt="Cup of coffee"
href="coffee.htm">
</map>
</body>
</html>
To add a background image on an HTML element, use the HTML style attribute and the CSS
background-image property:
If you want the entire page to have a background image, you must specify the background image
on the <body> element:
Example
<!DOCTYPE html>
<html>
<head>
<style>
body {
background-image: url('img_girl.jpg');
}
</style>
</head>
<body>
<h2>Background Image</h2>
<p>By default, the background image will repeat itself if it
is smaller than the element where it is specified, in this
case the body element.</p>
</body>
</html>
3. Background Cover
This way, the background image will cover the entire element, with no stretching (the image will
keep its original proportions):
Example
<style>
body {
background-image: url('img_girl.jpg');
background-repeat: no-repeat;
background-attachment: fixed;
background-size: cover;
</style>
4. Background Stretch
If you want the background image to stretch to fit the entire element, you can set the background-
size property to 100% 100%:
Example
<style>
body {
background-image: url('img_girl.jpg');
background-repeat: no-repeat;
background-attachment: fixed;
</style>
HTML Marquee
The <marquee> tag in HTML is used to create scrolling text or image in a webpages. It scrolls
either from horizontally left to right or right to left, or vertically top to bottom or bottom to top.
Syntax: The marquee element comes in pairs. It means that the tag has opening and closing
elements.
<marquee>
</marquee>
direction Top, Down, Left, Right Define the direction of scrolling the content
1. start (): This method is used to start the scrolling of the Marquee Tag.
2. stop (): This method is used to stop the scrolling of the Marquee Tag.
Example
<!DOCTYPE html>
<html>
<head>
<title>Marquee Tag</title>
<style>
.main {
text-align:center;
}
.marq {
padding-top:30px;
padding-bottom:30px;
}
.geek1 {
font-size:36px;
font-weight:bold;
color:white;
padding-bottom:10px;
}
</style>
</head>
<body>
<div class = "main">
<marquee class="marq" bgcolor="White" direction="left"
loop="" >
HTML Multimedia
Multimedia comes in many different formats. It can be almost anything you can hear or see, like
images, music, sound, videos, records, films, animations, and more. Multimedia on the web is
sound, music, videos, movies, and animations. Web pages often contain multimedia elements of
different types and formats.
Multimedia Formats
Multimedia elements (like audio or video) are stored in media files. The most common way to
discover the type of a file, is to look at the file extension. Multimedia files have formats and
different extensions like: .wav, .mp3, .mp4, .mpg, .wmv, and .avi.
There are many video formats out there.The MP4, WebM, and Ogg formats are supported by
HTML. The MP4 format is recommended by YouTube.
MP3 is the best format for compressed recorded music. The term MP3 has become synonymous
with digital music. If your website is about recorded music, MP3 is the choice.
Example 1
<html>
<body>
<video width="320" height="240" controls>
<source src="movie.mp4" type="video/mp4">
<source src="movie.ogg" type="video/ogg">
Your browser does not support the video tag.
</video>