CSS
Introduction to CSS
1 Sensitivity:
© 2013 WIPRO Internal & Restricted
LTD | WWW.WIPRO.COM | CONFIDENTIAL
Agenda
Introduction to CSS
Sensitivity: Internal & Restricted © 2017 Wipro wipro.com confidential 2
Introduction to
Cascading Style
Sheets
Sensitivity: Internal & Restricted © 2017 Wipro wipro.com confidential 3
Objеctivеs
In this module, you will
• Get introduced to CSS
• Understand the advantages of using CSS
• Explore different versions of CSS
• Understand basic syntax of CSS
Sensitivity: Internal & Restricted © 2017 Wipro wipro.com confidential 4
Introduction to CSS
CSS stands for Cascading Style Sheets
CSS was first developed in 1997 as a way for defining the look and feel of the web pages
HTML documents can be displayed using different styles
Styles define how to display HTML elements
Sensitivity: Internal & Restricted © 2017 Wipro wipro.com confidential 5
Introduction to CSS(Why CSS?)
HTML was primarily used for defining the content of a document like paragraphs, headings
etc. with no formatting
With HTML 3.2 specifications, the formatting tags like color, font etc. were added
When HTML was used for creating user interface for large web applications, with
hundreds of web pages, formatting individual web pages posed challenges
To overcome this challenge, World Wide Web Consortium(W3C) introduced CSS
Sensitivity: Internal & Restricted © 2017 Wipro wipro.com confidential 6
Cascading Style Sheets (CSS)
CSS, is a standard for formatting Web pages that goes well beyond the limitations of HTML
CSS extends HTML with more than 70 style properties that can be applied to HTML tags
Sensitivity: Internal & Restricted © 2017 Wipro wipro.com confidential 7
CSS 1
CSS1 was introduced in 1996
It is the first edition of Cascading Style Sheets
Support for several properties
Unique ‘id’ for each property was introduced with CSS 1
Offered enhanced features for implementing margins, borders, padding and positioning
Sensitivity: Internal & Restricted © 2017 Wipro wipro.com confidential 8
CSS 2
Published in 1998
Support for Bidirectional texts
New font properties such as shadows were introduced
CSS 2.1 was the last 2nd generation edition of CSS
Sensitivity: Internal & Restricted © 2017 Wipro wipro.com confidential 9
CSS 3
CSS 3 is the latest edition of Cascading Style Sheets
Several new functionalities have been provided through CSS 3
Functions like rounded corners, background decoration, box shadows, which are
demonstrated in the subsequent sections, are introduced in this version
Sensitivity: Internal & Restricted © 2017 Wipro wipro.com confidential 10
Advantages of using CSS
A web application will contains hundreds of web pages, which are created using HTML.
Formatting these HTML Pages will be a laborious process, as formatting elements
need to be applied to each and every page.
CSS saves lot of work as we can change the appearance and layout of all the web
pages by editing just one single CSS file.
Sensitivity: Internal & Restricted © 2017 Wipro wipro.com confidential 11
CSS Syntax
The CSS syntax has two main parts : a selector and one or more declarations.
Example :
Property
h1 {color:red }
Value
Selector Declaration
Sensitivity: Internal & Restricted © 2017 Wipro wipro.com confidential 12
Demo : A Simple CSS Style Example
<html><body>
Output :
<h1> Wipro Technologies </h1>
</body></html> Wipro Technologies
<html>
<head>
<style>
h1{color:red} Output :
</style>
Wipro Technologies
</head>
<body>
<h1> Wipro Technologies </h1>
</body>
</html> Sensitivity: Internal & Restricted © 2017 Wipro wipro.com confidential 13
Quiz
1. The HTML element on which you want to apply styles is known as
a)Declaration
b)Directive
c)Selector
d)Property
2. State whether TRUE or FALSE ;
You can specify only one declaration for a selector.
Sensitivity: Internal & Restricted © 2017 Wipro wipro.com confidential 14
CSS Syntax Rules
A CSS declaration must always end with a semi colon.
There can be multiple declarations represented by multiple property value pairs.
You can also have declarations on separate lines for easy readability as given below :
p {
color:blue;
text-align:left;
}
Sensitivity: Internal & Restricted © 2017 Wipro wipro.com confidential 15
CSS Comments (/* … */)
You can use comments in CSS to omit certain segment of code. The segment of the code
which is designated as comment will be ignored by the browser.
Beginning of comment : /*
End of comment : */
Example :
p {
text-align:left;
/* background-color:yellow */
color:red;
}
Sensitivity: Internal & Restricted © 2017 Wipro wipro.com confidential 16
Quiz
1. Which of the following is the correct syntax for comments in CSS ?
a) <!- css syntax -->
b) // css syntax
c) !- css syntax
d) /* css syntax */
2. State whether TRUE or FALSE ;
A CSS declaration must always end with a semicolon.
Sensitivity: Internal & Restricted © 2017 Wipro wipro.com confidential 17
Summary
In this module you were able to :
• Get introduced to CSS
• Understand the advantages of using CSS
• Explore different versions of CSS
• Understand basic syntax of CSS
Sensitivity: Internal & Restricted © 2017 Wipro wipro.com confidential 18
Thank You
Sensitivity: Internal & Restricted © 2017 Wipro wipro.com confidential 19