SlideShare a Scribd company logo
CSS3
Jamshid Hashimi
Trainer, Cresco Solution
http://www.jamshidhashimi.com
jamshid@netlinks.af
@jamshidhashimi
ajamshidhashimi
Afghanistan Workforce
Development Program
Agenda
• CSS3 Introduction
• CSS3 border-radius
• CSS3 box-shadow
• CSS3 text-shadow
• CSS3 Multiple Backgrounds
• CSS3 background-size
• CSS3 text-overflow
• CSS3 resize
• CSS3 Samples
• HTML5 + CSS3 Demo (Responsive)
CSS3 Introduction
• Cascading Style Sheets (CSS) is a style sheet language
used for describing the presentation semantics (the
look and formatting) of a document written in a
markup language. Its most common application is to
style web pages written in HTML and XHTML.
• CSS3 is completely backwards compatible, so you will
not have to change existing designs. Browsers will
always support CSS2.
• The CSS3 specification is still under development by
W3C
• However, many of the new CSS3 properties have been
implemented in modern browsers.
CSS3 Properties
<!DOCTYPE html>
<html>
<head>
<style>
div
{
border:2px solid #a1a1a1;
padding:10px 40px;
background:#dddddd;
width:300px;
border-radius:25px;
}
</style>
</head>
<body>
<div>The border-radius property allows you to add rounded corners
to elements.</div>
</body>
</html>
CSS3 Rounded Corners(border-radius):
CSS3 Properties
• Box-shadow
• box-shadow accepts four parameters:
– x-offset
– y-offset
– blur
– color of shadow
box-shadow: 1px 1px 3px #292929;
CSS3 Properties
<!DOCTYPE html>
<html>
<head>
<style>
div
{
width:300px;
height:100px;
background-color:yellow;
box-shadow: 10px 10px 5px #888888;
}
</style>
</head>
<body>
<div></div>
</body>
</html>
CSS3 Box Shadow (box-shadow):
CSS3 Properties
• text-shadow
– text-shadow is one of the few CSS properties that we
can omit the use of vendor-prefixes. Quite similar to
box-shadow, it must be applied to text, and receives
the same four parameters:
• x-offset
• y-offest
• blur
• color of shadow
text-shadow: 0 1px 0 white;
CSS3 Properties
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Text-Shadow</title>
<style>
body { background: #666; }
h1 {
text-shadow: 0 1px 0 white;
color: #292929;
font-size: 90px;
font-family: helvetica;
}
</style>
</head>
<body>
<h1> Hello Reader </h1>
</body>
</html>
CSS3 Properties
• Multiple Backgrounds
– The background property has been overhauled to
allow for multiple backgrounds in CSS3.
.box {
background: url(image/path.jpg) 0 0 no-repeat,
url(image2/path.jpg) 100% 0 no-repeat;
}
CSS3 Properties
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Multiple Backgrounds</title>
<style>
.box {
/* fallback */
background:
url(http://d2o0t5hpnwv4c1.cloudfront.net/852_workingWithPages/working-with-pages-
in-wordpress.jpg) no-repeat;
/* for modern browsers */
background:
url(http://d2o0t5hpnwv4c1.cloudfront.net/852_workingWithPages/working-with-pages-
in-wordpress.jpg) 0 0 no-
repeat, url(http://d2f29brjr0xbt3.cloudfront.net/premium/promo_graphics/photo_pre
mium.png) 100% 0 no-repeat;
width: 400px;
height :200px;
}
</style>
</head>
<body>
<div class="box"></div>
</body>
CSS3 Properties
• Compensating for Older Browsers
– To add a single background image for older
browsers, like IE7, declare the background
property twice: first for old browsers, and the
second as an override.
.box {
/* fallback */
background: url(image/path.jpg) no-repeat;
/* modern browsers */
background: url(image/path.jpg) 0 0 no-repeat,
url(image2/path.jpg) 100% 0 no-repeat;
}
CSS3 Properties
• background-size
– Another new property introduced by the CSS3
Backgrounds and Borders module is background-
size. The property adds new functionality to CSS
allowing designers to specify the size of
background images using either
lengths, percentages, or by using one of two
keywords; contain or cover.
CSS3 Properties
#example1 {
background-size: auto;
}
#example2 {
background-size: 275px 125px;
}
CSS3 Properties
<!DOCTYPE html>
<html>
<head>
<style>
body
{
background:url("img_flwr.gif");
background-size:80px 60px;
background-repeat:no-repeat;
padding-top:40px;
}
</style>
</head>
<body>
<p>
Some text here
</p>
<p>Original image: <img src="img_flwr.gif" alt="Flowers" width="224"
height="162" /></p>
</body>
</html>
CSS3 Properties
• text-overflow
– The text-overflow property specifies what should
happen when text overflows the containing
element.
– Did You Know? Internet Explorer has provided
support for this property since IE6? They created
it!
div.test
{
text-overflow:ellipsis;
}
CSS3 Properties
<!DOCTYPE html>
<html>
<head>
<style>
div.test
{
white-space:nowrap;
width:12em;
overflow:hidden;
border:1px solid #000000;
}
</style>
</head>
<body>
<div class="test" style="text-overflow:ellipsis;">This is some long text
that will not fit in the box</div>
<p>This div uses "text-overflow:clip":</p>
<div class="test" style="text-overflow:clip;">This is some long text that
will not fit in the box</div>
</body>
</html>
CSS3 Properties
• resize
– The resize property specifies whether or not an
element is resizable by the user.
– Note: The resize property applies to elements
whose computed overflow value is something
other than "visible".
resize: none|both|horizontal|vertical:
CSS3 Properties
<!DOCTYPE html>
<html>
<head>
<style>
div
{
border:2px solid;
padding:10px 40px;
width:300px;
resize:both;
overflow:auto;
}
</style>
</head>
<body>
<div>The resize property specifies whether or not an element is
resizable by the user.</div>
</body>
</html>
Samples
• http://colly.com
• http://fromtheoutfit.com/products
• http://www.webkit.org/blog-files/leaves/index.html
• http://www.addyosmani.com/resources/googlebox/
• http://www.romancortes.com/ficheros/page-flip.html
• http://demo.marcofolio.net/css3_bar_chart/
• http://neography.com/experiment/circles/solarsystem/
HTML5 + CSS3 Demo
QUESTIONS?
Thank YOU!
Come Again :)

