SlideShare a Scribd company logo
CSS
What is CSS ?
CSS stands for โ€œCascading Style Sheetsโ€
Cascading: refers to the procedure that determines which style will apply to a certain
section, if you have more than one style rule.
Style: how you want a certain part of your page to look. You can set things like color,
margins, font, etc for things like tables, paragraphs, and headings.
Sheets: the โ€œsheetsโ€ are like templates, or a set of rules, for determining how the webpage
will look.
CSS is a stylesheet language used to describe the presentation of a document written
in HTML or XML.
CSS
History
โ€ข CSS1 was the first edition introduced in 1996.
โ€ข CSS2 was published in 1998 and provides enhancement over CSS1.
โ€ข CSS2.1 was the last 2nd generation edition of CSS.
โ€ข CSS 3 is the latest edition. Several new functionalities have been provided through CSS3.
Functions like rounded corners, backgroubnd decoration, box shadows, which are
demonstrated in the subsequesnt sections, are introduced in this version.
CSS
Advantages
โ€ข 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 lots of work as we can change the appearance and layout of all the web pages
by editing just one single CSS file.
CSS Syntax Rules
Rule have two parts - Selector and declaration.
Selector: The HTML element you want to add style to.
<p> <h1> <table> etc
Declaration: The statement of style for that element. Made up of property and value.
Refer Note Section-
Selector
Property
Declaration
Value
Rules
Declaration
p {font-family:Arial;}
CSS Style Example
<html>
<head>
<style> p {font-family:Arial; color: red; background-
color:black;} </style>
</head>
<body>
<p> <b> Welcome to Snapdeal Academy </b>
</p>
</body>
</html>
Welcome to Snapdeal Academy
Selector - I want the text color of my paragraph to be red and the background color to be black.
CSS Selectors
CSS selectors allow you to select and manipulate HTML elements based on
their id, class, type, attribute, and more.
Examples โ€“
CSS Selectors (Cont.)
Declaring a CSS Rule for a Elements Attribute
It will style all the content of that element which you are selecting.
Example-
The HTML
<p> Welcome to the Snapdeal Academy </p>
<p> <b><i> Powered by โ€“ PeopleStrategists </i></b></p>
The CSS
p {text-align: center; color: blue;}
CSS Selectors (Cont.)
Grouping Selectors
You can group all the selectors of same style to minimize the code. The selectors should be
separated with comma.
Example-
h2 {text-align: center; color: red; }
p {text-align: center; color: red;}
Grouped Selectors-
h2, p {text-align: center; color: red; }
Inserting a StyleSheet
You can do in three different ways-
1. External Style Sheet
Styles are specified in an external CSS file. you can change the looks of entire website by using single
external style sheet.
Eg.: <head> <link rel="stylesheet" type="text/css" href=โ€œex1.cssโ€ /> </head>
2. Internal Style Sheet
To Appy specific styles to a single HTML file inside the head section of an HTML page.
Eg.: <style> p { text-align:left; font-size:24px; } </style>
3. Inline Styles
Styles are specified inside an HTML tag/element.
Eg.: <p style="font-family:Algerian; font-size:28px;"> Demo of Inline Style </p>
Inserting a StyleSheet
Multiple Style Sheets โ€“ It can be referenced inside an HTML document.
The questions is, what styles will be applicable when there is more than one style specified?
All styles cascade into a new virtual style sheet by applying the
following rules, where the higher number has the greater priority:
1. Browser default.
2. External Stylesheet.
3. Internal Stylesheet (styles defined in head section).
4. Inline Style (styles defined in an HTML element).
Ref.Note Section-
Formatting with CSS Properties
CSS Background
We can use CSS Background properties to define the background effects of an element.
The following properties can be used for background effects :
a. background-color
b. background-image
c. background-repeat
d. background-position
Formatting with CSS Properties
CSS Background Image
You can use an image as the background for an element using background-image property.
Example-
body{
background-image:url(โ€˜java.pngโ€™);
}
By default, the image is repeated, both horizontally and vertically, so as to cover the entire
body (or the element on which it is applied).
Formatting with CSS Properties
CSS Background Color
The background-color property is used to specify the background color of an element.
Example-
body {
background-color:darkblue;
}
Similarly, we can specify the background for any element (wherever applicable).
p {
background-color:orange;
}
Formatting with CSS Properties
CSS Background Position
If the background image disturbs the text, i.e. if the text cannot be read clearly due to
the image in the background, we can set the position of the background image.
Example-
body {
background-image:url(โ€œsnapdeal.jpg");
background-repeat:no-repeat;
background-position:right top;
}
Formatting with CSS Properties
CSS Background Shorthand
You can also specify all the properties in a single property.
This property is known as shorthand property.
For specifying shorthand property, you just need to use background.
Example-
body {
background:cyan url(โ€˜snapdeal.jpg') no-repeat right top;
}
Formatting with CSS Properties
Text Formatting
The following properties can be used for formatting text :
1. Text Color
2. Text Alignment
3. Text Decoration
4. Text Transformation
5. Text Indentation
Formatting with CSS Properties
Text Alignment
We can either align the text to the left, right, center or we can make it justified.
Example-
p { text-align:left;}
h1{text-align:center;}
Text Color
The color property is used to set the color of text.
Example-
body { color:blue;}
p1 {color:magenta;}
Formatting with CSS Properties
Text Decoration
You can use text-decoration property to set or remove decorations from text.
Example-
p {text-decoration:overline;}
p {text-decoration:line-through;}
p {text-decoration:underline;}
Text Transformation
You can use text-transform property to specify uppercase and lowercase letters of any text.
Example-
h1 {text-transform:uppercase;}
h2 {text-transform:lowercase;}
p {text-transform:capitalize;}
Formatting with CSS Properties
CSS Font
CSS font properties are used to define the font family, size, style and boldness of the text.
In CSS, there are two types of font family names:
generic family - a group of font families with a similar look (like "Serif" or "Monospace").
font family - a specific font family (like "Times New Roman" or "Arial").
Comments in CSS
/* comment */ - This is comment used in CSS.
Formatting with CSS Properties
CSS Font Family
The font-family property should hold several font names as a "fallback" system. If the
browser does not support the first font, it tries the next font.
Example :
p { font-family:โ€Arialโ€, Times, โ€œSans-serif โ€;}
CSS Font Style
You can use the property font-style to specify mostly italic text. It has three values โ€“
Normal, Italic, Oblique (similar to italic).
Formatting with CSS Properties
CSS Font Size
You can use the font-size property to set the size of text. The font-size value can be
absolute or it can be relative.
Example-
h1 {
font-size: 30px;
}
p {
font-size: 14px;
}
Formatting with CSS Properties
CSS Font Size with em (Relative Size)
You may face resizing problems, when you use older versions of browsers.
To avoid such problems, you can use set font size using em, instead of pixels.
The em size unit is a W3C recommendation.1 em is equal to the current font size.
The default text size is 16 px. So, the default size of 1 em is 16 px.
Example
h2 {
font-size: 1.875em; /* 30px/16=1.875em */
}
p {
Formatting with CSS Properties
CSS Links
You can use CSS styles to style any link. Links can be
styled in different ways by using any CSS property like color, font-family etc.
Links can be in one of the following states :
๏‚ง a: link โ€“ Unvisited link
๏‚ง a: visited โ€“ A link that the user has visited
๏‚ง a: hover โ€“ A link over which the mouse pointer is moving
๏‚ง a: active โ€“ A link, which has been just clicked
Links can be styled according to their states.
Formatting with CSS Properties
CSS Links
Styling Links
a {
font-weight: bold;
}
a:link {
color: black;
}
a:visited {
color: gray;
}
a:hover {
text-decoration: none;
color: white;
background-color: navy;
}
a:active {
color: aqua;
background-color: navy;
}
link - before a visit
visited - after it has been visited
hover - when your mouse is over it but you have not clicked
active - you have clicked it and you have not yet seen the new page
Formatting with CSS Properties
CSS List
You can use CSS list properties for
๏ƒ˜ Setting different list item markers for ordered lists
๏ƒ˜ Setting different list item markers for unordered lists
๏ƒ˜ Set an image as the list item marker
Values-
๏ถ list-style-type
๏ถ list-style-image
Formatting with CSS Properties
Box Model : Introduction
Box model is useful for designing the layout of an HTML Page.
CSS Box model describes a box that wraps around HTML elements.
Using this model, we can define the margins, borders, padding and the actual content. We
can place border around elements and space elements in relation to each other.
Content
Padding
Border
Margin
You can set the height and width of an element
using the height and width properties.
Box Model : Illustration
Formatting with CSS Properties
CSS Padding
You can use the CSS padding properties to define the space between the element border
and the element content. It is possible to change the top, right, bottom and
left padding independently using separate properties.
You can also use a shorthand padding property to change all paddings in a single statement.
Individual padding properties can be specified as follows :
padding-top:20px;
padding-bottom:30px;
padding-right:25px;
padding-left:10px;
In shorthand-
padding : 20px 30px 25px 10px;
Formatting with CSS Properties
CSS Border
You can use the CSS Border properties to specify
the style and color of an elementโ€™s border.
Values-
border-style
border-width
border-color
Formatting with CSS Properties
CSS Margin
Using CSS Margin properties you can specify the space around elements.
Values:
margin-top:50px;
margin-bottom:30px;
margin-right:25px;
margin-left:10px;
In shorthand-
margin:50px 30px 25px 10px;
Formatting with CSS Properties
CSS Margin
Using CSS Margin properties you can specify the space around elements.
Values:
margin-top:50px;
margin-bottom:30px;
margin-right:25px;
margin-left:10px;
In shorthand-
margin:50px 30px 25px 10px;
Formatting with CSS Properties
Pseudo-Class
A pseudo-class is used to define a special state of an element.
โ€ข Style an element when a user mouses over it.
โ€ข Style visited and unvisited links differently.
/* unvisited link */
a:link { color: #FF0000;
}
/* visited link */
a:visited { color: #00FF00;
}
/* mouse over link */
a:hover { color: #FF00FF;
}
/* selected link */
a:active { color: #0000FF;
Formatting with CSS Properties
Pseudo-Elements
A CSS pseudo-element is used to style specified parts of an element.
โ€ข Style the first letter, or line, of an element
โ€ข Insert content before, or after, the content of an element
The ::first-line pseudo-element is used to add a special style to the first line of a
text. All Pseudo Elements-
Selector Example Example description
::after p::after Insert content after every <p> element
::before p::before Insert content before every <p> element
::first-letter p::first-letter Selects the first letter of every <p> element
::first-line p::first-line Selects the first line of every <p> element
::selection p::selection Selects the portion of an element that is selected by a user
Formatting with CSS Properties
Media Types
The @media rule makes it possible to define different style rules for different media
types in the same stylesheet.
Example-
@media screen {
p { font-family: verdana, sans-serif;
font-size: 20px;
} }
@media print {
p { font-family: georgia, serif;
font-size: 15px;
color: blue;
} }
CSS
CSS3 Introduction
Several new functionalities have been added in CSS 3 which has been split into โ€œmodulesโ€.
It contains the "old CSS specification" (which has been split into smaller pieces). In addition, new modules
are added.
Some Important CSS3 modules are:
Selectors
Box Model
Backgrounds and Borders
Image Values and Replaced Content
Text Effects
2D/3D Transformations
Animations
Multiple Column Layout
User Interface
CSS3 Gradient
Now with CSS3 you can use gradients effects in your document. For which earlier you have to
use images. It reduces download time and bandwidth usage. Gradient is generated by browser.
Its of two types โ€“
โ€ข Linear Gradients (goes down/up/left/right/diagonally).
โ€ข Radial Gradients (defined by their center).
Example- (This is by-default for Top-Bottom).
#grad {background: linear-gradient(red, blue); } /* Standard Syntax*/
For Different browser support we need to specify the prefix for them-
#grad {background: -webkit-linear-gradient(red, blue); /* For Safari 5.1 to 6.0 */
background: -o-linear-gradient(red, blue); /* For Opera 11.1 to 12.0 */
background: -moz-linear-gradient(red, blue); /* For Firefox 3.6 to 15 */}
CSS3 Text
CSS3 contains several new text features. Their are following text properties- text-
overflow, word-wrap, word-break
text-overflow โ€“ This property specifies how overflowed content that is not
displayed should be signaled to the user.
Eg.:
p.test1 {
white-space: nowrap;
width: 200px;
border: 1px solid #000000;
overflow: hidden;
text-overflow: clip;
}
p.test2 { On hovering over element โ€“ It shows overflowed content
white-space: nowrap; div.test:hover {
width: 200px; text-overflow: inherit;
border: 1px solid #000000; overflow: visible;
overflow: hidden; }
text-overflow: ellipsis;
}
CSS3 Transforms
CSS3 transforms allow you to translate, rotate, scale, and skew elements. CSS3 supports 2D and 3D
transformations.
CSS3 2D Transforms
It has following 2D transformation methods:
transform: translate()
transform: rotate()
transform: scale()
transform: skewX()
transform: skewY()
transform: matrix()
Example-
div {transform: translate(50px,100px); }
div { transform: rotate(20deg); }
CSS3 Transforms
CSS3 3D Transforms
It has following 3D transformation methods:
transform: rotateX()
transform: rotateY()
transform: rotateZ()
Example-
div {
transform: rotateX(150deg);
}
CSS3 Transitions
It allows you to change property values smoothly (from one value to another),
over a given duration. To create a transition effect, you must specify two
things:
1. the CSS property you want to add an effect to.
2. the duration of the effect.
Example-
div { div:hover {
width: 100px; width: 300px;
height: 100px; }
background: red;
-webkit-transition: width 2s; /* Safari */ On hovering over it.
transition: width 2s;
}
CSS3 Animation
CSS3 animations allows animation of most HTML elements without using JavaScript or
Flash! An animation lets an element gradually change from one style to another. To use
CSS3 animation, you must first specify some @keyframes for the animation.
Example-
/* The animation code */
@keyframes example {
from {background-color: red;}
to {background-color: yellow;}
}
/* The element to apply the animation to */
div {
width: 100px;
height: 100px;
background-color: red;
animation-name: example;
animation-duration: 4s;
}
Ad

More Related Content

What's hot (20)

Css types internal, external and inline (1)
Css types internal, external and inline (1)Css types internal, external and inline (1)
Css types internal, external and inline (1)
Webtech Learning
ย 
Introduction to HTML5
Introduction to HTML5Introduction to HTML5
Introduction to HTML5
Gil Fink
ย 
CSS for Beginners
CSS for BeginnersCSS for Beginners
CSS for Beginners
Amit Kumar Singh
ย 
Introduction to CSS
Introduction to CSSIntroduction to CSS
Introduction to CSS
Amit Tyagi
ย 
Web Servers (ppt)
Web Servers (ppt)Web Servers (ppt)
Web Servers (ppt)
webhostingguy
ย 
Introduction to html
Introduction to htmlIntroduction to html
Introduction to html
vikasgaur31
ย 
Dhtml ppt (2)
Dhtml ppt (2)Dhtml ppt (2)
Dhtml ppt (2)
Rai Saheb Bhanwar Singh College Nasrullaganj
ย 
Web Development using HTML & CSS
Web Development using HTML & CSSWeb Development using HTML & CSS
Web Development using HTML & CSS
Shashank Skills Academy
ย 
Learn html Basics
Learn html BasicsLearn html Basics
Learn html Basics
McSoftsis
ย 
Advanced Cascading Style Sheets
Advanced Cascading Style SheetsAdvanced Cascading Style Sheets
Advanced Cascading Style Sheets
fantasticdigitaltools
ย 
Hyperlinks in HTML
Hyperlinks in HTMLHyperlinks in HTML
Hyperlinks in HTML
Aarti P
ย 
Introduction to CSS
Introduction to CSSIntroduction to CSS
Introduction to CSS
Folasade Adedeji
ย 
html-css
html-csshtml-css
html-css
Dhirendra Chauhan
ย 
Cascading style sheets (CSS)
Cascading style sheets (CSS)Cascading style sheets (CSS)
Cascading style sheets (CSS)
Harshita Yadav
ย 
Css
CssCss
Css
shanmuga rajan
ย 
Intro to HTML and CSS basics
Intro to HTML and CSS basicsIntro to HTML and CSS basics
Intro to HTML and CSS basics
Eliran Eliassy
ย 
HTML Forms
HTML FormsHTML Forms
HTML Forms
Ravinder Kamboj
ย 
HTML
HTMLHTML
HTML
chinesebilli
ย 
cascading style sheet ppt
cascading style sheet pptcascading style sheet ppt
cascading style sheet ppt
abhilashagupta
ย 
HTML Introduction, HTML History, HTML Uses, HTML benifits
HTML Introduction, HTML History, HTML Uses, HTML benifitsHTML Introduction, HTML History, HTML Uses, HTML benifits
HTML Introduction, HTML History, HTML Uses, HTML benifits
Pro Guide
ย 
Css types internal, external and inline (1)
Css types internal, external and inline (1)Css types internal, external and inline (1)
Css types internal, external and inline (1)
Webtech Learning
ย 
Introduction to HTML5
Introduction to HTML5Introduction to HTML5
Introduction to HTML5
Gil Fink
ย 
CSS for Beginners
CSS for BeginnersCSS for Beginners
CSS for Beginners
Amit Kumar Singh
ย 
Introduction to CSS
Introduction to CSSIntroduction to CSS
Introduction to CSS
Amit Tyagi
ย 
Web Servers (ppt)
Web Servers (ppt)Web Servers (ppt)
Web Servers (ppt)
webhostingguy
ย 
Introduction to html
Introduction to htmlIntroduction to html
Introduction to html
vikasgaur31
ย 
Web Development using HTML & CSS
Web Development using HTML & CSSWeb Development using HTML & CSS
Web Development using HTML & CSS
Shashank Skills Academy
ย 
Learn html Basics
Learn html BasicsLearn html Basics
Learn html Basics
McSoftsis
ย 
Advanced Cascading Style Sheets
Advanced Cascading Style SheetsAdvanced Cascading Style Sheets
Advanced Cascading Style Sheets
fantasticdigitaltools
ย 
Hyperlinks in HTML
Hyperlinks in HTMLHyperlinks in HTML
Hyperlinks in HTML
Aarti P
ย 
Introduction to CSS
Introduction to CSSIntroduction to CSS
Introduction to CSS
Folasade Adedeji
ย 
Cascading style sheets (CSS)
Cascading style sheets (CSS)Cascading style sheets (CSS)
Cascading style sheets (CSS)
Harshita Yadav
ย 
Intro to HTML and CSS basics
Intro to HTML and CSS basicsIntro to HTML and CSS basics
Intro to HTML and CSS basics
Eliran Eliassy
ย 
cascading style sheet ppt
cascading style sheet pptcascading style sheet ppt
cascading style sheet ppt
abhilashagupta
ย 
HTML Introduction, HTML History, HTML Uses, HTML benifits
HTML Introduction, HTML History, HTML Uses, HTML benifitsHTML Introduction, HTML History, HTML Uses, HTML benifits
HTML Introduction, HTML History, HTML Uses, HTML benifits
Pro Guide
ย 

Viewers also liked (20)

How Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) WorksHow Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) Works
Amit Tyagi
ย 
Perfil profesional
Perfil profesionalPerfil profesional
Perfil profesional
yinniliseth
ย 
HTML 5 and CSS 3
HTML 5 and CSS 3HTML 5 and CSS 3
HTML 5 and CSS 3
Kannika Kong
ย 
CSS slideshare
CSS slideshareCSS slideshare
CSS slideshare
EirikAas
ย 
CSS - Mรณdulo Bรกsico de WEB
CSS - Mรณdulo Bรกsico de WEBCSS - Mรณdulo Bรกsico de WEB
CSS - Mรณdulo Bรกsico de WEB
Daniel Brandรฃo
ย 
CSS
CSS CSS
CSS
Sunil OS
ย 
Aula 07 Css - Parte 1
Aula 07   Css - Parte 1Aula 07   Css - Parte 1
Aula 07 Css - Parte 1
Professor Samuel Ribeiro
ย 
Evolution of CSS
Evolution of CSSEvolution of CSS
Evolution of CSS
Ecaterina Moraru (Valica)
ย 
HTML Basic Tags
HTML Basic Tags HTML Basic Tags
HTML Basic Tags
Nisa Soomro
ย 
IPW Course 3 CSS
IPW Course 3 CSSIPW Course 3 CSS
IPW Course 3 CSS
Vlad Posea
ย 
HTML Comprehensive Overview
HTML Comprehensive OverviewHTML Comprehensive Overview
HTML Comprehensive Overview
Mohamed Loey
ย 
Introduzione ai css
Introduzione ai cssIntroduzione ai css
Introduzione ai css
gianlucatroiani
ย 
INTRODUCTION TO HTML
INTRODUCTION TO HTMLINTRODUCTION TO HTML
INTRODUCTION TO HTML
bwire sedrick
ย 
Apresentacao html css
Apresentacao html cssApresentacao html css
Apresentacao html css
Daniele Montenegro
ย 
Html links
Html linksHtml links
Html links
eShikshak
ย 
Xhtml
XhtmlXhtml
Xhtml
Manav Prasad
ย 
Html Frames
Html FramesHtml Frames
Html Frames
Xainab Ishfaq
ย 
Introduรงรฃo ao HTML e CSS
Introduรงรฃo ao HTML e CSSIntroduรงรฃo ao HTML e CSS
Introduรงรฃo ao HTML e CSS
Sรฉrgio Souza Costa
ย 
WebKit and GStreamer
WebKit and GStreamerWebKit and GStreamer
WebKit and GStreamer
calvaris
ย 
WebKit and Blink: Bridging the Gap Between the Kernel and the HTML5 Revolution
WebKit and Blink: Bridging the Gap Between the Kernel and the HTML5 RevolutionWebKit and Blink: Bridging the Gap Between the Kernel and the HTML5 Revolution
WebKit and Blink: Bridging the Gap Between the Kernel and the HTML5 Revolution
juanjosanchezpenas
ย 
How Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) WorksHow Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) Works
Amit Tyagi
ย 
Perfil profesional
Perfil profesionalPerfil profesional
Perfil profesional
yinniliseth
ย 
HTML 5 and CSS 3
HTML 5 and CSS 3HTML 5 and CSS 3
HTML 5 and CSS 3
Kannika Kong
ย 
CSS slideshare
CSS slideshareCSS slideshare
CSS slideshare
EirikAas
ย 
CSS - Mรณdulo Bรกsico de WEB
CSS - Mรณdulo Bรกsico de WEBCSS - Mรณdulo Bรกsico de WEB
CSS - Mรณdulo Bรกsico de WEB
Daniel Brandรฃo
ย 
CSS
CSS CSS
CSS
Sunil OS
ย 
HTML Basic Tags
HTML Basic Tags HTML Basic Tags
HTML Basic Tags
Nisa Soomro
ย 
IPW Course 3 CSS
IPW Course 3 CSSIPW Course 3 CSS
IPW Course 3 CSS
Vlad Posea
ย 
HTML Comprehensive Overview
HTML Comprehensive OverviewHTML Comprehensive Overview
HTML Comprehensive Overview
Mohamed Loey
ย 
Introduzione ai css
Introduzione ai cssIntroduzione ai css
Introduzione ai css
gianlucatroiani
ย 
INTRODUCTION TO HTML
INTRODUCTION TO HTMLINTRODUCTION TO HTML
INTRODUCTION TO HTML
bwire sedrick
ย 
Apresentacao html css
Apresentacao html cssApresentacao html css
Apresentacao html css
Daniele Montenegro
ย 
Html links
Html linksHtml links
Html links
eShikshak
ย 
Html Frames
Html FramesHtml Frames
Html Frames
Xainab Ishfaq
ย 
Introduรงรฃo ao HTML e CSS
Introduรงรฃo ao HTML e CSSIntroduรงรฃo ao HTML e CSS
Introduรงรฃo ao HTML e CSS
Sรฉrgio Souza Costa
ย 
WebKit and GStreamer
WebKit and GStreamerWebKit and GStreamer
WebKit and GStreamer
calvaris
ย 
WebKit and Blink: Bridging the Gap Between the Kernel and the HTML5 Revolution
WebKit and Blink: Bridging the Gap Between the Kernel and the HTML5 RevolutionWebKit and Blink: Bridging the Gap Between the Kernel and the HTML5 Revolution
WebKit and Blink: Bridging the Gap Between the Kernel and the HTML5 Revolution
juanjosanchezpenas
ย 
Ad

