SlideShare a Scribd company logo
Varun
Presentation
By
CSS How To
There are three ways of inserting a style sheet:
• External style sheet
• Internal style sheet
• Inline style
External Style Sheet
<head>
<link rel="stylesheet" type="text/css" href="mystyle.css">
</head>
Internal Style Sheet
<head>
<style>
hr {color:sienna;}
p {margin-left:20px;}
body {background-image:url("images/back40.gif");}
</style>
</head>
Inline Styles
<p style="color:sienna;margin-left:20px">This is a paragraph.</p>
The id and class Selectors
Id Selectors
#para1
{
text-align:center;
color:red;
}
class Selectors
.center
{
text-align:center;
}
Element Specific class selector
p.center
{
text-align:center;
}
CSS Styling Background
Background Color
body {background-color:#b0c4de;}
Background Image
body {background-image:url('paper.gif');}
Background Image - Repeat Horizontally or Vertically
body
{
background-image:url('gradient2.png');
background-repeat:repeat-x; //y for vertical
}
Background Image - Set position and no-repeat
body
{
background-image:url('img_tree.png');
background-repeat:no-repeat;
background-position:right top;
}
CSS Styling Text
Text Color
h1 {color:#00ff00;}
Text Alignment
h1 {text-align:center;}
Text Decoration
h1 {text-decoration:overline;}
h2 {text-decoration:line-through;}
h3 {text-decoration:underline;}
Text Transformation
p.uppercase {text-transform:uppercase;}
p.lowercase {text-transform:lowercase;}
p.capitalize {text-transform:capitalize;}
Text Indentation
p {text-indent:50px;}
Box Model
<!DOCTYPE html>
<html>
<head>
<style>
div.ex
{
width:220px;
padding:25px;
border:15px solid gray;
margin:0px;
}
</style>
</head>
<body>
<img src="w3css.gif" width="250" height="250" />
<div class="ex">The picture above is 250px wide.
The total width of this element is also 250px.</div>
</body>
</html>
Styling Links
a:link
{color:#FF0000;} /* unvisited link */
a:visited
{color:#00FF00;} /* visited link */
a:hover
{color:#FF00FF;} /* mouse over link */
a:active
{color:#0000FF;} /* selected link */
• When setting the style for several link states, there are some order rules:
• a:hover MUST come after a:link and a:visited
• a:active MUST come after a:hover
Styling Tables
<style>
table, td, tr
{
border:1px solid green;
}
tr
{
background-color:green;
color:white;
}
</style>
Styling Lists
ul.a {list-style-type:circle;}
ul.b {list-style-type:square;}
ol.c {list-style-type:upper-roman;}
ol.d {list-style-type:lower-alpha;}
<p>Example of unordered lists:</p>
<ul class="a">
<li>Coffee</li>
<li>Tea</li>
<li>Coca Cola</li>
</ul>
<ul class="b">
<li>Coffee</li>
<li>Tea</li>
<li>Coca Cola</li>
</ul>
<p>Example of ordered lists:</p>
<ol class="c">
<li>Coffee</li>
<li>Tea</li>
<li>Coca Cola</li>
</ol>
<ol class="d">
<li>Coffee</li>
<li>Tea</li>
<li>Coca Cola</li>
</ol>
CSS3 Borders
CSS3 Modules
1. Backgrounds and Borders
2. Box Model
3. Text Effects
4. 2D/3D Transformations
5. Animations
6. Selectors
7. Multiple Column Layout
8. User Interface
With CSS3, you can create rounded borders, add shadow to boxes, and use an image as a
border - without using a design program, like Photoshop.
Border properties:
1. border-radius
2. box-shadow
3. border-image
1. CSS3 Rounded Corners
div
{
border:2px solid;
border-radius:25px;
}
Example
1. CSS3 Box Shadow
div
{
box-shadow: 10px 10px 5px #888888;
}
Example
CSS3 Box Shadow - Requires 4 parameters and has an optional fifth.
1. First you have the horizontal offset of the shadow towards your element.
2. Second you have the vertical offset
3. Third parameter is the blur distance. No negative values allowed.
4. Fourth is the color of your shadow.
5. The optional fifth parameter is the ‘inset’ keyword which indicates that the
box-shadow should be an inner shadow instead of the standard outer shadow.
Demo – boxshadow.html
div
{
width:300px;
height:100px;
background-color:yellow;
box-shadow: 10px 10px 5px #888888 inset;
}
CSS3 Border Image
div
{
border-image:url(border.png) 30 30 round;
-webkit-border-image:url(border.png) 30 30 round; /* Safari 5 and older */
-o-border-image:url(border.png) 30 30 round; /* Opera */
}
Original image
The image is tiled (repeated) to
fill the area
The image is stretched to fill the
area
CSS3 Text Shadow - Requires 4 parameters
1. First you have the horizontal offset
2. Second you have the vertical offset
3. Third parameter is the blur distance. No negative values allowed.
4. Fourth is the color of your shadow.
( text-shadow: horizontal-offset vertical-offset blur color; )
Example 01
text-shadow: 2px 4px 3px rgba(0,0,0,0.3);
text-shadow: 4px 3px 0px #fff, 9px 8px 0px rgba(0,0,0,0.15);
02 - Double Shadow
text-shadow: -10px 10px 0px #00e6e6,
-20px 20px 0px #01cccc,
-30px 30px 0px #00bdbd;
02 – 3D Shadow
CSS3 – ( font – face Rule )
1. Before CSS3, web designers had to use fonts that were already installed on the user's computer.
2. With CSS3, web designers can use whatever font he/she likes.
3. When you have found/bought the font you wish to use, include the font file on your web server,
and it will be automatically downloaded to the user when needed.
Your "own" fonts are defined in the CSS3 @font-face rule.
<style>
@font-face
{
font-family: myFirstFont;
src: url(sansation_light.woff);
}
div
{
font-family:myFirstFont;
}
</style>
CSS3 – New User Interface features
1. resize
2. outline-offset
3. box-sizing
CSS3 Resizing
In CSS3, the resize property specifies whether or not an element should be resizable
by the user.
div
{
border:2px solid;
padding:10px 40px;
width:300px;
resize:both;
overflow:auto;
}
http://www.w3schools.com/cssref/playit.asp?filename=playcss_resize&preval=horizontal
resize: none|both|horizontal|vertical:
CSS3 Outline Offset
The outline-offset property offsets an outline, and draws it beyond the border edge.
div
{
margin:20px;
width:150px;
padding:10px;
height:70px;
border:2px solid black;
outline:2px solid red;
outline-offset:15px;
}
CSS3 – Multiple Columns
1. column-count
2. column-gap
3. column-rule
Column Count
With CSS3, you can create multiple columns for laying out text - like in newspapers!
div
{
column-count:3;
-moz-column-count:3; /* Firefox */
-webkit-column-count:3; /* Safari and Chrome */
}
http://www.w3schools.com/cssref/playit.asp?filename=playcss_column-count
Column Gap
div
{
column-gap:40px;
-moz-column-gap:40px; /* Firefox */
-webkit-column-gap:40px; /* Safari and
Chrome */
}
The column-gap property specifies the gap between the columns.
http://www.w3schools.com/cssref/playit.asp?filename=playcss_column-gap
Column Rule
The column-rule property sets the width, style, and color of the rule between columns.
div
{
column-rule:3px outset #ff00ff;
-moz-column-rule:3px outset #ff00ff; /* Firefox
*/
-webkit-column-rule:3px outset #ff00ff; /*
Safari and Chrome */
}
http://www.w3schools.com/cssref/playit.asp?filename=playcss_column-rule-
style&preval=hidden
div
{
column-count:3;
column-rule-style:solid;
column-rule-color:rgba(255,130,255,0.5);
}
http://www.w3schools.com/cssref/playit.asp?f
ilename=playcss_column-rule-color
CSS3 Transitions and Animations
With CSS3, we can add an effect when changing from one style to another,
without using Flash animations or JavaScripts.
property :
-webkit-transition:
-webkit-transition-delay:
-webkit-transition-duration:
-webkit-transition-timing-function:
-webkit-transition-property:
CSS3 Transitions
http://www.w3schools.com/cssref/tryit.asp?filename=trycss3_transition-
property
With CSS3, we can create animations, which can replace animated images, Flash
animations, and JavaScripts in many web pages.
CSS3 @keyframes Rule
div
{
animation: myfirst 5s;
-webkit-animation:myfirst 5s; /* Safari and Chrome */
}
@keyframes myfirst
{
0% {background:red; left:0px; top:0px;}
25% {background:yellow; left:200px; top:0px;}
50% {background:blue; left:200px; top:200px;}
75% {background:green; left:0px; top:200px;}
100% {background:red; left:0px; top:0px;}
}
CSS3 Animation
Thank You

More Related Content

PPTX
KEY
CSS and CSS3
PDF
#4 - CSS Selectors, CSS3 and Web typography
PPT
Getting started with html5
ODP
PDF
Introduction to CSS3
PPTX
Css3 Presetation
CSS and CSS3
#4 - CSS Selectors, CSS3 and Web typography
Getting started with html5
Introduction to CSS3
Css3 Presetation

What's hot (20)

PDF
CSS3 Introduction
PDF
#3 - Sectioning content and outline view
PDF
Intro to CSS3
ODP
Cascading Style Sheets - Part 02
PPTX
Web Development Basics: HOW TO in HTML
PDF
The Dark Arts of CSS
PDF
CSS - OOCSS, SMACSS and more
PDF
CSS3: Ripe and Ready to Respond
PDF
PDF
CSS Reset
PPTX
Introducing Cascading Style Sheets
PDF
Efficient, maintainable CSS
PDF
CSS: a rapidly changing world
PPT
Introduction to CSS
PPT
CSS Methodology
PPTX
Css ppt
PPTX
Introduction to HTML and CSS
PPTX
css v1 guru
PDF
Dive into HTML5: SVG and Canvas
CSS3 Introduction
#3 - Sectioning content and outline view
Intro to CSS3
Cascading Style Sheets - Part 02
Web Development Basics: HOW TO in HTML
The Dark Arts of CSS
CSS - OOCSS, SMACSS and more
CSS3: Ripe and Ready to Respond
CSS Reset
Introducing Cascading Style Sheets
Efficient, maintainable CSS
CSS: a rapidly changing world
Introduction to CSS
CSS Methodology
Css ppt
Introduction to HTML and CSS
css v1 guru
Dive into HTML5: SVG and Canvas
Ad

Viewers also liked (11)

PDF
CSS3 and Selectors
PDF
CSS3 Layout
PPTX
ODP
Estilo & CSS3
PDF
Conoce HTML5 y CSS3
PPT
HTML5 y CSS3
PDF
CSS3 Media Queries
PPTX
Introduction to HTML5 & CSS3
PDF
PPTX
Introducción a HTML5 y CSS3
PPTX
Html5, css3, java script
CSS3 and Selectors
CSS3 Layout
Estilo & CSS3
Conoce HTML5 y CSS3
HTML5 y CSS3
CSS3 Media Queries
Introduction to HTML5 & CSS3
Introducción a HTML5 y CSS3
Html5, css3, java script
Ad

Similar to Css3 (20)

PPTX
CSS3 basics for beginners - Imrokraft
PPTX
Css 3 overview
PDF
CascadingStyleSheets in ONESHOT By DeathCodeYT .pdf
PPTX
Web - CSS 1.pptx
PPTX
New Elements & Features in CSS3
PDF
Pemrograman Web 3 - CSS Basic Part 2
PPTX
CSS Cascade Style Sheet
PPTX
CSS Topic wise Short notes ppt by Navya.E
PPTX
Unit-3-CSS-BWT.pptx
KEY
Trendsetting: Web Design and Beyond
PPT
PPT
CSS - Basics
PPTX
Website trends 2012 presentation
PPT
Tutorial0eesrtjfzjgxkgxkxxkxkgxkgxjffj3.ppt
PPT
CSS Basics
PDF
basics of css
PPTX
CSS 3 Overview
PDF
Introduction to CSS3
PPTX
Unit - 3 CSS(Cascading Style Sheet).pptx
PPTX
Cordova training - Day 2 Introduction to CSS 3
CSS3 basics for beginners - Imrokraft
Css 3 overview
CascadingStyleSheets in ONESHOT By DeathCodeYT .pdf
Web - CSS 1.pptx
New Elements & Features in CSS3
Pemrograman Web 3 - CSS Basic Part 2
CSS Cascade Style Sheet
CSS Topic wise Short notes ppt by Navya.E
Unit-3-CSS-BWT.pptx
Trendsetting: Web Design and Beyond
CSS - Basics
Website trends 2012 presentation
Tutorial0eesrtjfzjgxkgxkxxkxkgxkgxjffj3.ppt
CSS Basics
basics of css
CSS 3 Overview
Introduction to CSS3
Unit - 3 CSS(Cascading Style Sheet).pptx
Cordova training - Day 2 Introduction to CSS 3

Recently uploaded (20)

PPTX
TLE Review Electricity (Electricity).pptx
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
1 - Historical Antecedents, Social Consideration.pdf
PDF
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
PPTX
1. Introduction to Computer Programming.pptx
PDF
Developing a website for English-speaking practice to English as a foreign la...
PDF
WOOl fibre morphology and structure.pdf for textiles
PDF
A comparative study of natural language inference in Swahili using monolingua...
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PPTX
The various Industrial Revolutions .pptx
PDF
NewMind AI Weekly Chronicles – August ’25 Week III
PDF
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
PDF
DP Operators-handbook-extract for the Mautical Institute
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
2021 HotChips TSMC Packaging Technologies for Chiplets and 3D_0819 publish_pu...
PDF
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
PPTX
OMC Textile Division Presentation 2021.pptx
PDF
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
PDF
Architecture types and enterprise applications.pdf
TLE Review Electricity (Electricity).pptx
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
1 - Historical Antecedents, Social Consideration.pdf
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
1. Introduction to Computer Programming.pptx
Developing a website for English-speaking practice to English as a foreign la...
WOOl fibre morphology and structure.pdf for textiles
A comparative study of natural language inference in Swahili using monolingua...
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
gpt5_lecture_notes_comprehensive_20250812015547.pdf
The various Industrial Revolutions .pptx
NewMind AI Weekly Chronicles – August ’25 Week III
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
DP Operators-handbook-extract for the Mautical Institute
Assigned Numbers - 2025 - Bluetooth® Document
2021 HotChips TSMC Packaging Technologies for Chiplets and 3D_0819 publish_pu...
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
OMC Textile Division Presentation 2021.pptx
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
Architecture types and enterprise applications.pdf

Css3

  • 2. CSS How To There are three ways of inserting a style sheet: • External style sheet • Internal style sheet • Inline style External Style Sheet <head> <link rel="stylesheet" type="text/css" href="mystyle.css"> </head> Internal Style Sheet <head> <style> hr {color:sienna;} p {margin-left:20px;} body {background-image:url("images/back40.gif");} </style> </head> Inline Styles <p style="color:sienna;margin-left:20px">This is a paragraph.</p>
  • 3. The id and class Selectors Id Selectors #para1 { text-align:center; color:red; } class Selectors .center { text-align:center; } Element Specific class selector p.center { text-align:center; }
  • 4. CSS Styling Background Background Color body {background-color:#b0c4de;} Background Image body {background-image:url('paper.gif');} Background Image - Repeat Horizontally or Vertically body { background-image:url('gradient2.png'); background-repeat:repeat-x; //y for vertical } Background Image - Set position and no-repeat body { background-image:url('img_tree.png'); background-repeat:no-repeat; background-position:right top; }
  • 5. CSS Styling Text Text Color h1 {color:#00ff00;} Text Alignment h1 {text-align:center;} Text Decoration h1 {text-decoration:overline;} h2 {text-decoration:line-through;} h3 {text-decoration:underline;} Text Transformation p.uppercase {text-transform:uppercase;} p.lowercase {text-transform:lowercase;} p.capitalize {text-transform:capitalize;} Text Indentation p {text-indent:50px;}
  • 6. Box Model <!DOCTYPE html> <html> <head> <style> div.ex { width:220px; padding:25px; border:15px solid gray; margin:0px; } </style> </head> <body> <img src="w3css.gif" width="250" height="250" /> <div class="ex">The picture above is 250px wide. The total width of this element is also 250px.</div> </body> </html>
  • 7. Styling Links a:link {color:#FF0000;} /* unvisited link */ a:visited {color:#00FF00;} /* visited link */ a:hover {color:#FF00FF;} /* mouse over link */ a:active {color:#0000FF;} /* selected link */ • When setting the style for several link states, there are some order rules: • a:hover MUST come after a:link and a:visited • a:active MUST come after a:hover Styling Tables <style> table, td, tr { border:1px solid green; } tr { background-color:green; color:white; } </style>
  • 8. Styling Lists ul.a {list-style-type:circle;} ul.b {list-style-type:square;} ol.c {list-style-type:upper-roman;} ol.d {list-style-type:lower-alpha;} <p>Example of unordered lists:</p> <ul class="a"> <li>Coffee</li> <li>Tea</li> <li>Coca Cola</li> </ul> <ul class="b"> <li>Coffee</li> <li>Tea</li> <li>Coca Cola</li> </ul> <p>Example of ordered lists:</p> <ol class="c"> <li>Coffee</li> <li>Tea</li> <li>Coca Cola</li> </ol> <ol class="d"> <li>Coffee</li> <li>Tea</li> <li>Coca Cola</li> </ol>
  • 9. CSS3 Borders CSS3 Modules 1. Backgrounds and Borders 2. Box Model 3. Text Effects 4. 2D/3D Transformations 5. Animations 6. Selectors 7. Multiple Column Layout 8. User Interface With CSS3, you can create rounded borders, add shadow to boxes, and use an image as a border - without using a design program, like Photoshop. Border properties: 1. border-radius 2. box-shadow 3. border-image
  • 10. 1. CSS3 Rounded Corners div { border:2px solid; border-radius:25px; } Example 1. CSS3 Box Shadow div { box-shadow: 10px 10px 5px #888888; } Example
  • 11. CSS3 Box Shadow - Requires 4 parameters and has an optional fifth. 1. First you have the horizontal offset of the shadow towards your element. 2. Second you have the vertical offset 3. Third parameter is the blur distance. No negative values allowed. 4. Fourth is the color of your shadow. 5. The optional fifth parameter is the ‘inset’ keyword which indicates that the box-shadow should be an inner shadow instead of the standard outer shadow. Demo – boxshadow.html div { width:300px; height:100px; background-color:yellow; box-shadow: 10px 10px 5px #888888 inset; }
  • 12. CSS3 Border Image div { border-image:url(border.png) 30 30 round; -webkit-border-image:url(border.png) 30 30 round; /* Safari 5 and older */ -o-border-image:url(border.png) 30 30 round; /* Opera */ } Original image The image is tiled (repeated) to fill the area The image is stretched to fill the area
  • 13. CSS3 Text Shadow - Requires 4 parameters 1. First you have the horizontal offset 2. Second you have the vertical offset 3. Third parameter is the blur distance. No negative values allowed. 4. Fourth is the color of your shadow. ( text-shadow: horizontal-offset vertical-offset blur color; ) Example 01 text-shadow: 2px 4px 3px rgba(0,0,0,0.3);
  • 14. text-shadow: 4px 3px 0px #fff, 9px 8px 0px rgba(0,0,0,0.15); 02 - Double Shadow text-shadow: -10px 10px 0px #00e6e6, -20px 20px 0px #01cccc, -30px 30px 0px #00bdbd; 02 – 3D Shadow
  • 15. CSS3 – ( font – face Rule ) 1. Before CSS3, web designers had to use fonts that were already installed on the user's computer. 2. With CSS3, web designers can use whatever font he/she likes. 3. When you have found/bought the font you wish to use, include the font file on your web server, and it will be automatically downloaded to the user when needed. Your "own" fonts are defined in the CSS3 @font-face rule. <style> @font-face { font-family: myFirstFont; src: url(sansation_light.woff); } div { font-family:myFirstFont; } </style>
  • 16. CSS3 – New User Interface features 1. resize 2. outline-offset 3. box-sizing CSS3 Resizing In CSS3, the resize property specifies whether or not an element should be resizable by the user. div { border:2px solid; padding:10px 40px; width:300px; resize:both; overflow:auto; } http://www.w3schools.com/cssref/playit.asp?filename=playcss_resize&preval=horizontal resize: none|both|horizontal|vertical:
  • 17. CSS3 Outline Offset The outline-offset property offsets an outline, and draws it beyond the border edge. div { margin:20px; width:150px; padding:10px; height:70px; border:2px solid black; outline:2px solid red; outline-offset:15px; }
  • 18. CSS3 – Multiple Columns 1. column-count 2. column-gap 3. column-rule Column Count With CSS3, you can create multiple columns for laying out text - like in newspapers! div { column-count:3; -moz-column-count:3; /* Firefox */ -webkit-column-count:3; /* Safari and Chrome */ } http://www.w3schools.com/cssref/playit.asp?filename=playcss_column-count
  • 19. Column Gap div { column-gap:40px; -moz-column-gap:40px; /* Firefox */ -webkit-column-gap:40px; /* Safari and Chrome */ } The column-gap property specifies the gap between the columns. http://www.w3schools.com/cssref/playit.asp?filename=playcss_column-gap
  • 20. Column Rule The column-rule property sets the width, style, and color of the rule between columns. div { column-rule:3px outset #ff00ff; -moz-column-rule:3px outset #ff00ff; /* Firefox */ -webkit-column-rule:3px outset #ff00ff; /* Safari and Chrome */ } http://www.w3schools.com/cssref/playit.asp?filename=playcss_column-rule- style&preval=hidden div { column-count:3; column-rule-style:solid; column-rule-color:rgba(255,130,255,0.5); } http://www.w3schools.com/cssref/playit.asp?f ilename=playcss_column-rule-color
  • 21. CSS3 Transitions and Animations
  • 22. With CSS3, we can add an effect when changing from one style to another, without using Flash animations or JavaScripts. property : -webkit-transition: -webkit-transition-delay: -webkit-transition-duration: -webkit-transition-timing-function: -webkit-transition-property: CSS3 Transitions http://www.w3schools.com/cssref/tryit.asp?filename=trycss3_transition- property
  • 23. With CSS3, we can create animations, which can replace animated images, Flash animations, and JavaScripts in many web pages. CSS3 @keyframes Rule div { animation: myfirst 5s; -webkit-animation:myfirst 5s; /* Safari and Chrome */ } @keyframes myfirst { 0% {background:red; left:0px; top:0px;} 25% {background:yellow; left:200px; top:0px;} 50% {background:blue; left:200px; top:200px;} 75% {background:green; left:0px; top:200px;} 100% {background:red; left:0px; top:0px;} } CSS3 Animation