Unit 2 Web Dev
Unit 2 Web Dev
(DHTML) mean?
While DHTML enhances the website user’s experience, the technology may
also be frustrating for users when it is used incorrectly. For example, a
website menu with flashy DHTML animations can easily confuse user
navigation. Another DHTML issue occurs when Web developers attempt to
create cross-browser DHTML, which is very difficult.
What is HTML?
Now, what is HTML? HTML stands for HyperText Markup Language.
I’m using Visual Studio Code, but you can use other programs like:
Notepad++
Sublime
Atom
Brackets
Now that you have the index file open in both your browser and your
editor, we’ll start writing some code!
HTML Tags
Let’s look at some of the basic features of HTML.
Tags are special text that you use to mark up, or distinguish,
parts of your web page. Hence the hypertext “markup” language.
These tags tell the browser to display whatever is inside the tag in a
specific way.
You can see that the words “extremely excited” are in these <b> tags–
“b” is for bold.
Now let’s save the file, and reload your browser. The text should look
like this:
Together, these two tags tell the browser to make whatever text is
between them bold. And that’s exactly what’s happened.
Now maybe this is obvious, but when the browser loads the HTML,
the tags themselves are invisible– they don’t show up on the page.
But for real HTML on the internet, we need to add some more tags to
the file in order for everything to work properly.
The very first tag you need is the doctype tag. It’s not exactly an
HTML tag, but it tells the browser that this is an HTML5 document.
This tag doesn’t require a closing tag because it’s not surrounding any
text, it’s just declaring that this is HTML.
Other doctypes that were used in the past are HTML 4 or XHTML. But
right now HTML 5 is really the only doctype used.
After the doctype, you have an HTML tag. This one tells the web
browser that everything inside it is HTML:
<!DOCTYPE html>
<html>
</html>
I know, it seems a bit redundant since you already used the HTML
doctype tag. But this tag ensures that everything inside it will inherit
some necessary characteristics of HTML.
Inside the main HTML tag, your content will usually be separated into
two sections: the Head and the Body.
<!DOCTYPE html>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
</body>
</html>
The head tag contains information about the website and it’s also
where you load CSS and JavaScript files. We won’t be covering those
today, but just so you know.
The body tag is the main content in the web page. Everything that
you see on the page will usually be in the body tag. So we need to
move that sentence we made at the beginning into the body.
<body>
</body>
When you reload the page in your browser, everything should look
exactly the same as before.
Now let’s go into some of the basic tags that are commonly used in
the head and in the body.
Part 1
Creating the Web Page
1.
1
Open a text editor. On a Windows computer, you'll usually use Notepad, or
Notepad++ whereas Mac users will use TextEdit:
o Windows - Open Start
2
Set up your document type for HTML. Type in < ! D O C T Y P E h t m l > and
press ↵ Enter , then type in < h t m l > and press ↵ Enter again. Finally, type
in < h e a d > and press ↵ Enter . The top of your document should resemble the
following: [1]
<!DOCTYPE html>
<html>
<head>
3
Add a tab title for your web page. This is the title which will appear on the
browser tab when you open the page (e.g., "Facebook"). Type in < t i t l e > ,
enter your web page's tab title, and type in < / t i t l e > . You'll then add the
closing "Head" tag, which is< / h e a d > , on its own line. The title section should
look like this:
<title>My Web Page</title>
</head>
4
Indicate the beginning of your page's body text. Type in < b o d y > below the
closed "Head" tag. This ensures that the rest of your document's text will be
considered website text until you close the "Body" tag. You should have the
following:
<body>
5
Create a page heading. Your page heading is the title which will appear at
the top of your website. To create one, type in < h 1 > , add your heading, and
then close the tag with < / h 1 > . For example:
<h1>Welcome to My Page!</h1>
6
Add additional headings as you go. There are six different headings that
you can create by using the < h 1 > < / h 1 > through < h 6 > < / h 6 > tags. For example,
to create three different-sized headings in succession, you might write the
following:
<h1>Welcome to My Page!</h1>
<h2>My name is Bob.</h2>
<h3>I hope you like it here.</h3>
7
Create a paragraph. Paragraph tags are used to create distinct blocks of text.
To place text in a paragraph, type in < p > and type in your text, then type
in < / p > to close the tag:
<p>This is my paragraph.</p>
o You can add multiple paragraph lines in a row in order to create a
series of paragraphs under one heading.
8
Change text color. You can change the color of any text by framing the text
with the</nowiki> tags, making sure to type your preferred color into the "color"
section (you'll keep the quotes). For example, to turn a paragraph's text blue,
you would write the following: [2]
<p><font color="blue">Whales are majestic
creatures.</font></p>
Note: the
<font>
tag is deprecated. You should use
<span style="color: (your color)">...</span>
instead.
o You can turn any text (e.g., headers) into a different color with this
set of tags.
o HTML supports a surprisingly large number of colors, so feel free
to experiment with different color names.
9
Format text with bold, italic, or underlining. Bold text, italic text, and
underlined text can be created with the < b > < / b > tags, the < i > < / i > tags, and
the < u > < / u > tags respectively. You can also create subscript text (used for
things like numbers before square roots) and superscript text (used for things
like squaring numbers): [3]
<b>Bold text</b>
<i>Italic text</i>
<u>Underlined text</u>
<sub>Subscript text</sub>
<sup>Superscript text</sup>
10
Add a picture to your page. You can use the < i m g s r c = " U R L " > < / i m g > tags
to embed an existing image in your web page. For example, if the image's
URL is "http://www.mypicture.com/lake", you would write the following:
<img src="http://www.mypicture.com/lake"></img>
11
Link to another page. You can add an link to another website by using the < a
h r e f = " l i n k " > l i n k t e x t < / a > tag set, where link is the URL for the website to
which you want to link and link text is the text that will act as the link. For
example, to link to Facebook, you would type the following: [4]
<a href="https://www.facebook.com">This is the link to
Facebook's website</a>.
12
Close the web page's tags. As with any tag in HTML, you'll have to close
the< b o d y > and < h t m l > tags that are at the top of your document by typing in
the following at the bottom of the document:
</body>
</html>
13
Review your web page. You can add more paragraphs, headings, and text
anywhere on the page in between the < b o d y > < / b o d y > tags if needed. One
example of a completed web page is as follows:
<!DOCTYPE html>
<html>
<head>
<title>wikiHow Fan Page</title>
</head>
<body>
<h1>Welcome to My Page!</h1>
<p>This is a fan page for wikiHow. Make yourself at home!
</p>
<h2>Important Dates</h2>
<p><i>January 15, 2019</i> - wikiHow's Birthday</p>
<h2>Links</h2>
<p>Here is a link to wikiHow: <a
href="http://www.wikihow.com">https://www.wikihow.com</a>
</p>
</body>
</html>
14
Make any last-minute changes. If you see any errors in your code, correct
them before proceeding. Once you're certain that your HTML accurately
reflects your expectations, you can proceed to the next part.
2 Part
8
Edit the HTML document if needed. You may notice an error in your HTML
page. To change it, you can edit the HTML document's text:
o On Windows, you can right-click the document and click Edit in
the resulting drop-down menu (if you have Notepad++ installed, this will
say Edit with Notepad++instead).
o On Mac, you'll want to click the document to select it, click File,
select Open With, and click TextEdit. You can also drag the document into
TextEdit.
Sample HTML
Community Q&A
Question
wikiHow Contributor
Community Answer
Yes. Write the code and then press edit-save and then call it what ever you want. After you
called it something, you have to type .html at he end. Save and use as needed.
Not Helpful 92Helpful 311
Question
wikiHow Contributor
Community Answer
You can set up your own server, but I recommend buying web hosting from some of the
available hosting companies. There are also free hosts out there, but they would put their ads
on your webpage.
Not Helpful 10Helpful 44
Question
wikiHow Contributor
Community Answer
After you change the file type to .html and open it, It should automatically turn into a tab.
Not Helpful 88Helpful 218
Question
wikiHow Contributor
Community Answer
There's the mobile app "Learn HTML," as well as "Learn CSS" and "Learn JavaScript," all from
Sololearn. Combine them all to create a nice HTML webpage. If you aren't looking for mobile
apps but for websites, you can go to codecademy.com, or just search in Google for websites
that will teach you programming languages.
Not Helpful 40Helpful 105
Question
wikiHow Contributor
Community Answer
You need to use CSS, which is used to determine how an HTML document looks. To insert
CSS to an HTML document, type . To change the font size in CSS, type the tag you want to edit
(p, h1, body etc) followed by a {. After the {, type: font-size: ...px; (the semicolon is very
important!) then add a } at the end.
Not Helpful 79Helpful 189
Question
Yes, you can edit as well as see your doc on the browser without any network.
Not Helpful 76Helpful 179
Question
wikiHow Contributor
Community Answer
Provide the exact path. For example, if your image is called face.jpg, type "C:\\Users\(your
username)\Desktop\face.jpg."
Not Helpful 68Helpful 158
Question
How can I save a file on Notepad that will give me a webpage view?
wikiHow Contributor
Community Answer
You can save it by pressing cntrl+s. After you've name the file, save it as .html.
Not Helpful 48Helpful 110
Question
wikiHow Contributor
Community Answer
You can create a link from one page to another using "" tag. This tag has an important
parameter "href", which contains the address.
Not Helpful 22Helpful 50
Question
wikiHow Contributor
Community Answer
Not Helpful 54Helpful 101
Show more answers
Unanswered Questions
How can I change the font of the web page?
After putting an image to my page, how to create links in specific places on this
image opening other images?
Submit
Tips
If you want to center an image in your page, you can type <class="center"> after the
You can add side-scrolling text to your website using the <marquee></marquee> tag, but
keep in mind that this tag might not be recognized by some browsers.
Tags should always be closed in a mirror image of their open counterparts. For
your web page. Posting other people's pictures may result in a copyright infringement.
How to
Choose a Web Host
How to
Make a Website
How to
Improve the Readability of Your Software Code
How to
Start a Blog
How to
Put a Digg Counter on a Web Page
How to
Delete a Web Page Using Macromedia Dreamweaver
How to
Create a Website Without HTML
How to
Polish the Table for Your Website in HTML
How to
Edit a Webpage Using HTML
How to
Insert Spaces in HTML
How to
Change Text Color in HTML
How to
Set Background Color in HTML
Web designing
How to
2. COMMUNICATION
People on the web tend to want information quickly, so it is important to
communicate clearly, and make your information easy to read and digest. Some
effective tactics to include in your web design include: organising information
using headlines and sub headlines, using bullet points instead of long windy
sentences, and cutting the waffle.
3. TYPEFACES
In general, Sans Serif fonts such as Arial and Verdana are easier to read online
(Sans Serif fonts are contemporary looking fonts without decorative finishes).
The ideal font size for reading easily online is 16px and stick to a maximum of 3
typefaces in a maximum of 3 point sizes to keep your design streamlined.
4. COLOURS
A well thought out colour palette can go a long way to enhance the user
experience. Complementary colours create balance and harmony. Using
contrasting colours for the text and background will make reading easier on the
eye. Vibrant colours create emotion and should be used sparingly (e.g. for buttons
and call to actions). Last but not least, white space/ negative space is very
effective at giving your website a modern and uncluttered look.
5. IMAGES
A picture can speak a thousand words, and choosing the right images for your
website can help with brand positioning and connecting with your target
audience. If you don’t have high quality professional photos on hand, consider
purchasing stock photos to lift the look of your website. Also consider using
infographics, videos and graphics as these can be much more effective at
communicating than even the most well written piece of text.
6. NAVIGATION
Navigation is about how easy it is for people to take action and move around your
website. Some tactics for effective navigation include a logical page hierarchy,
using bread crumbs, designing clickable buttons, and following the ‘three click
rule’ which means users will be able to find the information they are looking for
within three clicks.
uploading files
updating web pages
posting blogs
Internet Connection
Internet connection is required to connect to a remotely located web server.
Web Server
Web server is the actual location where your website resides on. A web
server may host single or multiple sites depending on what hosting service
you have paid for.
Web development
Web development refers to building website and deploying on the web.
Web development requires use of scripting languages both at the server
end as well as at client end.
Before developing a web site once should keep several aspects in mind like:
What to put on the web site?
Who will host it?
How to make it interactive?
How to code it?
How to create search engine friendly web site?
How to secure the source code frequently?
Will the web site design display well in different browsers?
Will the navigation menus be easy to use?
Will the web site loads quickly?
How easily will the site pages print?
How easily will visitors find important details specific to the web site?
How effectively the style sheets be used on your web sites?
Thsese tools allow the web developer to use HTML, CSS and JavaScript etc..
These are accessed by hovering over an item on a web page and selecting
the “Inspect Element” from the context menu.
Featues
Following are the common featuers that every web development tool
exhibits:
Skills Required
For being a successful web developer, one should possess the following
skills:
HTML Attributes
❮ PreviousNext ❯
HTML Attributes
All HTML elements can have attributes
Attributes provide additional information about an element
Attributes are always specified in the start tag
Attributes usually come in name/value pairs like: name="value"
Example
<a href="https://www.w3schools.com">This is a link</a>
Try it Yourself »
You will learn more about links and the <a> tag later in this tutorial.
Example
<img src="img_girl.jpg">
Try it Yourself »
Example
<img src="img_girl.jpg" width="500" height="600">
Try it Yourself »
The image size is specified in pixels: width="500" means 500 pixels wide.
The value of the attribute can be read by screen readers. This way,
someone "listening" to the webpage, e.g. a vision impaired person, can
"hear" the element.
Example
<img src="img_girl.jpg" alt="Girl with a jacket">
Try it Yourself »
Example
See what happens if we try to display an image that does not exist:
Try it Yourself »
Example
<p style="color:red">I am a paragraph</p>
Try it Yourself »
You will learn more about styling later in this tutorial, and in our CSS
Tutorial.
<!DOCTYPE html>
<html lang="en-US">
<body>
...
</body>
</html>
The first two letters specify the language (en). If there is a dialect, use
two more letters (US).
Try it Yourself »
Bad
<a href=https://www.w3schools.com>
Try it Yourself »
Good
<a href="https://www.w3schools.com">
Try it Yourself »
Example
<p title=About W3Schools>
Try it Yourself »
Using quotes are the most common. Omitting quotes can produce errors.
At W3Schools we always use quotes around attribute values.
Or vice versa:
Try it Yourself »
Chapter Summary
All HTML elements can have attributes
The title attribute provides additional "tool-tip" information
The href attribute provides address information for links
The width and height attributes provide size information for
images
The alt attribute provides text for screen readers
At W3Schools we always use lowercase attribute names
At W3Schools we always quote attribute values with double quotes
HTML Attributes
Below is an alphabetical list of some attributes often used in HTML, which
you will learn more about in this tutorial:
Attribute Description
alt Specifies an alternative text for an image, when the image cannot
disabled Specifies that an input element should be disabled
HTML Links
❮ PreviousNext ❯
Links are found in nearly all web pages. Links allow users to click
their way from page to page.
HTML Links - Hyperlinks
HTML links are hyperlinks.
When you move the mouse over a link, the mouse arrow will turn into a
little hand.
Note: A link does not have to be text. It can be an image or any other
HTML element.
<a href="url">link text</a>
Example
<a href="https://www.w3schools.com/html/">Visit our HTML
tutorial</a>
Try it Yourself »
Clicking on the link text will send you to the specified address.
Note: Without a forward slash at the end of subfolder addresses, you
might generate two requests to the server. Many servers will
automatically add a forward slash to the end of the address, and then
create a new request.
Local Links
The example above used an absolute URL (a full web address).
A local link (link to the same web site) is specified with a relative URL
(without https://www....).
Example
<a href="html_images.asp">HTML Images</a>
Try it Yourself »
a:visited {
color: pink;
background-color: transparent;
text-decoration: none;
}
a:hover {
color: red;
background-color: transparent;
text-decoration: underline;
}
a:active {
color: yellow;
background-color: transparent;
text-decoration: underline;
}
</style>
Try it Yourself »
Example
<a href="https://www.w3schools.com/" target="_blank">Visit
W3Schools!</a>
Try it Yourself »
Example
<a href="https://www.w3schools.com/html/" target="_top">HTML5
tutorial!</a>
Try it Yourself »
Try it Yourself »
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
<a href="https://www.w3schools.com/html/" title="Go to
W3Schools HTML section">Visit our HTML Tutorial</a>
Try it Yourself »
When the link is clicked, the page will scroll to the location with the
bookmark.
Example
First, create a bookmark with the id attribute:
<h2 id="C4">Chapter 4</h2>
Then, add a link to the bookmark ("Jump to Chapter 4"), from within the
same page:
Or, add a link to the bookmark ("Jump to Chapter 4"), from another
page:
Example
<a href="html_demo.html#C4">Jump to Chapter 4</a>
Try it Yourself »
External Paths
External pages can be referenced with a full URL or with a path relative to
the current web page.
Try it Yourself »
This example links to a page located in the html folder on the current web
site:
Example
<a href="/html/default.asp">HTML tutorial</a>
Try it Yourself »
This example links to a page located in the same folder as the current
page:
Example
<a href="default.asp">HTML tutorial</a>
Try it Yourself »
You can read more about file paths in the chapter HTML File Paths.
Chapter Summary
Use the <a> element to define a link
Use the href attribute to define the link address
Use the target attribute to define where to open the linked
document
Use the <img> element (inside <a>) to use an image as a link
Use the id attribute (id="value") to define bookmarks in a page
Use the href attribute (href="#value") to link to the bookmark
Tag Description
For a complete list of all available HTML tags, visit our HTML Tag
Reference.
HTML Tables
❮ PreviousNext ❯
Try it Yourself »
Example
<table style="width:100%">
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr>
<tr>
<td>Jill</td>
<td>Smith</td>
<td>50</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>94</td>
</tr>
</table>
Try it Yourself »
Example
table, th, td {
border: 1px solid black;
}
Try it Yourself »
Remember to define borders for both the table and the table cells.
HTML Table - Collapsed Borders
If you want the borders to collapse into one border, add the
CSS border-collapse property:
Example
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
Try it Yourself »
If you do not specify a padding, the table cells will be displayed without
padding.
Example
th, td {
padding: 15px;
}
Try it Yourself »
HTML Table - Left-align Headings
By default, table headings are bold and centered.
Example
th {
text-align: left;
}
Try it Yourself »
Example
table {
border-spacing: 5px;
}
Try it Yourself »
Example
<table style="width:100%">
<tr>
<th>Name</th>
<th colspan="2">Telephone</th>
</tr>
<tr>
<td>Bill Gates</td>
<td>55577854</td>
<td>55577855</td>
</tr>
</table>
Try it Yourself »
Example
<table style="width:100%">
<tr>
<th>Name:</th>
<td>Bill Gates</td>
</tr>
<tr>
<th rowspan="2">Telephone:</th>
<td>55577854</td>
</tr>
<tr>
<td>55577855</td>
</tr>
</table>
Try it Yourself »
Example
<table style="width:100%">
<caption>Monthly savings</caption>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$50</td>
</tr>
</table>
Try it Yourself »
Note: The <caption> tag must be inserted immediately after
the <table> tag.
Example
<table id="t01">
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>94</td>
</tr>
</table>
Try it Yourself »
And add more styles:
table#t01 tr:nth-child(even) {
background-color: #eee;
}
table#t01 tr:nth-child(odd) {
background-color: #fff;
}
table#t01 th {
color: white;
background-color: black;
}
Try it Yourself »
Chapter Summary
Use the HTML <table> element to define a table
Use the HTML <tr> element to define a table row
Use the HTML <td> element to define a table data
Use the HTML <th> element to define a table heading
Use the HTML <caption> element to define a table caption
Use the CSS border property to define a border
Use the CSS border-collapse property to collapse cell borders
Use the CSS padding property to add padding to cells
Use the CSS text-align property to align cell text
Use the CSS border-spacing property to set the spacing between
cells
Use the colspan attribute to make a cell span many columns
Use the rowspan attribute to make a cell span many rows
Use the id attribute to uniquely define one table
Test Yourself with Exercises!
Exercise 1 »Exercise 2 »Exercise 3 »Exercise 4 »Exercise 5 »Exercise 6 »
<col> Specifies column properties for each column within a <colgroup> element
<thead> Groups the header content in a table
For a complete list of all available HTML tags, visit our HTML Tag
Reference.
❮ PreviousNext ❯
HTML Form Elements
❮ PreviousNext ❯
Try it Yourself »
All the different input types are covered in the next chapter.
Example
<select name="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="fiat">Fiat</option>
<option value="audi">Audi</option>
</select>
Try it Yourself »
Try it Yourself »
Visible Values:
Use the size attribute to specify the number of visible values:
Example
<select name="cars" size="3">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="fiat">Fiat</option>
<option value="audi">Audi</option>
</select>
Try it Yourself »
Example
<select name="cars" size="4" multiple>
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="fiat">Fiat</option>
<option value="audi">Audi</option>
</select>
Try it Yourself »
The <textarea> Element
The <textarea> element defines a multi-line input field (a text area):
Example
<textarea name="message" rows="10" cols="30">
The cat was playing in the garden.
</textarea>
Try it Yourself »
You can also define the size of the text area by using CSS:
Example
<textarea name="message" style="width:200px; height:600px">
The cat was playing in the garden.
</textarea>
Try it Yourself »
The <button> Element
The <button> element defines a clickable button:
Example
<button type="button" onclick="alert('Hello World!')">Click Me!
</button>
Try it Yourself »
Click Me!
<datalist>
<output>
Users will see a drop-down list of the pre-defined options as they input
data.
Example
<form action="/action_page.php">
<input list="browsers">
<datalist id="browsers">
<option value="Internet Explorer">
<option value="Firefox">
<option value="Chrome">
<option value="Opera">
<option value="Safari">
</datalist>
</form>
Try it Yourself »
<form action="/action_page.php"
oninput="x.value=parseInt(a.value)+parseInt(b.value)">
0
<input type="range" id="a" name="a" value="50">
100 +
<input type="number" id="b" name="b" value="50">
=
<output name="x" for="a b"></output>
<br><br>
<input type="submit">
</form>
Try it Yourself »
Tag Description
<form> Defines an HTML form for user input
For a complete list of all available HTML tags, visit our HTML Tag
Reference.
HTML Forms
❮ PreviousNext ❯
Last name:
Mouse
Submit
Try it Yourself »
The <form> Element
The HTML <form> element defines a form that is used to collect user
input:
<form>
.
form elements
.
</form>
Form elements are different types of input elements, like text fields,
checkboxes, radio buttons, submit buttons, and more.
Type Description
You will learn a lot more about input types later in this tutorial.
Text Input
<input type="text"> defines a one-line input field for text input:
Example
<form>
First name:<br>
<input type="text" name="firstname"><br>
Last name:<br>
<input type="text" name="lastname">
</form>
Try it Yourself »
First name:
Last name:
Note: The form itself is not visible. Also note that the default width of a
text field is 20 characters.
Example
<form>
<input type="radio" name="gender" value="male" checked> Male
<br>
<input type="radio" name="gender" value="female"> Female<br>
<input type="radio" name="gender" value="other"> Other
</form>
Try it Yourself »
Male
Female
Other
Example
<form action="/action_page.php">
First name:<br>
<input type="text" name="firstname" value="Mickey"><br>
Last name:<br>
<input type="text" name="lastname" value="Mouse"><br><br>
<input type="submit" value="Submit">
</form>
Try it Yourself »
First name:
Mickey
Last name:
Mouse
Submit
Normally, the form data is sent to a web page on the server when the
user clicks on the submit button.
In the example above, the form data is sent to a page on the server
called "/action_page.php". This page contains a server-side script that
handles the form data:
<form action="/action_page.php">
The default value is "_self" which means the form will be submitted in
the current window.
To make the form result open in a new browser tab, use the value
"_blank":
Example
<form action="/action_page.php" target="_blank">
Try it Yourself »
Try it Yourself »
or:
Example
<form action="/action_page.php" method="post">
Try it Yourself »
However, when GET is used, the submitted form data will be visible in
the page address field:
/action_page.php?firstname=Mickey&lastname=Mouse
Notes on GET:
Notes on POST:
This example will only submit the "Last name" input field:
Example
<form action="/action_page.php">
First name:<br>
<input type="text" value="Mickey"><br>
Last name:<br>
<input type="text" name="lastname" value="Mouse"><br><br>
<input type="submit" value="Submit">
</form>
Try it Yourself »
Grouping Form Data with <fieldset>
The <fieldset> element is used to group related data in a form.
Example
<form action="/action_page.php">
<fieldset>
<legend>Personal information:</legend>
First name:<br>
<input type="text" name="firstname" value="Mickey"><br>
Last name:<br>
<input type="text" name="lastname" value="Mouse"><br><br>
<input type="submit" value="Submit">
</fieldset>
</form>
Try it Yourself »
Submit
Attribute Description
accept-charset Specifies the charset used in the submitted form (default: the pa
action Specifies an address (url) where to submit the form (default: the
method Specifies the HTTP method used when submitting the form (defa
name Specifies a name used to identify the form (for DOM usage: docu
novalidate Specifies that the browser should not validate the form.
target Specifies the target of the address in the action attribute (defaul
Relative File Paths
A relative file path points to a file relative to the current page.
In this example, the file path points to a file in the images folder located
at the root of the current web:
Example
<img src="/images/picture.jpg" alt="Mountain">
Try it Yourself »
In this example, the file path points to a file in the images folder located
in the current folder:
Example
<img src="images/picture.jpg" alt="Mountain">
Try it Yourself »
In this example, the file path points to a file in the images folder located
in the folder one level above the current folder:
Example
<img src="../images/picture.jpg" alt="Mountain">
Try it Yourself »
Best Practice
It is best practice to use relative file paths (if possible).
When using relative file paths, your web pages will not be bound to your
current base URL. All links will work on your own computer (localhost) as
well as on your current public domain and your future public domains.
The hyperlink text on which the user clicks is known as the anchor text.
Anchor text is also known as link text or a link label.
Techopedia explains Anchor
Images can improve the design and the appearance of a web page.
Example
<img src="pic_trulli.jpg" alt="Italian Trulli">
Try it Yourself »
Example
<img src="img_girl.jpg" alt="Girl in a jacket">
Try it Yourself »
Example
<img src="img_chania.jpg" alt="Flowers in Chania">
Try it Yourself »
<img src="url">
Example
<img src="img_chania.jpg" alt="Flowers in Chania">
Try it Yourself »
Example
<img src="wrongname.gif" alt="Flowers in Chania">
Try it Yourself »
Example
<img src="img_girl.jpg" alt="Girl in a
jacket" style="width:500px;height:600px;">
Try it Yourself »
Example
<img src="img_girl.jpg" alt="Girl in a
jacket" width="500" height="600">
Try it Yourself »
<img src="html5.gif" alt="HTML5
Icon" width="128" height="128">
<img src="html5.gif" alt="HTML5
Icon" style="width:128px;height:128px;">
</body>
</html>
Try it Yourself »
Try it Yourself »
Actually, you can access images from any web address in the world:
Example
<img src="https://www.w3schools.com/images/w3schools_green.jpg"
alt="W3Schools.com">
Try it Yourself »
You can read more about file paths in the chapter HTML File Paths.
Animated Images
HTML allows animated GIFs:
Example
<img src="programming.gif" alt="Computer
Man" style="width:48px;height:48px;">
Try it Yourself »
Image as a Link
To use an image as a link, put the <img> tag inside the <a> tag:
Example
<a href="default.asp">
<img src="smiley.gif" alt="HTML
tutorial" style="width:42px;height:42px;border:0;">
</a>
Try it Yourself »
Image Floating
Use the CSS float property to let the image float to the right or to the
left of a text:
Example
<p><img src="smiley.gif" alt="Smiley
face" style="float:right;width:42px;height:42px;">
The image will float to the right of the text.</p>
<p><img src="smiley.gif" alt="Smiley
face" style="float:left;width:42px;height:42px;">
The image will float to the left of the text.</p>
Try it Yourself »
Tip: To learn more about CSS Float, read our CSS Float Tutorial.
Image Maps
The <map> tag defines an image-map. An image-map is an image with
clickable areas.
In the image below, click on the computer, the phone, or the cup of
coffee:
Example
<img src="workplace.jpg" alt="Workplace" usemap="#workmap">
<map name="workmap">
<area shape="rect" coords="34,44,270,350" alt="Computer" hre
f="computer.htm">
<area shape="rect" coords="290,172,333,250" alt="Phone" href
="phone.htm">
<area shape="circle" coords="337,300,44" alt="Coffee" href="
coffee.htm">
</map>
Try it Yourself »
Background Image
To add a background image on an HTML element, use the CSS
property background-image:
Example
To add a background image on a web page, specify the background-
image property on the BODY element:
<body style="background-image:url('clouds.jpg')">
<h2>Background Image</h2>
</body>
Try it Yourself »
Example
To add a background image on a paragraph, specify the background-
image property on the P element:
<body>
<p style="background-image:url('clouds.jpg')">
...
</p>
</body>
Try it Yourself »
<picture>
<source media="(min-width:
650px)" srcset="img_pink_flowers.jpg">
<source media="(min-width:
465px)" srcset="img_white_flower.jpg">
<img src="img_orange_flowers.jpg" alt="Flowers" style="width
:auto;">
</picture>
Try it Yourself »
Chapter Summary
Use the HTML <img> element to define an image
Use the HTML src attribute to define the URL of the image
Use the HTML alt attribute to define an alternate text for an image,
if it cannot be displayed
Use the HTML width and height attributes to define the size of the
image
Use the CSS width and height properties to define the size of the
image (alternatively)
Use the CSS float property to let the image float
Use the HTML <map> element to define an image-map
Use the HTML <area> element to define the clickable areas in the
image-map
Use the HTML <img>'s element usemap attribute to point to an
image-map
Use the HTML <picture> element to show different images for
different devices
Note: Loading images takes time. Large images can slow down your
page. Use images carefully.
Tag Description
HREF attribute
The attribute 'HREF' of the Anchor tag is implemented for defining the address or
path to which this hypertext will get linked. In other words, it can be said that it
directs you out of your page to that destination page, whose link you have
mentioned within the double quotes of href attribute as value.
The syntax for an anchor tag with href attribute looks something like this:
A link which is unvisited gets displayed with properties like underlined and
color is blue
A link which is active link gets displayed as underlined with red color
Still, there are many web developers who will deposit their own link-colors in their
web pages to match the color scheme of their site. Here's the format:
You can also provide hex code for colors as well (as you can see from the above
example) or else you can use specific words for each color which is acceptable by
the browser.
<html>
<body>
</html> Run
Anchor in Images
Anchor tags can also be used to create hyperlink through images also. Here's a
code snippet to show how to perform that.
<html>
<body>
</body>
</html>
Image as buttons
<!DOCTYPE html>
<html>
<body>
<form action="/action_page.php">
</form>
<p>Click on the image, and the input will be sent to a page on the server called "/action_page.php".</p>
<p><b>Note:</b> The image input type sends the X and Y coordinates of the click that activated the
image button as default.</p>
</body>
</html>
First name:
Click on the image, and the input will be sent to a page on the server called
"/action_page.php".
Note: The image input type sends the X and Y coordinates of the click that activated
the image button as default.
Image buttons have the same effect as submit buttons. When a visitor
clicks an image button the form is sent to the address specified in
the action setting of the<form> tag.
The border setting defines the width (in pixels) of the border around the
image.
The hspace setting defines the spacing to the left and right of the image (in
pixels).
AN EXAMPLE:
Look at this HTML example:
<html>
<head>
<title>My Page</title>
</head>
<body>
<form name="myform" action="http://www.mydomain.com/myformhandler.cgi"
method="POST">
<div align="center">
<br><br>
<input type="text" size="25" value="Enter your name here!">
<br><input type="image" src="rainbow.gif" name="image" width="60" height="60"><br>
</div>
</form>
</body>
</html>
<< PREVIOUS
In the past, it was common to use markup to define styles and to control
web page layout. Heading levels were selected not based on hierarchy
but based on the styles applied by the web browser, tables were used
for web page layout rather than to organize tabular data, some HTML
tags (such asframeset) were created for the express purpose of
defining web page layout, and so forth. When we write semantic markup
we can no longer select HTML elements based on visual presentation.
Instead, we select HTML elements based on their semantic meaning,
and then use CSS to define the visual presentation of our content. When
writing semantic markup, the presentation of web page elements is kept
completely separate and distinct from the markup of the content itself.
structure to the bulk of Web information, which had been designed only for human
reception. A vision was presented of robots and crawlers digesting online material on a
level sufficient to be positioned as ‘new’ interfaces acting between content and human,
community of open hypermedia systems, adjusting the focus on options and requirements
of applications. The field of hypermedia has been freshly inspired by manifold open and
distance learning activities and meta description standards, as well.Bringing those fields together a view
opens up on human susceptible applications
information layer. Applications may be around, which exceed the claim of a search
machine and might give rise to a richer vision of a semantically grounded human-machine
interaction. Of particular interest appear all aspects of navigational intelligence, as they
management. Our approach starts from the primary, most often violated principle of
educational content applications, the strict separation of structure, logic, content and
should be noted that hyperlinks, from our view, belong to structural information and
therefore must not be stored within content. We will discuss a semantic representation of
hyperlinks and a prototypic model for a semantic link processing along the line of this
article.
hyperlinks. Section 3 presents the concept of defining and processing linking schemes
The common approach of the semantic web lies in provisioning of resource descriptions
and ontologies to robots such as search machines [BHL01]. Consequently, facing the
current status of information in the web, a major effort concentrates on the acquisition of
and in parallel to these recent activities the hypermedia research community has
descriptions of their information bases, acting in parallel to the semantic web initiative.
Their motivations do not only derive from subject specific categorisation and retrieval, but
also stem from tasks of automated content processing and context-oriented presentation.
For a vital field we concentrate in the examples given below on educational content
management and related meta-data descriptors. A rich standard for the annotation of
educational material has been released, the Learning Object Metadata (LOM) [LOM02].LOM not only
provides dedicated semantic descriptors of the annotated learning objects,
but also includes the option of defining inter-object relations. The LOM encoding
RDF Representation
XML Representation
Classification
Annotation
Relation
Rights
Educational
Meta-Metadata
Life Cycle
General
LOB
<paragraph>
[...]
Hamsters having
hay fever
are often
[...]
</paragraph>
/hamster
/hamster#meta-inf /hamster-text
/hamster#general
/hamster#keywords
Hamster diseases
lom:meta-inf mir:content
lom:general
lom:title
lom:description
lom:keyword
rdf:type
rdf:_1 rdf:_2
<?xml version="1.0"?>
<mir:lob xmlns:mir="http://www.rz.fhtw-berlin.de/MIR"
xmlns:lom="http://www.imsproject.org/xsd/imsmod_rootv1p2p1">
<lom:lom>
<lom:general>
<lom:identifier>/hamster</lom:identifier>
<lom:title>
<lom:title>
<lom:description>
</lom:description>
<lom:keyword>
</lom:keyword>
<lom:keyword>
<lom:langstring xml:lang="en">hamster</lom:langstring>
</lom:keyword>
</lom:general>
</lom:lom>
<paragraph>
[...]
[...]
</paragrap>
</mir:lob>
Meta-Inf
Content
Figure 1: Representation of Metadata in XML and RDF Statements
easily derived: Using RDF [LS99] representation the content object attains the role of the
subject, the name of the meta descriptor forms the predicate and the value of it denotes the
object. Figure 1 illustrates the different representations of the statement “this learning
object is a description about hamster diseases” as in the LOM/XML schema and in RDF.
To approach a semantic analysis of hyper referential links let us recall that a hyper
reference is constructed of two entities, anchors and links. Links concatenate anchors,
which identify sub portions of content. In a fairly general fashion anchors can be
[DMD02, CD99], the exact formalism depending on the media type of the document.
Links as well as anchors may be stored separate from document resources, e.g. in a link
base.
Even though it appears rather straight forward that a semantic description of an anchor
should inherit the expository statements of the underlying content, sole information
inheritance remains insufficient, since a document in general may carry several, subspecific anchors. It is
therefore important to provide additional specifications as can be
done by the title and label tags inherent with XLink locator expressions.
denoted data chunks in anchors need not be of textual type. Anchors in this sense must be
viewed as additional specialisations, i.e. “this resource in the context of hamster diseases
carries the title of hamster having hay fever”. The extraction of a semantic description of
You can include one or more meta tags in your document based on what
information you want to keep in your document but in general, meta tags
do not impact physical appearance of the document so from appearance
point of view, it does not matter if you include them or not.
1
Name
2
content
3
scheme
4
http-equiv
Used for http response message headers. For example, http-equiv can be
used to refresh the page or to set a cookie. Values include content-type,
expires, refresh and set-cookie.
Specifying Keywords
You can use <meta> tag to specify important keywords related to the
document and later these keywords are used by the search engines while
indexing your webpage for searching purpose.
Example
Following is an example, where we are adding HTML, Meta Tags, Metadata
as important keywords about the document.
Live Demo
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<p>Hello HTML5!</p>
</body>
</html>
<meta charset="UTF-8">
<meta name="author" content="John Doe">
<meta http-equiv="refresh" content="30">
Example of <meta> tags:
Example
<meta charset="UTF-8">
<meta name="description" content="Free Web tutorials">
<meta name="keywords" content="HTML,CSS,XML,JavaScript">
<meta name="author" content="John Doe">
Try it Yourself »
The viewport is the user's visible area of a web page. It varies with the
device, and will be smaller on a mobile phone than on a computer screen.
<meta name="viewport" content="width=device-width, initial-
scale=1.0">
The width=device-width part sets the width of the page to follow the
screen-width of the device (which will vary depending on the device).
The initial-scale=1.0 part sets the initial zoom level when the page is first
loaded by the browser.
HTML Multimedia
❮ PreviousNext ❯
What is Multimedia?
Multimedia comes in many different formats. It can be almost anything
you can hear or see.
Examples: Images, music, sound, videos, records, films, animations, and
more.
In this chapter you will learn about the different multimedia formats.
Browser Support
The first web browsers had support for text only, limited to a single font
in a single color.
Later came browsers with support for colors and fonts, and images!
Audio, video, and animation have been handled differently by the major
browsers. Different formats have been supported, and some formats
require extra helper programs (plug-ins) to work.
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.
MPEG .mpg MPEG. Developed by the Moving Pictures Expert Group. The firs
.mpeg web. Used to be supported by all browsers, but it is not support
MPEG-4 .mp4 MP4. Developed by the Moving Pictures Expert Group. Based on
or MP4 newer video cameras and TV hardware. Supported by all HTML5
YouTube.
Only MP4, WebM, and Ogg video are supported by the HTML5 standard.
Audio Formats
MP3 is the newest format for compressed recorded music. The term MP3
has become synonymous with digital music.
MIDI .mid MIDI (Musical Instrument Digital Interface). Main format for all e
.midi synthesizers and PC sound cards. MIDI files do not contain sound
played by electronics. Plays well on all computers and music hard
AAC .aac AAC (Advanced Audio Coding). Developed by Apple as the defaul
Apple computers, but not in web browsers.
WAV .wav WAV. Developed by IBM and Microsoft. Plays well on Windows, M
systems. Supported by HTML5.
Ogg .ogg Ogg. Developed by the Xiph.Org Foundation. Supported by HTML
MP3 .mp3 MP3 files are actually the sound part of MPEG files. MP3 is the mo
players. Combines good compression (small files) with high quali
MP4 .mp4 MP4 is a video format, but can also be used for audio. MP4 video
the internet. This leads to automatic support for MP4 audio by all
Only MP3, WAV, and Ogg audio are supported by the HTML5 standard.
Tag Description
<source> Defines multiple media resources for media elements (<video> and
<track> Defines text tracks for media elements (<video> and <audio>)
<video> Defines video or movie