Lab-01-Manual (Introduction To Basic HTML)
Lab-01-Manual (Introduction To Basic HTML)
Spring 2022
Lab-1 Manual
Introduction to Basic HTML
v1
6-4-2022
Lab-1 Manual
Introduction to Lab:
This lab introduces students the purpose of the using front-end in Database Systems. The lab
discusses the basic HTML. The fundamental concepts of CSS are also introduced.
The main topics in this lab includes:
1. HTML Introduction
2. HTML Tags
3. HTML page structure
4. The <!DOCTYPE> Declaration
5. HTML Documents
6. HTML Headings
7. HTML Paragraphs
8. The HTML <pre> element
9. HTML Attributes
10. The href Attribute
11. HTML Lists
12. HTML Tables
13. HTML forms
14. CSS Introduction
15. CSS Types
16. CSS Inline Styling
17. CSS Internal Styling
18. CSS Selector
19. Class as a selector
20. Margin and Padding
21. CSS External Styling
22. Post Lab Assignment
Page 1 of 17
Lab-1 Manual
1. HTML Introduction
HTML
Html is the heart of web pages.
• HTML stands for Hyper Text Markup Language
• HTML elements are the building blocks of HTML pages
• HTML elements are represented by tags
2. HTML Tags
Page 2 of 17
Lab-1 Manual
Web Browsers
The purpose of a web browser (Chrome, Edge, Firefox, Safari) is to read HTML documents and
display them.
The browser does not display the HTML tags, but uses them to determine how to display the
document:
Page 3 of 17
Lab-1 Manual
The <!DOCTYPE> declaration represents the document type, and helps browsers to display
web pages correctly.
It must only appear once, at the top of the page (before any HTML tags).
5. HTML Documents
All HTML documents must start with a document type declaration: <!DOCTYPE html>.
The HTML document itself begins with <html> and ends with </html>.
The visible part of the HTML document is between <body> and </body>
6. HTML Headings
HTML contains 6 headings h1, h2, h3, h4, h5, h6
h1 is biggest heading
h6 is smallest heading
Page 4 of 17
Lab-1 Manual
<h1> defines the most important heading. <h6> defines the least important heading:
7. HTML Paragraphs
Page 5 of 17
Lab-1 Manual
The text inside a <pre> element is displayed in a fixed-width font (usually Courier), and it
preserves both spaces and line breaks:
9. HTML Attributes
• All HTML elements can have attributes
• Attributes provide additional information about an element
Page 6 of 17
Lab-1 Manual
HTML links are defined with the <a> tag. The link address is specified in the href attribute:
Page 7 of 17
Lab-1 Manual
11.HTML Tables
Defining an HTML Table
Each table row is defined with the <tr> tag. A table header is defined with the <th> tag. By
default, table headings are bold and centered. A table data/cell is defined with the <td> tag.
Page 8 of 17
Lab-1 Manual
12.HTML Forms
Form is used to collect user information.
We create HTML form by the following tag:
<form>
.
.
</form>
Inside of a form there are form elements like Name, Email, Date of birth, Password, Gender,
Buttons.
To take above mentioned user information we use form elements inside form tag.
Apart from Input element, there are other form elements as well.
Each form element has a tag, name, value.
name is used to identify form elements. If there is no name for a form element then the data
of that element is not passed to server.
The user input is value of form element. We can also define initial value using attribute
value.
Task:
Let’s create a simple form for sign up to a website for Employees.
Sign up form
This form will contain following information:
• Username
• Email
• Password
Page 9 of 17
Lab-1 Manual
• Confirm Password
• Phone Number
• Gender
• Favorite Color
• Hire Date
• Timestamp
• Upload your Certificates
• Checkbox
• Submit
• Reset
Page 10 of 17
Lab-1 Manual
13.CSS Introduction
Page 11 of 17
Lab-1 Manual
What is CSS?
• CSS stands for Cascading Style Sheets
• CSS describes how HTML elements are to be displayed on screen, paper, or
in other media
• CSS saves a lot of work. It can control the layout of multiple web pages all at
once
• External stylesheets are stored in CSS files
14.CSS Types
We can apply CSS styles in three different ways:
1. Inline Styling:
We write the CSS properties inside HTML tags by using style attribute.
2. Internal Styling:
The CSS properties for HTML elements are defined at the top of page by
creating separate tag of style <style></style>
3. External Styling:
The CSS properties for HTML elements are defined in separate file with
extension .css
15.CSS Selectors:
In CSS, selectors are used to select elements for styling.
You can have following selectors:
ID as Selector:
we can define id for HTML elements using id attribute.
1. Create a new Paragraph and define its id:
<p id=”p2”> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,quis
nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute
irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
deserunt mollit anim id est laborum. </p>
2. In CSS to call id we use selector as:
#idname
3. Define style for Paragraph as:
Page 12 of 17
Lab-1 Manual
#p2{
text-align: left;
font-weight: bold;
border: dotted;
background-color: slateblue;
font-family: tahoma;
}
16.Class as Selector:
We define class for HTML elements using class attribute.
Many HTML elements can have one class.
Defining CSS styling for a class applies style to all elements having that class.
1. Create a new Paragraph and give a class name as:
Page 13 of 17
Lab-1 Manual
}</style>
Page 14 of 17
Lab-1 Manual
Page 15 of 17
Lab-1 Manual
Page 16 of 17
Lab-1 Manual
The End
Page 17 of 17