More Related Content

What's hot

What's hot (20)

Introduction of Html/css/js
Introduction of Html/css/jsIntroduction of Html/css/js
Introduction of Html/css/js
 
Intro to HTML and CSS basics
Intro to HTML and CSS basicsIntro to HTML and CSS basics
Intro to HTML and CSS basics
 
Html frames
Html framesHtml frames
Html frames
 
JavaScript - Chapter 13 - Browser Object Model(BOM)
JavaScript - Chapter 13 - Browser Object Model(BOM)JavaScript - Chapter 13 - Browser Object Model(BOM)
JavaScript - Chapter 13 - Browser Object Model(BOM)
 
An Overview of HTML, CSS & Java Script
An Overview of HTML, CSS & Java ScriptAn Overview of HTML, CSS & Java Script
An Overview of HTML, CSS & Java Script
 
Introduction to CSS
Introduction to CSSIntroduction to CSS
Introduction to CSS
 
Java script
Java scriptJava script
Java script
 
CSS
CSS CSS
CSS
 
jQuery for beginners
jQuery for beginnersjQuery for beginners
jQuery for beginners
 
cascading style sheet ppt
cascading style sheet pptcascading style sheet ppt
cascading style sheet ppt
 
Advanced Cascading Style Sheets
Advanced Cascading Style SheetsAdvanced Cascading Style Sheets
Advanced Cascading Style Sheets
 
CSS3 Media Queries
CSS3 Media QueriesCSS3 Media Queries
CSS3 Media Queries
 
Introduction to Javascript By Satyen
Introduction to Javascript By  SatyenIntroduction to Javascript By  Satyen
Introduction to Javascript By Satyen
 
Cascading style sheet
Cascading style sheetCascading style sheet
Cascading style sheet
 
Css lecture notes
Css lecture notesCss lecture notes
Css lecture notes
 
HTML CSS & Javascript
HTML CSS & JavascriptHTML CSS & Javascript
HTML CSS & Javascript
 
Bootstrap 4 ppt
Bootstrap 4 pptBootstrap 4 ppt
Bootstrap 4 ppt
 