Similar to CSS (20)

v5-introduction to html-css-210321161444.pptx
v5-introduction to html-css-210321161444.pptxv5-introduction to html-css-210321161444.pptx
v5-introduction to html-css-210321161444.pptx
hannahroseline2
ย 
v5-introduction to html-css-210321161444.pptx
v5-introduction to html-css-210321161444.pptxv5-introduction to html-css-210321161444.pptx
v5-introduction to html-css-210321161444.pptx
hannahroseline2
ย 
CSS
CSSCSS
CSS
DivyaKS12
ย 
Css
CssCss
Css
actacademy
ย 
Css
CssCss
Css
actacademy
ย 
Css introduction
Css  introductionCss  introduction
Css introduction
vishnu murthy
ย 
Css
CssCss
Css
Er. Nawaraj Bhandari
ย 
CSS notes
CSS notesCSS notes
CSS notes
Rajendra Prasad
ย 
Css.prabu
Css.prabuCss.prabu
Css.prabu
Prabu Cse
ย 
css1.ppt
css1.pptcss1.ppt
css1.ppt
BalasundaramSr
ย 
waxaada canshuurahaiyosiyaaddaguudeexamarwaaardaydaDAALBADAN.ppt
waxaada canshuurahaiyosiyaaddaguudeexamarwaaardaydaDAALBADAN.pptwaxaada canshuurahaiyosiyaaddaguudeexamarwaaardaydaDAALBADAN.ppt
waxaada canshuurahaiyosiyaaddaguudeexamarwaaardaydaDAALBADAN.ppt
Ismaciil2
ย 
Unit 2 Internet and web technology CSS report
Unit 2 Internet and web technology CSS reportUnit 2 Internet and web technology CSS report
Unit 2 Internet and web technology CSS report
ajaysahusistec
ย 
CSS Presentation Notes.pptx
CSS Presentation Notes.pptxCSS Presentation Notes.pptx
CSS Presentation Notes.pptx
VineetaSingh713208
ย 
CSS.pptx
CSS.pptxCSS.pptx
CSS.pptx
PushpaLatha551681
ย 
Cordova training - Day 2 Introduction to CSS 3
Cordova training - Day 2 Introduction to CSS 3Cordova training - Day 2 Introduction to CSS 3
Cordova training - Day 2 Introduction to CSS 3
Binu Paul
ย 
Chapter_1_Web_Technologies_Basics (CSS)_Part_2.pptx
Chapter_1_Web_Technologies_Basics (CSS)_Part_2.pptxChapter_1_Web_Technologies_Basics (CSS)_Part_2.pptx
Chapter_1_Web_Technologies_Basics (CSS)_Part_2.pptx
eyasu6
ย 
Cascading Style Sheet
Cascading Style SheetCascading Style Sheet
Cascading Style Sheet
Meenakshi Paul
ย 
Cascading style sheet, CSS Box model, Table in CSS
Cascading style sheet, CSS Box model, Table in CSSCascading style sheet, CSS Box model, Table in CSS
Cascading style sheet, CSS Box model, Table in CSS
SherinRappai
ย 
WT CSS
WT  CSSWT  CSS
WT CSS
Mohan186867
ย 
Introduction to css & its attributes with syntax
Introduction to css & its attributes with syntaxIntroduction to css & its attributes with syntax
Introduction to css & its attributes with syntax
priyadharshini murugan
ย 
v5-introduction to html-css-210321161444.pptx
v5-introduction to html-css-210321161444.pptxv5-introduction to html-css-210321161444.pptx
v5-introduction to html-css-210321161444.pptx
hannahroseline2
ย 
v5-introduction to html-css-210321161444.pptx
v5-introduction to html-css-210321161444.pptxv5-introduction to html-css-210321161444.pptx
v5-introduction to html-css-210321161444.pptx
hannahroseline2
ย 
CSS
CSSCSS
CSS
DivyaKS12
ย 
Css introduction
Css  introductionCss  introduction
Css introduction
vishnu murthy
ย 
Css.prabu
Css.prabuCss.prabu
Css.prabu
Prabu Cse
ย 
waxaada canshuurahaiyosiyaaddaguudeexamarwaaardaydaDAALBADAN.ppt
waxaada canshuurahaiyosiyaaddaguudeexamarwaaardaydaDAALBADAN.pptwaxaada canshuurahaiyosiyaaddaguudeexamarwaaardaydaDAALBADAN.ppt
waxaada canshuurahaiyosiyaaddaguudeexamarwaaardaydaDAALBADAN.ppt
Ismaciil2
ย 
Unit 2 Internet and web technology CSS report
Unit 2 Internet and web technology CSS reportUnit 2 Internet and web technology CSS report
Unit 2 Internet and web technology CSS report
ajaysahusistec
ย 
CSS Presentation Notes.pptx
CSS Presentation Notes.pptxCSS Presentation Notes.pptx
CSS Presentation Notes.pptx
VineetaSingh713208
ย 
Cordova training - Day 2 Introduction to CSS 3
Cordova training - Day 2 Introduction to CSS 3Cordova training - Day 2 Introduction to CSS 3
Cordova training - Day 2 Introduction to CSS 3
Binu Paul
ย 
Chapter_1_Web_Technologies_Basics (CSS)_Part_2.pptx
Chapter_1_Web_Technologies_Basics (CSS)_Part_2.pptxChapter_1_Web_Technologies_Basics (CSS)_Part_2.pptx
Chapter_1_Web_Technologies_Basics (CSS)_Part_2.pptx
eyasu6
ย 
Cascading Style Sheet
Cascading Style SheetCascading Style Sheet
Cascading Style Sheet
Meenakshi Paul
ย 
Cascading style sheet, CSS Box model, Table in CSS
Cascading style sheet, CSS Box model, Table in CSSCascading style sheet, CSS Box model, Table in CSS
Cascading style sheet, CSS Box model, Table in CSS
SherinRappai
ย 
Introduction to css & its attributes with syntax
Introduction to css & its attributes with syntaxIntroduction to css & its attributes with syntax
Introduction to css & its attributes with syntax
priyadharshini murugan
ย 
Ad

