HTML Headings
HTML Headings
HTML Headings
TAGS
The <!DOCTYPE html> declaration defines that this document is an HTML5
document
The <html> element is the root element of an HTML page
The <head> element contains meta information about the HTML page
The <title> element specifies a title for the HTML page (which is shown in the
browser's title bar or in the page's tab)
The <body> element defines the document's body, and is a container for all the
visible contents, such as headings, paragraphs, images, hyperlinks, tables, lists,
etc.
The <h1> element defines a large heading
The <p> element defines a paragraph
Example
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
</body>
</html>
HTML Headings
HTML headings are defined with the <h1> to <h6> tags.
<h1> defines the most important heading. <h6> defines the least important heading
<!DOCTYPE html>
<html>
<body>
</body>
</html>
Output
This is heading 1
This is heading 2
This is heading 3
This is heading 4
This is heading 5
This is heading 6
HTML Paragraphs
HTML paragraphs are defined with the <p> tag:
<!DOCTYPE html>
<html>
<body>
<p>This is a paragraph.</p>
</body>
</html>
Output:
This is a paragraph.
HTML Images
HTML images are defined with the <img> tag.
The source file (src), alternative text (alt), width, and height are provided as attributes:
<!DOCTYPE html>
<html>
<body>
<h2>HTML Images</h2>
</body>
</html>
<!DOCTYPE html>
<html>
<body>
<hr>
<hr>
</body>
</html>
Use <br> if you want a line break (a new line) without starting a new paragraph:
The <br> tag is an empty tag, which means that it has no end tag.
<!DOCTYPE html>
<html>
<body>
</body>
</html>
HTML Attributes
All HTML elements can have attributes
Attributes provide additional information about elements
Attributes are always specified in the start tag
Attributes usually come in name/value pairs like: name="value"
<!DOCTYPE html>
<html>
<body>
<p>HTML links are defined with the a tag. The link address is specified in the href
attribute:</p>
</body>
</html>
Output:
HTML Colors
Text Color
You can set the color of text:
Hello World
<!DOCTYPE html>
<html>
<body>
<h3 style="color:Tomato;">Hello World</h3>
<p style="color:DodgerBlue;">welcome</p>
</body>
</html>
Output:
Color Names
In HTML, a color can be specified by using a color name:
Background Color
You can set the background color for HTML elements:
PROGRAM 1
<!DOCTYPE html>
<html>
<body>
<h1 style="background-color:Tomato;">Tomato</h1>
<h1 style="background-color:Orange;">Orange</h1>
<h1 style="background-color:DodgerBlue;">DodgerBlue</h1>
<h1 style="background-color:MediumSeaGreen;">MediumSeaGreen</h1>
<h1 style="background-color:Gray;">Gray</h1>
<h1 style="background-color:SlateBlue;">SlateBlue</h1>
<h1 style="background-color:Violet;">Violet</h1>
<h1 style="background-color:LightGray;">LightGray</h1>
</body>
</html>
PROGRAM 2
<!DOCTYPE html>
<html>
<body>
<p style="background-color:Tomato;">
On the Insert tab, the galleries include items that are designed to coordinate with the overall
look of your document. You can use these galleries to insert tables, headers, footers, lists,
cover pages, and other document building blocks. When you create pictures, charts, or
diagrams, they also coordinate with your current document look.
You can easily change the formatting of selected text in the document text by choosing a look
for the selected text from the Quick Styles gallery on the Home tab. You can also format text
directly by using the other controls on the Home tab. Most controls offer a choice of using the
look from the current theme or using a format that you specify directly.
</p>
</body></html>
Border Color
You can set the color of borders:
<!DOCTYPE html>
<html>
<body>
</body>
</html>
HTML contains several elements for defining text with a special meaning.
The HTML <em> element defines emphasized text. The content inside is typically displayed in italic.
A screen reader will pronounce the words in <em> with an emphasis, using verbal stress.
<!DOCTYPE html>
<html>
<body>
</body>
</html>
HTML Lists
HTML lists allow web developers to group a set of related items in lists.
Example
Item
Item
Item
Item
The list items will be marked with bullets (small black circles) by default:
<!DOCTYPE html>
<html>
<body>
<ul>
<li>Tree</li>
<li>Plant</li>
<li>Climbers</li>
</ul>
</body>
</html>
Output:
An unordered list
Tree
Plant
Climbers
Example
<!DOCTYPE html>
<html>
<body>
<ol>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
</body>
</html>
Output:
An ordered list
1. Coffee
2. Tea
3. Milk
The <dl> tag defines the description list, the <dt> tag defines the term (name), and the <dd>
tag describes each term:
<!DOCTYPE html>
<html>
<body>
<dl>
<dt>Coffee</dt>
<dd>- black hot drink</dd>
<dt>Milk</dt>
<dd>- white cold drink</dd>
</dl>
</body>
</html>
Output:
A Description List
Coffee
- black hot drink
Milk
- white cold drink
HTML Tables
A table in HTML consists of table cells inside rows and columns.
Table Cells
Each table cell is defined by a <td> and a </td> tag.
Everything between <td> and </td> are the content of the table cell.
Table Headers
th stands for table header.
the text in <th> elements are bold and centered
<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
</style>
</head>
<body>
<h2>Collapsed Borders</h2>
<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>
<tr>
<td>John</td>
<td>Doe</td>
<td>80</td>
</tr>
</table>
</body>
</html>
Output:
Collapsed Borders
Firstname Lastname Age
Jill Smith 50
Eve Jackson 94
John Doe 80
Table exercise
<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
border: 1px solid black;
}
</style>
</head>
<body>
<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>
<tr>
<td>John</td>
<td>Doe</td>
<td>80</td>
</tr>
</table>
</body>
</html>
Output:
HTML Forms
HTML Forms use the <form> tag to collect user input through various interactive controls. These
controls range from text fields, numeric inputs, and email fields to password fields, checkboxes,
radio buttons, and submit buttons.
Form Elements
The HTML <form> comprises several elements, each serving a unique purpose. For instance,
the <label> element defines labels for other <form> elements. On the other hand, the <input>
element is versatile and can be used to capture various types of input data such as text,
password, email, and more simply by altering its type attribute.
Elements Descriptions
<label> It defines labels for <form> elements.
It is used to get input data from the form in various types such as text, password, email,
<input>
etc by changing its type.
<fieldset> It is used to draw a box around other form elements and group the related data.
The <form> element is a container for different types of input elements, such as: text fields,
checkboxes, radio buttons, submit buttons, etc.
An <input> element can be displayed in many ways, depending on the type attribute.
Type Description
<input type="text"> Displays a single-line text input field
<input type="radio"> Displays a radio button (for selecting one of many choices)
<input type="checkbox"> Displays a checkbox (for selecting zero or more of many choices)
<input type="submit"> Displays a submit button (for submitting the form)
<input type="button"> Displays a clickable button
Text Fields
The <input type="text"> defines a single-line input field for text input.
<!DOCTYPE html>
<html>
<body>
<form>
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" value="John"><br>
<label for="name">Last name:</label><br>
<input type="text" id="name" name="name" value="Doe">
<p>Choose your favorite Web language:</p>
<input type="radio" id="html" name="fav_language" value="HTML">
<label for="html">HTML</label><br>
<input type="radio" id="css" name="fav_language" value="CSS">
<label for="css">CSS</label><br>
<input type="radio" id="javascript" name="fav_language" value="JavaScript">
<label for="javascript">JavaScript</label><br><br>
<input type="submit" value="Submit">
</form>
<p>Also note that the default width of text input fields is 20 characters.</p>
</body>
</html>
RAD: Visual Basic 6.0 uses a Rapid Application Development (RAD) approach that
emphasizes speed and ease of software development
Easy to learn: Visual Basic 6.0 is considered easier to learn than other programming
languages like C++, C#, and Java
Graphical user interface: Users can drag and drop controls to work with instead of
writing code
Simple syntax: Visual Basic 6.0 uses a simple syntax that incorporates some common
English words
Microsoft released Visual Basic 6.0 in 1998 as the last version of Visual Basic. It's still
widely taught and learned today.
Visual Basic was designed to be a complete programming language that contained ordinary
features, such as string processing and computation. The visual environment is characterized
by a drag-and-drop feature which allows programmers to build a user interface that is easy to
use, even for developers with minimum experience.
While these features of VB are advantageous, there are others that can have a negative effect.
The VB programming environment requires a large amount of memory, both for the initial
installation and to run efficiently afterwards. The graphical features of the programming tool
take up a large amount of space and require a significant amount of memory.
Furthermore, Visual Basic is not useful when developing programs that require a lot of
processing time, like games, and the use of VB is restricted to Microsoft operating systems
(OS).
Finally, with C languages, programmers can feasibly locate and use the defined values for
variable data in a computer program at declaration time. This initialization practice is
something that isn't easily done with VB.