An Introduction to the DOM
An Introduction to the DOMAn Introduction to the DOM
An Introduction to the DOM
 
Bootstrap PPT by Mukesh
Bootstrap PPT by MukeshBootstrap PPT by Mukesh
Bootstrap PPT by Mukesh
 
Basics of JavaScript
Basics of JavaScriptBasics of JavaScript
Basics of JavaScript
 

Viewers also liked

Intro to modern web technology
Intro to modern web technologyIntro to modern web technology
Intro to modern web technology
Chris Love
 
Latest Trends in Web Technologies
Latest Trends in Web TechnologiesLatest Trends in Web Technologies
Latest Trends in Web Technologies
bryanbibat
 
introduction to web technology
introduction to web technologyintroduction to web technology
introduction to web technology
vikram singh
 

Viewers also liked (12)

CSS 3 Overview
CSS 3 OverviewCSS 3 Overview
CSS 3 Overview
 
Introduction to HTML5 & CSS3
Introduction to HTML5 & CSS3Introduction to HTML5 & CSS3
Introduction to HTML5 & CSS3
 
HTML5 audio & video
HTML5 audio & videoHTML5 audio & video
HTML5 audio & video
 
Presentation about html5 css3
Presentation about html5 css3Presentation about html5 css3
Presentation about html5 css3
 
Open Web Camp: CSS3 Implementable Features
Open Web Camp: CSS3 Implementable FeaturesOpen Web Camp: CSS3 Implementable Features
Open Web Camp: CSS3 Implementable Features
 
New HTML5/CSS3 techniques
New HTML5/CSS3 techniquesNew HTML5/CSS3 techniques
New HTML5/CSS3 techniques
 
Intro to modern web technology
Intro to modern web technologyIntro to modern web technology
Intro to modern web technology
 
Latest Trends in Web Technologies
Latest Trends in Web TechnologiesLatest Trends in Web Technologies
Latest Trends in Web Technologies
 
Introduction to Web Technology
Introduction to Web TechnologyIntroduction to Web Technology
Introduction to Web Technology
 
introduction to web technology
introduction to web technologyintroduction to web technology
introduction to web technology
 
Introduction to HTML
Introduction to HTMLIntroduction to HTML
Introduction to HTML
 
Web Development Trends 2016
Web Development Trends 2016Web Development Trends 2016
Web Development Trends 2016
 

Similar to New Elements & Features in CSS3

Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Erin M. Kidwell
 
Wordcamp Thessaloniki 2011 The Nextweb
Wordcamp Thessaloniki 2011 The NextwebWordcamp Thessaloniki 2011 The Nextweb
Wordcamp Thessaloniki 2011 The Nextweb
George Kanellopoulos
 
Highly Maintainable, Efficient, and Optimized CSS
Highly Maintainable, Efficient, and Optimized CSSHighly Maintainable, Efficient, and Optimized CSS
Highly Maintainable, Efficient, and Optimized CSS
Zoe Gillenwater
 
Website trends 2012 presentation
Website trends 2012 presentationWebsite trends 2012 presentation
Website trends 2012 presentation
Fresh_Egg
 
GR8Conf 2011: Building Progressive UIs with Grails
GR8Conf 2011: Building Progressive UIs with GrailsGR8Conf 2011: Building Progressive UIs with Grails
GR8Conf 2011: Building Progressive UIs with Grails
GR8Conf
 

Similar to New Elements & Features in CSS3 (20)

A brief look at CSS3 techniques by Aaron Rodgers, Web Designer @ vzaar.com
A brief look at CSS3 techniques by Aaron Rodgers, Web Designer @ vzaar.comA brief look at CSS3 techniques by Aaron Rodgers, Web Designer @ vzaar.com
A brief look at CSS3 techniques by Aaron Rodgers, Web Designer @ vzaar.com
 
It's a Mod World - A Practical Guide to Rocking Modernizr
It's a Mod World - A Practical Guide to Rocking ModernizrIt's a Mod World - A Practical Guide to Rocking Modernizr
It's a Mod World - A Practical Guide to Rocking Modernizr
 
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
 
Html5 more than just html5 v final
Html5  more than just html5 v finalHtml5  more than just html5 v final
Html5 more than just html5 v final
 
Responsive design
Responsive designResponsive design
Responsive design
 