More from People Strategists (20)

MongoDB Session 3
MongoDB Session 3MongoDB Session 3
MongoDB Session 3
People Strategists
ย 
MongoDB Session 2
MongoDB Session 2MongoDB Session 2
MongoDB Session 2
People Strategists
ย 
MongoDB Session 1
MongoDB Session 1MongoDB Session 1
MongoDB Session 1
People Strategists
ย 
Android - Day 1
Android - Day 1Android - Day 1
Android - Day 1
People Strategists
ย 
Android - Day 2
Android - Day 2Android - Day 2
Android - Day 2
People Strategists
ย 
Overview of web services
Overview of web servicesOverview of web services
Overview of web services
People Strategists
ย 
Spring Framework - III
Spring Framework - IIISpring Framework - III
Spring Framework - III
People Strategists
ย 
Spring Framework-II
Spring Framework-IISpring Framework-II
Spring Framework-II
People Strategists
ย 
Spring Framework -I
Spring Framework -ISpring Framework -I
Spring Framework -I
People Strategists
ย 
Hibernate II
Hibernate IIHibernate II
Hibernate II
People Strategists
ย 
Hibernate III
Hibernate IIIHibernate III
Hibernate III
People Strategists
ย 
Hibernate I
Hibernate IHibernate I
Hibernate I
People Strategists
ย 
Identifing Listeners and Filters
Identifing Listeners and FiltersIdentifing Listeners and Filters
Identifing Listeners and Filters
People Strategists
ย 
Exploring Maven SVN GIT
Exploring Maven SVN GITExploring Maven SVN GIT
Exploring Maven SVN GIT
People Strategists
ย 
Agile Dev. II
Agile Dev. IIAgile Dev. II
Agile Dev. II
People Strategists
ย 
Agile Dev. I
Agile Dev. IAgile Dev. I
Agile Dev. I
People Strategists
ย 
Working with Servlets
Working with ServletsWorking with Servlets
Working with Servlets
People Strategists
ย 
Overview of JEE Technology
Overview of JEE TechnologyOverview of JEE Technology
Overview of JEE Technology
People Strategists
ย 
JSP Technology II
JSP Technology IIJSP Technology II
JSP Technology II
People Strategists
ย 
JSP Technology I
JSP Technology IJSP Technology I
JSP Technology I
People Strategists
ย 

