Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Unit Title
Lecture Number Lecture Title
HOME
C onfidential NEXT
Objectives :
To explain why CSS is useful.
2
PREVIOUS HOME
CNEXT onfidential
Lecture Outline
Introduction Cascading Style Sheets (CSS)
Benefits of CSS
Working with CSS Methods of Applying Style Web Page Editing with CSS
Summary
Check Your Learning Activity
3
PREVIOUS HOME
CNEXT onfidential
Introduction
The World Wide Web Consortium (W3C) released the first official
CSS2 and CSS3 could not replace CSS1 but acts as supplements.
In this session, we will learn the benefits of CSS, and also the techniques of formatting a Web page using CSS.
4
PREVIOUS HOME
CNEXT onfidential
CSS helps in the presentation of content on the Web page. It is a set of guidelines and properties defining the appearance of Web page, on a Web browser.
It is possible to control the font colour, size and various other design aspects on a Web page, using CSS.
5
PREVIOUS HOME
CNEXT onfidential
Benefits of CSS
Saves time
Benefits
6
PREVIOUS HOME
CNEXT onfidential
Browser then applies style defined in CSS to the content and displays it
on Web page. Basic syntax of CSS: selector {property: value;}
7
PREVIOUS HOME
CNEXT onfidential
Inline method:
<html> <head> <title>Example</title> </head> <body style="background-color: #FF0000;"> <p>This is a red page</p> </body> </html>
Link to stylesheet:
<head> <title>My document</title> <link rel="stylesheet" type="text/css" href="style/style.css" /> </head>
Internal method:
<head> <title>Example</title> <style type="text/css"> body {background-color: #FF0000;} </style> </head>
8
PREVIOUS HOME
CNEXT onfidential
9
PREVIOUS HOME
CNEXT onfidential
Text alignment
Text decoration Letter space Text transformation Margins
Colour property
.redcolour{color:red;}
Background colour
<head> <style> body { background-color: grey;} h1 { background-color: blue;} p { background-color: green;} </style> </head>
11
PREVIOUS HOME
CNEXT onfidential
Absolute positioning
p { position:absolute; left:100px; top:150px;} h1{position:relative; left: 350px; top: 150px;} h2{position:relative; left: 150px; top: 150px;} h3{position:relative; left: 50px; top: 150px;}
Relative positioning
12
PREVIOUS HOME
CNEXT onfidential
Summary
14
PREVIOUS HOME
CNEXT onfidential
1. What is CSS?
Ans. The three benefits of CSS are: it reduces download time, separates
content from presentation, and saves time. 3. Write the code to add a blue background colour to your Web page.
Ans. <head><style>
15
PREVIOUS HOME
CNEXT onfidential
Activity
1.
Search on Web, and find out why many designers prefer CSS layout over HTML table layout.
16
PREVIOUS HOME
Confidential