Css animation
Css animationCss animation
Css animation
 
Wordcamp Thessaloniki 2011 The Nextweb
Wordcamp Thessaloniki 2011 The NextwebWordcamp Thessaloniki 2011 The Nextweb
Wordcamp Thessaloniki 2011 The Nextweb
 
HTML5 - A Whirlwind tour
HTML5 - A Whirlwind tourHTML5 - A Whirlwind tour
HTML5 - A Whirlwind tour
 
Intro to CSS3
Intro to CSS3Intro to CSS3
Intro to CSS3
 
Highly Maintainable, Efficient, and Optimized CSS
Highly Maintainable, Efficient, and Optimized CSSHighly Maintainable, Efficient, and Optimized CSS
Highly Maintainable, Efficient, and Optimized CSS
 
CSS3: Are you experienced?
CSS3: Are you experienced?CSS3: Are you experienced?
CSS3: Are you experienced?
 
Course Tech 2013, Sasha Vodnik, A Crash Course in HTML5
Course Tech 2013, Sasha Vodnik, A Crash Course in HTML5Course Tech 2013, Sasha Vodnik, A Crash Course in HTML5
Course Tech 2013, Sasha Vodnik, A Crash Course in HTML5
 
Create a landing page
Create a landing pageCreate a landing page
Create a landing page
 
html5_css3
html5_css3html5_css3
html5_css3
 
Adobe MAX 2008: HTML/CSS + Fireworks
Adobe MAX 2008: HTML/CSS + FireworksAdobe MAX 2008: HTML/CSS + Fireworks
Adobe MAX 2008: HTML/CSS + Fireworks
 
Html5 & less css
Html5 & less cssHtml5 & less css
Html5 & less css
 
Website trends 2012 presentation
Website trends 2012 presentationWebsite trends 2012 presentation
Website trends 2012 presentation
 
Css 3 session1
Css 3 session1Css 3 session1
Css 3 session1
 
GR8Conf 2011: Building Progressive UIs with Grails
GR8Conf 2011: Building Progressive UIs with GrailsGR8Conf 2011: Building Progressive UIs with Grails
GR8Conf 2011: Building Progressive UIs with Grails
 
Web Design Trends 2010 - What Is CSS3 All About?
Web Design Trends 2010 - What Is CSS3 All About?Web Design Trends 2010 - What Is CSS3 All About?
Web Design Trends 2010 - What Is CSS3 All About?
 

More from Jamshid Hashimi

CodeIgniter Helper Functions
CodeIgniter Helper FunctionsCodeIgniter Helper Functions
CodeIgniter Helper Functions
Jamshid Hashimi
 
Managing Applications in CodeIgniter
Managing Applications in CodeIgniterManaging Applications in CodeIgniter
Managing Applications in CodeIgniter
Jamshid Hashimi
 
PHP Frameworks & Introduction to CodeIgniter
PHP Frameworks & Introduction to CodeIgniterPHP Frameworks & Introduction to CodeIgniter
PHP Frameworks & Introduction to CodeIgniter
Jamshid Hashimi
 

More from Jamshid Hashimi (20)

Week 2: Getting Your Hands Dirty – Part 2
Week 2: Getting Your Hands Dirty – Part 2Week 2: Getting Your Hands Dirty – Part 2
Week 2: Getting Your Hands Dirty – Part 2
 
Week 1: Getting Your Hands Dirty - Part 1
Week 1: Getting Your Hands Dirty - Part 1Week 1: Getting Your Hands Dirty - Part 1
Week 1: Getting Your Hands Dirty - Part 1
 
Introduction to C# - Week 0
Introduction to C# - Week 0Introduction to C# - Week 0
Introduction to C# - Week 0
 
RIST - Research Institute for Science and Technology
RIST - Research Institute for Science and TechnologyRIST - Research Institute for Science and Technology
RIST - Research Institute for Science and Technology
 
How Coding Can Make Your Life Better
How Coding Can Make Your Life BetterHow Coding Can Make Your Life Better
How Coding Can Make Your Life Better
 
Mobile Vision
Mobile VisionMobile Vision
Mobile Vision
 
Tips for Writing Better Code
Tips for Writing Better CodeTips for Writing Better Code
Tips for Writing Better Code
 