Recently uploaded (20)

ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
ย 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
ย 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
ย 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
ย 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
ย 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
ย 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
ย 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
ย 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
ย 
Drupalcamp Finland โ€“ Measuring Front-end Energy Consumption
Drupalcamp Finland โ€“ Measuring Front-end Energy ConsumptionDrupalcamp Finland โ€“ Measuring Front-end Energy Consumption
Drupalcamp Finland โ€“ Measuring Front-end Energy Consumption
Exove
ย 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
ย 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
ย 
AI Changes Everything โ€“ Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything โ€“ Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything โ€“ Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything โ€“ Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
ย 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
ย 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
ย 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
ย 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
ย 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
ย 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
ย 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
ย 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
ย 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
ย 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
ย 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
ย 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
ย 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
ย 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
ย 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
ย 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
ย 
Drupalcamp Finland โ€“ Measuring Front-end Energy Consumption
Drupalcamp Finland โ€“ Measuring Front-end Energy ConsumptionDrupalcamp Finland โ€“ Measuring Front-end Energy Consumption
Drupalcamp Finland โ€“ Measuring Front-end Energy Consumption
Exove
ย 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
ย 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
ย 
AI Changes Everything โ€“ Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything โ€“ Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything โ€“ Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything โ€“ Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
ย 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
ย 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
ย 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
ย 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
ย 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
ย 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
ย 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
ย 

