Lab 2
Lab 2
Objective:
To familiarize the students with the use of div, Cascading Style Sheet (CSS) and the use of CSS
for designing page layout cascading style sheets.
Activity Outcomes:
Instructor Note:
As pre-lab activity, read Chapter 4 from the textbook “Web Design Playground: HTML & CSS the
Interactive Way 1st Edition, April 2019 by Paul McFedries”.
1. Useful Concepts:
For Internal styling, CSS is written into the head section of the HTML document. For example,
For External styling, CSS is written as a separate file and the file is saved with an extension
.css. In external style sheets the style tags are not necessary. Whereas, external CSS follow the
same structure as the Internal CSS does.
Background Properties
Color Background
Color Background Image
Background Repeat
Background Position
Text Properties
Word Spacing
Letter Spacing
Text Decoration
Vertical Alignment
Line Height
Box Properties
Margin Padding
Border Width
Border Color
Border Style
Width
Height
Float
Examples:
Inline CSS
Internal CSS
External CSS
CSS file: (mystyle.css)
DIV Tag
The div tag is used to define a division or section in an HTML document. It visually, allows us to
make containers that can be formatted.
It can be declared as: <div>……</div>.
We use div and CSS to design a page layout. The div tag is used to represent sections in a page
and CSS is used to style these sections.
We can describe the process of designing a page as:
Determine the requirements of the site
Group the required information
Make a site map
Identify key elements for each page
Decide about the arrangement of information on each page
Translate the design into code
2) Solved Lab Activites
Activity 1:
Apply border and padding properties on the different paragraphs of an HTML document.
Solution:
Output:
Activity 2:
Use the HTML page created in Lab 1 (Signup page) and create an external style sheet that
styles the elements of the page including the style for
1. apply font and text properties
2. control the background color with CSS
3. style different states of inks
4. paragraphs and headings
Solution:
External Stylesheet.css
Output:
Activity 3:
Use div and CSS properties to design a responsive form that contains First name, Last Name, Country
(dropdown), Subject and submit button.
Solution:
Output:
Activity 4:
Use div and CSS properties to design a page layout that contains
1. a header section to display the title, style this title with CSS
2. a form container that contains a registration form, use CSS to style the elements of the
form
3. a footer section
Solution:
External CSS:
Output:
3) Graded Lab Tasks
Note: The instructor can design graded lab activities according to the level of difficulty and complexity
of the solved lab activities. The lab tasks assigned by the instructor should be evaluated in the same lab
Lab Task 1
Design the web template given below using tables and external CSS
Lab Task 2
Design the web template given below using tables and external CSS
Lab Task 3
Design the web template given below using tables and external CSS
Lab Task 4
Design the web page for Comsats Alumni using External CSS.