Launch Your Local Blog & Social Media Integration
Launch Your Local Blog & Social Media IntegrationLaunch Your Local Blog & Social Media Integration
Launch Your Local Blog & Social Media Integration
 
Customizing Your Blog 2
Customizing Your Blog 2Customizing Your Blog 2
Customizing Your Blog 2
 
Customizing Your Blog 1
Customizing Your Blog 1Customizing Your Blog 1
Customizing Your Blog 1
 
Introduction to Blogging
Introduction to BloggingIntroduction to Blogging
Introduction to Blogging
 
Introduction to Wordpress
Introduction to WordpressIntroduction to Wordpress
Introduction to Wordpress
 
CodeIgniter Helper Functions
CodeIgniter Helper FunctionsCodeIgniter Helper Functions
CodeIgniter Helper Functions
 
CodeIgniter Class Reference
CodeIgniter Class ReferenceCodeIgniter Class Reference
CodeIgniter Class Reference
 
Managing Applications in CodeIgniter
Managing Applications in CodeIgniterManaging Applications in CodeIgniter
Managing Applications in CodeIgniter
 
CodeIgniter Practice
CodeIgniter PracticeCodeIgniter Practice
CodeIgniter Practice
 
CodeIgniter & MVC
CodeIgniter & MVCCodeIgniter & MVC
CodeIgniter & MVC
 
PHP Frameworks & Introduction to CodeIgniter
PHP Frameworks & Introduction to CodeIgniterPHP Frameworks & Introduction to CodeIgniter
PHP Frameworks & Introduction to CodeIgniter
 
Exception & Database
Exception & DatabaseException & Database
Exception & Database
 
MySQL Record Operations
MySQL Record OperationsMySQL Record Operations
MySQL Record Operations
 

Recently uploaded

Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Peter Udo Diehl
 

Recently uploaded (20)

Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
The architecture of Generative AI for enterprises.pdf
The architecture of Generative AI for enterprises.pdfThe architecture of Generative AI for enterprises.pdf
The architecture of Generative AI for enterprises.pdf
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
 
Introduction to Open Source RAG and RAG Evaluation
Introduction to Open Source RAG and RAG EvaluationIntroduction to Open Source RAG and RAG Evaluation
Introduction to Open Source RAG and RAG Evaluation
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
IESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIESVE for Early Stage Design and Planning
IESVE for Early Stage Design and Planning
 
UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeFree and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
 

