LAB 1-HTML and CSS Fundamentals
LAB 1-HTML and CSS Fundamentals
Lab # 1
OBJECTIVE
THEORY
HTML (Hypertext markup language) is used to structure the document. It provides many
elements(called TAGS) for different purposes like creating the title of the document, adding
headings, creating paragraphs, positioning elements, adding content, etc.
1. What is HTML?
These tags are then read by a Browser, which translates the tags into the formatting that
they represent.
Use the <\br>tag if you want a line break (a new line) without starting a new paragraph.
The <hr> element is used for horizontal rules that act as dividers between sections.
Sample Program
<!DOCTYPE html>
<html>
<head>
<title>Lab#1 HTML and CSS Fundamentals</title>
</head>
<body>
<div class="wrapper">
<div class="header">
<h1>Welcome to Sir Syed University of Engineering and
Technology</h1>
<h2>Best faculty available in the country</h2>
</div>
<div class="content">
<div class="content-block introduction">
SWE-315L Web Engineering
LAB#01 HTML and CSS Fundamentals SSUET/QR/114
<h3>Introduction</h3>
<p class="welcome">
<ul>
<li><a href="JS.html">Javascript</a></li>
<li><a href="HTML.html">HTML</a></li>
<li><a href="CSS.html">CSS</a></li>
<li><a href="SW.html">Service
Workers</a></li>
</ul>
</div>
</div>
</div>
</body>
</html>
CSS (Cascading stylesheet) is used to beautify and style the document. The purpose of
CSS is to enhance the look and feel of the document so that it is neat, and easier to read. It does
so by adding some styling rules to the elements.
Using CSS, you can control the color of the text, the style of fonts, the spacing between
paragraphs, how columns are sized and laid out, what background images or colors are used,
layout designs, variations in display for different devices and screen sizes as well as a variety of
other effects.
CSS Syntax:
Sample program
SWE-315L Web Engineering
LAB#01 HTML and CSS Fundamentals SSUET/QR/114
*{
margin: 0;
border: 0;
padding: 0;
}
#uni-pic {
border: 1px black solid;
width: 100%;
height: 100%;
float: left;
}
.wrapper {
font-family: arial, sans-serif;
height: 600px;
width: 90%;
margin: 0 auto;
}
.content .faculty {
clear: left;
}
.content table {
color: blue;
}
p{
color: green;
text-align: center;
}
➢ Inline CSS
Inline styles look and operate much like CSS, with a few differences. Inline styles directly affect
the tag they are written in, without the use of selectors. An inline CSS uses the style attribute of
an HTML element.
Example:
SWE-315L Web Engineering
LAB#01 HTML and CSS Fundamentals SSUET/QR/114
➢ Inpage/Internal CSS
• An internal stylesheet holds the CSS code for the webpage in the head section of the
particular file.
• This makes it easy to apply styles like classes or ids in order to reuse the code.
• The downside of using an internal stylesheet is that changes to the internal stylesheet only
affect the page the code is inserted into.
Example
<!DOCTYPE html>
<html>
<head>
<style>
body {background-color: powderblue;}
h1{color: blue;}
p {color: red;}
</style>
</head>
<body>
</body>
</html>
➢ External CSS
• An external style sheet is used to define the style for many HTML pages.
• To use an external style sheet, add a link to it in the <head> section of each HTML page.
• You can name your stylesheet whatever you like and link to as many as you like.
• You can simply link to it in your head section and every edit you make to the "style.css"
sheet will be globally changed throughout the site.
Below is what the code looks like:
<link rel= “stylesheet” href =“style.css” />
Example
lab1.html
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
</head>
<body>
</body>
</html>
style.css
body {
background-color: green;
}
h1 {
color: blue;
}
p{
color: red;
}
LAB TASK
Task#1
• It should include different HTML elements e.g. headings, paragraph(s), lists, images,
text hyperlinks, image hyperlinks, bookmarks, image maps, tables, text formatting,
forms, etc.
• It should include appropriate and rich content such as short biography, education and
training courses, projects that you have a major role in it, summer training, skills, and
useful web links, contacts, etc.
• You can use any style of CSS like Inline CSS, External CSS, or Inpage CSS.
Task#2:
Use HTML and CSS to create your own personal resume, using the following example as a
template.