CSS

  • 1. CSS
  • 2. What is CSS ? CSS stands for โ€œCascading Style Sheetsโ€ Cascading: refers to the procedure that determines which style will apply to a certain section, if you have more than one style rule. Style: how you want a certain part of your page to look. You can set things like color, margins, font, etc for things like tables, paragraphs, and headings. Sheets: the โ€œsheetsโ€ are like templates, or a set of rules, for determining how the webpage will look. CSS is a stylesheet language used to describe the presentation of a document written in HTML or XML.
  • 3. CSS History โ€ข CSS1 was the first edition introduced in 1996. โ€ข CSS2 was published in 1998 and provides enhancement over CSS1. โ€ข CSS2.1 was the last 2nd generation edition of CSS. โ€ข CSS 3 is the latest edition. Several new functionalities have been provided through CSS3. Functions like rounded corners, backgroubnd decoration, box shadows, which are demonstrated in the subsequesnt sections, are introduced in this version.
  • 4. CSS Advantages โ€ข 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 lots of work as we can change the appearance and layout of all the web pages by editing just one single CSS file.
  • 5. CSS Syntax Rules Rule have two parts - Selector and declaration. Selector: The HTML element you want to add style to. <p> <h1> <table> etc Declaration: The statement of style for that element. Made up of property and value. Refer Note Section- Selector Property Declaration Value Rules Declaration p {font-family:Arial;}
  • 6. CSS Style Example <html> <head> <style> p {font-family:Arial; color: red; background- color:black;} </style> </head> <body> <p> <b> Welcome to Snapdeal Academy </b> </p> </body> </html> Welcome to Snapdeal Academy Selector - I want the text color of my paragraph to be red and the background color to be black.
  • 7. CSS Selectors CSS selectors allow you to select and manipulate HTML elements based on their id, class, type, attribute, and more. Examples โ€“
  • 8. CSS Selectors (Cont.) Declaring a CSS Rule for a Elements Attribute It will style all the content of that element which you are selecting. Example- The HTML <p> Welcome to the Snapdeal Academy </p> <p> <b><i> Powered by โ€“ PeopleStrategists </i></b></p> The CSS p {text-align: center; color: blue;}
  • 9. CSS Selectors (Cont.) Grouping Selectors You can group all the selectors of same style to minimize the code. The selectors should be separated with comma. Example- h2 {text-align: center; color: red; } p {text-align: center; color: red;} Grouped Selectors- h2, p {text-align: center; color: red; }
  • 10. Inserting a StyleSheet You can do in three different ways- 1. External Style Sheet Styles are specified in an external CSS file. you can change the looks of entire website by using single external style sheet. Eg.: <head> <link rel="stylesheet" type="text/css" href=โ€œex1.cssโ€ /> </head> 2. Internal Style Sheet To Appy specific styles to a single HTML file inside the head section of an HTML page. Eg.: <style> p { text-align:left; font-size:24px; } </style> 3. Inline Styles Styles are specified inside an HTML tag/element. Eg.: <p style="font-family:Algerian; font-size:28px;"> Demo of Inline Style </p>
  • 11. Inserting a StyleSheet Multiple Style Sheets โ€“ It can be referenced inside an HTML document. The questions is, what styles will be applicable when there is more than one style specified? All styles cascade into a new virtual style sheet by applying the following rules, where the higher number has the greater priority: 1. Browser default. 2. External Stylesheet. 3. Internal Stylesheet (styles defined in head section). 4. Inline Style (styles defined in an HTML element). Ref.Note Section-
  • 12. Formatting with CSS Properties CSS Background We can use CSS Background properties to define the background effects of an element. The following properties can be used for background effects : a. background-color b. background-image c. background-repeat d. background-position
  • 13. Formatting with CSS Properties CSS Background Image You can use an image as the background for an element using background-image property. Example- body{ background-image:url(โ€˜java.pngโ€™); } By default, the image is repeated, both horizontally and vertically, so as to cover the entire body (or the element on which it is applied).
  • 14. Formatting with CSS Properties CSS Background Color The background-color property is used to specify the background color of an element. Example- body { background-color:darkblue; } Similarly, we can specify the background for any element (wherever applicable). p { background-color:orange; }
  • 15. Formatting with CSS Properties CSS Background Position If the background image disturbs the text, i.e. if the text cannot be read clearly due to the image in the background, we can set the position of the background image. Example- body { background-image:url(โ€œsnapdeal.jpg"); background-repeat:no-repeat; background-position:right top; }
  • 16. Formatting with CSS Properties CSS Background Shorthand You can also specify all the properties in a single property. This property is known as shorthand property. For specifying shorthand property, you just need to use background. Example- body { background:cyan url(โ€˜snapdeal.jpg') no-repeat right top; }
  • 17. Formatting with CSS Properties Text Formatting The following properties can be used for formatting text : 1. Text Color 2. Text Alignment 3. Text Decoration 4. Text Transformation 5. Text Indentation
  • 18. Formatting with CSS Properties Text Alignment We can either align the text to the left, right, center or we can make it justified. Example- p { text-align:left;} h1{text-align:center;} Text Color The color property is used to set the color of text. Example- body { color:blue;} p1 {color:magenta;}
  • 19. Formatting with CSS Properties Text Decoration You can use text-decoration property to set or remove decorations from text. Example- p {text-decoration:overline;} p {text-decoration:line-through;} p {text-decoration:underline;} Text Transformation You can use text-transform property to specify uppercase and lowercase letters of any text. Example- h1 {text-transform:uppercase;} h2 {text-transform:lowercase;} p {text-transform:capitalize;}
  • 20. Formatting with CSS Properties CSS Font CSS font properties are used to define the font family, size, style and boldness of the text. In CSS, there are two types of font family names: generic family - a group of font families with a similar look (like "Serif" or "Monospace"). font family - a specific font family (like "Times New Roman" or "Arial"). Comments in CSS /* comment */ - This is comment used in CSS.
  • 21. Formatting with CSS Properties CSS Font Family The font-family property should hold several font names as a "fallback" system. If the browser does not support the first font, it tries the next font. Example : p { font-family:โ€Arialโ€, Times, โ€œSans-serif โ€;} CSS Font Style You can use the property font-style to specify mostly italic text. It has three values โ€“ Normal, Italic, Oblique (similar to italic).
  • 22. Formatting with CSS Properties CSS Font Size You can use the font-size property to set the size of text. The font-size value can be absolute or it can be relative. Example- h1 { font-size: 30px; } p { font-size: 14px; }
  • 23. Formatting with CSS Properties CSS Font Size with em (Relative Size) You may face resizing problems, when you use older versions of browsers. To avoid such problems, you can use set font size using em, instead of pixels. The em size unit is a W3C recommendation.1 em is equal to the current font size. The default text size is 16 px. So, the default size of 1 em is 16 px. Example h2 { font-size: 1.875em; /* 30px/16=1.875em */ } p {
  • 24. Formatting with CSS Properties CSS Links You can use CSS styles to style any link. Links can be styled in different ways by using any CSS property like color, font-family etc. Links can be in one of the following states : ๏‚ง a: link โ€“ Unvisited link ๏‚ง a: visited โ€“ A link that the user has visited ๏‚ง a: hover โ€“ A link over which the mouse pointer is moving ๏‚ง a: active โ€“ A link, which has been just clicked Links can be styled according to their states.
  • 25. Formatting with CSS Properties CSS Links Styling Links a { font-weight: bold; } a:link { color: black; } a:visited { color: gray; } a:hover { text-decoration: none; color: white; background-color: navy; } a:active { color: aqua; background-color: navy; } link - before a visit visited - after it has been visited hover - when your mouse is over it but you have not clicked active - you have clicked it and you have not yet seen the new page
  • 26. Formatting with CSS Properties CSS List You can use CSS list properties for ๏ƒ˜ Setting different list item markers for ordered lists ๏ƒ˜ Setting different list item markers for unordered lists ๏ƒ˜ Set an image as the list item marker Values- ๏ถ list-style-type ๏ถ list-style-image
  • 27. Formatting with CSS Properties Box Model : Introduction Box model is useful for designing the layout of an HTML Page. CSS Box model describes a box that wraps around HTML elements. Using this model, we can define the margins, borders, padding and the actual content. We can place border around elements and space elements in relation to each other. Content Padding Border Margin You can set the height and width of an element using the height and width properties. Box Model : Illustration
  • 28. Formatting with CSS Properties CSS Padding You can use the CSS padding properties to define the space between the element border and the element content. It is possible to change the top, right, bottom and left padding independently using separate properties. You can also use a shorthand padding property to change all paddings in a single statement. Individual padding properties can be specified as follows : padding-top:20px; padding-bottom:30px; padding-right:25px; padding-left:10px; In shorthand- padding : 20px 30px 25px 10px;
  • 29. Formatting with CSS Properties CSS Border You can use the CSS Border properties to specify the style and color of an elementโ€™s border. Values- border-style border-width border-color
  • 30. Formatting with CSS Properties CSS Margin Using CSS Margin properties you can specify the space around elements. Values: margin-top:50px; margin-bottom:30px; margin-right:25px; margin-left:10px; In shorthand- margin:50px 30px 25px 10px;
  • 31. Formatting with CSS Properties CSS Margin Using CSS Margin properties you can specify the space around elements. Values: margin-top:50px; margin-bottom:30px; margin-right:25px; margin-left:10px; In shorthand- margin:50px 30px 25px 10px;
  • 32. Formatting with CSS Properties Pseudo-Class A pseudo-class is used to define a special state of an element. โ€ข Style an element when a user mouses over it. โ€ข Style visited and unvisited links differently. /* unvisited link */ a:link { color: #FF0000; } /* visited link */ a:visited { color: #00FF00; } /* mouse over link */ a:hover { color: #FF00FF; } /* selected link */ a:active { color: #0000FF;
  • 33. Formatting with CSS Properties Pseudo-Elements A CSS pseudo-element is used to style specified parts of an element. โ€ข Style the first letter, or line, of an element โ€ข Insert content before, or after, the content of an element The ::first-line pseudo-element is used to add a special style to the first line of a text. All Pseudo Elements- Selector Example Example description ::after p::after Insert content after every <p> element ::before p::before Insert content before every <p> element ::first-letter p::first-letter Selects the first letter of every <p> element ::first-line p::first-line Selects the first line of every <p> element ::selection p::selection Selects the portion of an element that is selected by a user
  • 34. Formatting with CSS Properties Media Types The @media rule makes it possible to define different style rules for different media types in the same stylesheet. Example- @media screen { p { font-family: verdana, sans-serif; font-size: 20px; } } @media print { p { font-family: georgia, serif; font-size: 15px; color: blue; } }
  • 36. CSS3 Introduction Several new functionalities have been added in CSS 3 which has been split into โ€œmodulesโ€. It contains the "old CSS specification" (which has been split into smaller pieces). In addition, new modules are added. Some Important CSS3 modules are: Selectors Box Model Backgrounds and Borders Image Values and Replaced Content Text Effects 2D/3D Transformations Animations Multiple Column Layout User Interface
  • 37. CSS3 Gradient Now with CSS3 you can use gradients effects in your document. For which earlier you have to use images. It reduces download time and bandwidth usage. Gradient is generated by browser. Its of two types โ€“ โ€ข Linear Gradients (goes down/up/left/right/diagonally). โ€ข Radial Gradients (defined by their center). Example- (This is by-default for Top-Bottom). #grad {background: linear-gradient(red, blue); } /* Standard Syntax*/ For Different browser support we need to specify the prefix for them- #grad {background: -webkit-linear-gradient(red, blue); /* For Safari 5.1 to 6.0 */ background: -o-linear-gradient(red, blue); /* For Opera 11.1 to 12.0 */ background: -moz-linear-gradient(red, blue); /* For Firefox 3.6 to 15 */}
  • 38. CSS3 Text CSS3 contains several new text features. Their are following text properties- text- overflow, word-wrap, word-break text-overflow โ€“ This property specifies how overflowed content that is not displayed should be signaled to the user. Eg.: p.test1 { white-space: nowrap; width: 200px; border: 1px solid #000000; overflow: hidden; text-overflow: clip; } p.test2 { On hovering over element โ€“ It shows overflowed content white-space: nowrap; div.test:hover { width: 200px; text-overflow: inherit; border: 1px solid #000000; overflow: visible; overflow: hidden; } text-overflow: ellipsis; }
  • 39. CSS3 Transforms CSS3 transforms allow you to translate, rotate, scale, and skew elements. CSS3 supports 2D and 3D transformations. CSS3 2D Transforms It has following 2D transformation methods: transform: translate() transform: rotate() transform: scale() transform: skewX() transform: skewY() transform: matrix() Example- div {transform: translate(50px,100px); } div { transform: rotate(20deg); }
  • 40. CSS3 Transforms CSS3 3D Transforms It has following 3D transformation methods: transform: rotateX() transform: rotateY() transform: rotateZ() Example- div { transform: rotateX(150deg); }
  • 41. CSS3 Transitions It allows you to change property values smoothly (from one value to another), over a given duration. To create a transition effect, you must specify two things: 1. the CSS property you want to add an effect to. 2. the duration of the effect. Example- div { div:hover { width: 100px; width: 300px; height: 100px; } background: red; -webkit-transition: width 2s; /* Safari */ On hovering over it. transition: width 2s; }
  • 42. CSS3 Animation CSS3 animations allows animation of most HTML elements without using JavaScript or Flash! An animation lets an element gradually change from one style to another. To use CSS3 animation, you must first specify some @keyframes for the animation. Example- /* The animation code */ @keyframes example { from {background-color: red;} to {background-color: yellow;} } /* The element to apply the animation to */ div { width: 100px; height: 100px; background-color: red; animation-name: example; animation-duration: 4s; }

Editor's Notes

  • #6: A CSS declaration must always end with semi colon. There can be multiple declarations represented by multiple property value pairs. You can also have declarations on separate lines for easy readability like โ€“ P { font-family:Arial; } 4. CSS is a Case-Senstive.
  • #12: Asย youย canย observe,ย Inlineย Styleย hasย theย highestย priority.ย Thisย ย means thatย theย inlineย styleย definedย inย anย HTMLย elementย willย overrideย aย styleย definedย withinย theย headย section,ย whichย inย turnย mayย overrideย theย styleย definedย withinย anย externalย styleย sheet. If the link to the external style sheet is placed below the internal style sheet in HTML <head>, the external style sheet will override the internal style sheet!
  • #34: Note:ย ::selectionย always starts with double colons (::).
  • #35: Note:ย ::selectionย always starts with double colons (::).
  • #42: Note:ย This example does not work in Internet Explorer 9 and earlier versions. There are different properties like - transition-timing-function: ease, linear, ease-in, ease-out, ease-in-out. ; transition-delay: 1s ; transition:ย width 2s, height 2s, transform 2s; etc.
  • #43: Note:ย This example does not work in Internet Explorer 9 and earlier versions. When an animation is finished, it changes back to its original style. There are many properties like โ€“ animation-delay, animation-duration, animation-direction, animation-iteration-count, etc.