New Elements & Features in CSS3

  • 1. CSS3 Jamshid Hashimi Trainer, Cresco Solution http://www.jamshidhashimi.com jamshid@netlinks.af @jamshidhashimi ajamshidhashimi Afghanistan Workforce Development Program
  • 2.
  • 3. Agenda • CSS3 Introduction • CSS3 border-radius • CSS3 box-shadow • CSS3 text-shadow • CSS3 Multiple Backgrounds • CSS3 background-size • CSS3 text-overflow • CSS3 resize • CSS3 Samples • HTML5 + CSS3 Demo (Responsive)
  • 4. CSS3 Introduction • Cascading Style Sheets (CSS) is a style sheet language used for describing the presentation semantics (the look and formatting) of a document written in a markup language. Its most common application is to style web pages written in HTML and XHTML. • CSS3 is completely backwards compatible, so you will not have to change existing designs. Browsers will always support CSS2. • The CSS3 specification is still under development by W3C • However, many of the new CSS3 properties have been implemented in modern browsers.
  • 5. CSS3 Properties <!DOCTYPE html> <html> <head> <style> div { border:2px solid #a1a1a1; padding:10px 40px; background:#dddddd; width:300px; border-radius:25px; } </style> </head> <body> <div>The border-radius property allows you to add rounded corners to elements.</div> </body> </html> CSS3 Rounded Corners(border-radius):
  • 6. CSS3 Properties • Box-shadow • box-shadow accepts four parameters: – x-offset – y-offset – blur – color of shadow box-shadow: 1px 1px 3px #292929;
  • 7. CSS3 Properties <!DOCTYPE html> <html> <head> <style> div { width:300px; height:100px; background-color:yellow; box-shadow: 10px 10px 5px #888888; } </style> </head> <body> <div></div> </body> </html> CSS3 Box Shadow (box-shadow):
  • 8. CSS3 Properties • text-shadow – text-shadow is one of the few CSS properties that we can omit the use of vendor-prefixes. Quite similar to box-shadow, it must be applied to text, and receives the same four parameters: • x-offset • y-offest • blur • color of shadow text-shadow: 0 1px 0 white;
  • 9. CSS3 Properties <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <title>Text-Shadow</title> <style> body { background: #666; } h1 { text-shadow: 0 1px 0 white; color: #292929; font-size: 90px; font-family: helvetica; } </style> </head> <body> <h1> Hello Reader </h1> </body> </html>
  • 10. CSS3 Properties • Multiple Backgrounds – The background property has been overhauled to allow for multiple backgrounds in CSS3. .box { background: url(image/path.jpg) 0 0 no-repeat, url(image2/path.jpg) 100% 0 no-repeat; }
  • 11. CSS3 Properties <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <title>Multiple Backgrounds</title> <style> .box { /* fallback */ background: url(http://d2o0t5hpnwv4c1.cloudfront.net/852_workingWithPages/working-with-pages- in-wordpress.jpg) no-repeat; /* for modern browsers */ background: url(http://d2o0t5hpnwv4c1.cloudfront.net/852_workingWithPages/working-with-pages- in-wordpress.jpg) 0 0 no- repeat, url(http://d2f29brjr0xbt3.cloudfront.net/premium/promo_graphics/photo_pre mium.png) 100% 0 no-repeat; width: 400px; height :200px; } </style> </head> <body> <div class="box"></div> </body>
  • 12. CSS3 Properties • Compensating for Older Browsers – To add a single background image for older browsers, like IE7, declare the background property twice: first for old browsers, and the second as an override. .box { /* fallback */ background: url(image/path.jpg) no-repeat; /* modern browsers */ background: url(image/path.jpg) 0 0 no-repeat, url(image2/path.jpg) 100% 0 no-repeat; }
  • 13. CSS3 Properties • background-size – Another new property introduced by the CSS3 Backgrounds and Borders module is background- size. The property adds new functionality to CSS allowing designers to specify the size of background images using either lengths, percentages, or by using one of two keywords; contain or cover.
  • 14. CSS3 Properties #example1 { background-size: auto; } #example2 { background-size: 275px 125px; }
  • 15. CSS3 Properties <!DOCTYPE html> <html> <head> <style> body { background:url("img_flwr.gif"); background-size:80px 60px; background-repeat:no-repeat; padding-top:40px; } </style> </head> <body> <p> Some text here </p> <p>Original image: <img src="img_flwr.gif" alt="Flowers" width="224" height="162" /></p> </body> </html>
  • 16. CSS3 Properties • text-overflow – The text-overflow property specifies what should happen when text overflows the containing element. – Did You Know? Internet Explorer has provided support for this property since IE6? They created it! div.test { text-overflow:ellipsis; }
  • 17. CSS3 Properties <!DOCTYPE html> <html> <head> <style> div.test { white-space:nowrap; width:12em; overflow:hidden; border:1px solid #000000; } </style> </head> <body> <div class="test" style="text-overflow:ellipsis;">This is some long text that will not fit in the box</div> <p>This div uses "text-overflow:clip":</p> <div class="test" style="text-overflow:clip;">This is some long text that will not fit in the box</div> </body> </html>
  • 18. CSS3 Properties • resize – The resize property specifies whether or not an element is resizable by the user. – Note: The resize property applies to elements whose computed overflow value is something other than "visible". resize: none|both|horizontal|vertical:
  • 19. CSS3 Properties <!DOCTYPE html> <html> <head> <style> div { border:2px solid; padding:10px 40px; width:300px; resize:both; overflow:auto; } </style> </head> <body> <div>The resize property specifies whether or not an element is resizable by the user.</div> </body> </html>
  • 20. Samples • http://colly.com • http://fromtheoutfit.com/products • http://www.webkit.org/blog-files/leaves/index.html • http://www.addyosmani.com/resources/googlebox/ • http://www.romancortes.com/ficheros/page-flip.html • http://demo.marcofolio.net/css3_bar_chart/ • http://neography.com/experiment/circles/solarsystem/
  • 21. HTML5 + CSS3 Demo

Editor's Notes

  1. The box-shadow property can accept a comma-separated list of shadows, each defined by 2-4 length values