SlideShare a Scribd company logo
CSS
& CSS3
    Robyn Overstreet
More CSS Layout
CSS Layout
• Positioning
• Display
• Floats
Inline vs. Block
Block
  Start and end with new lines. Can have a
width.
         <p>, <table>, <div>, ...



Inline
   Does not force new lines. Cannot have
width.
          <b>, <span>, <img>, ...

                              4
Display property
Switch elements between block and
inline display or hide elements
Possible properties
              Text
•   block
•   inline
•   none
             #search-results{
               display:none;
             }
The Box Model
Four parts:
  Content
  Padding
  Border
  Margin




              6
Box Model Measurements‫‏‬
 In most browsers, a box with a 70px width take up
         100px with margin and padding …




                        7
Box Model Measurements‫‏‬
In IE browsers, the padding is subtracted instead of
      added, so the box will take up only 90px.




                         8
Window & Document
Relative Position
Positioned in relation to the other elements
around it
Absolute Position
Positioned in relation to its parent
without regard to the normal flow of
elements
Fixed Position
Absolutely positioned, but relative to
the viewport, instead of its parent
element. The element's position is
specified with the "left", "top",
"right", and "bottom" properties
Positioning Properties
   Positioning properties specify the left, right,
    top, and bottom positions of an absolutely
    positioned element
   They set the shape of an element, place
    one element behind another, and indicate
    directions for fitting an element's content
    in a specified area
img.logo {
      position: absolute;
      top: 0;
      left:0;
      width: 150px;
      height: 150px;
                            13
}
Floating for Layout
Floating allows elements to align to the left or the right of the page.
Inline elements will wrap around floated elements.




              Left Float
Clear
The clear property sets the sides of an element
  where other elements are not allowed.

Possible values:
• left
• right
• both
• none


                         15
2-column Layout
• Experiment with floating both divs
  right, both divs left, or one left and
  one right
3-column Layout
Lab: Layout
• Sketch a design layout on paper
• Build the wireframe in CSS and HTML
• Try positioning a sidebar on the left or
  the right by just changing the CSS
  (not the HTML)
   • Extra: Position a logo over the columns
     using absolute positioning
CSS 3
Modular
CSS3 is a collection of modules
• Allows updates on a module-by-
  module basis (instead of waiting
  for an update of the full spec)
• Browsers can add support for
  features one module at a time
• Browsers are able to implement
  some modules and not others
New Features in CSS 3
New Selectors




Rounded Corners


                          Text-Overflow
                          


Border Image


                          Multi-Column Layout
                          


Color and Opacity: RGBA


                          Web Fonts
                          


Gradients


                          Transitions
                          


Box and Text Shadows


                          Transformations
                          


Multiple Backgrounds


                          Animation
                          


Masks




Reflection

Browser Compatibility
• Many of the CSS3 features only work on specific browsers.
• Need to use browser-specific property names in those cases.
• Prefix with -webkit or -moz

Webkit-specific properties
http://qooxdoo.org/documentation/general/webkit_css_styles


Mozilla-specific properties
https://developer.mozilla.org/en/CSS_Reference/Mozilla_Extensions
Browser
compatibility charts
References for finding browser
support of CSS3 properties
 • CanIUse.com
 • FindMeByIP.com charts
Web Fonts
Web Fonts
@font-face allows use of fonts from URLs



The Basics: Call a font from a URL and give it a name



@font-face {
  font-family: Gentium;
  src: url(http://site/fonts/Gentium.ttf);
}
p { font-family: Gentium, serif; }
Web Fonts
The Thorough: Best bet for cross-browser support

@font-face {
  font-family: "Your typeface";
  src: url("type/filename.eot");
  src: local("Your Typeface"),
    url("type/filename.woff") format("woff"),
    url("type/filename.otf") format("opentype"),
    url("type/filename.svg#filename") format("svg");
  }


• Start with the IE compatible font (.eot)‫‏‬
• Check for a local version of the font
   (this also prevents IE from trying to load formats it can't understand)
• Offer other formats
Font Services
        !   Copyright. Fonts are copyrighted material.


Downloadable Fonts
• Font Squirrel fontsquirrel.com
   Freeware fonts to download and host yourself, with helpers to
   write CSS code

Font Hosting
Fonts delivered from server, with Javascript helpers
• Google Font API code.google.com/webfonts
    Open-source font library with limited number of fonts

• TypeKit typekit.com
   Subscription-based font service with a large library
Lab: Fonts
• Add fonts to your page using the Google
  web fonts API
• Check display across browsers
Text Features
Text Overflow
 A new option for content that overflows its containing box


                   Two roads diverged in
                   a yellow wood, and
                   sorry I could not ...




#poem_box{
   text-overflow: ellipsis;
}
Multi-Column Layout
                   Add -moz- and/
                    or -webkit- to
                     each of these




              column-count:2;

              column-width:250px;

              column-gap:20px;

              column-rule:1px
              dotted;
Multi-Column Layout
  column-count
  column-gap
  column-rule
  column-break-after
  column-break-before
  column-span
  column-fill



  These require -webkit- or -moz- prefixes
New Visual Effects
    in CSS3
RGBA

background: rgba(255,70,280,.6);
                 red   green blue   alpha




                                       60% opacity
Rounded Corners
W3C Official Spec:


border-radius:
55pt / 25pt;
                          Text



Browser Implementation:
                                    New in FF 3.5 !

-webkit-border-radius: 55pt 25pt;   Previous versions
                                    did not support
-moz-border-radius: 55pt / 25pt;
                                    elliptical borders
Quick-fire Lab
Round the corners of a div
Shadows
Applies to text and boxes with text-shadow and box-shadow.


box-shadow: 10px 10px 20px #000;
-webkit-box-shadow: 10px 10px 20px #000;




<horizontal distance> <vertical distance> <blur> <color>
Quick-fire Lab
Apply a shadow to a box or to text
Gradients
background: -webkit-gradient(linear,0 0, 0 100%,
from(#333),to(#fff));


     0, 0
            type: linear or radial.

            points: space separated

            from() and to(): value

            color stop (optional)‫‏‬
               color-stop(80%, #e4c700)‫‏‬

 0, 100%
Quick-fire Lab
Create a gradient background for a
div
Multiple Backgrounds
Add multiple background images by separating urls with a comma




#box{
  background: url(top.gif) top left no-repeat,
  url(bottom.gif) bottom left no-repeat,
  url(middle.gif) left repeat-y;
}
Reflection
 -webkit-box-reflect: <direction> <offset> <mask-box-image>

 <direction> can be one of above, below, left or right.
 <offset> is a length or percentage that specifies the distance of the reflection
 from the edge of the original border box (using the direction specified). It can
 be omitted, in which case it defaults to 0.
 <mask-box-image> is a mask-box-image that can be used to overlay the
 reflection. If omitted, the reflection has no mask.


img.simple_reflect{
             -webkit-box-reflect:below 5px;
}

img.deluxe_reflect{
    -webkit-box-reflect:below 5px -webkit-
gradient(linear, left     top, left bottom,
from(transparent), color-stop(.7,
    transparent), to(rgba(255, 255, 255, 0.5)));
}
Reflection
img.deluxe_reflect{
    -webkit-box-reflect:below 5px -webkit-
gradient(linear, left     top, left bottom,
from(transparent), color-stop(.7,
    transparent), to(rgba(255, 255, 255, 0.5)));
}
Quick-fire Lab
Try multiple background images
and/or reflection
Masks
img.photo {
    -webkit-mask-box-image: url(mask.png);
}




            +                 =
Border Image
#box{
     border-width: 8px;
     -webkit-border-image: url("border2.png") 8 round;
}




   <div id=”box”>


                        border2.png
Graphic
Transformations
2D Transformations
The transformation functions:
scale, scaleX, scaleY
translate, translateX, translateY
skew, skewX, skewY
rotate
matrix



  -webkit-transform: skew(0deg, 30deg);
  -webkit-transform: rotate(30deg);
Transformations: scale




   -moz-transform:   scale(3);      1     = 100%
   or   transform:   scale(1,4);    .2    = 20%
-webkit-transform:   scaleY(1.5);   1.5   = 150%
        transform:   scaleX(.2);    3     = 300%
Transformations: skew
                 transform: skew(0deg, 30deg);




              skewX                               skewY


-webkit-transform: skew(-25deg);   -moz-transform: skew(0deg,-25deg);
Faking 3D: a 2D Cube
.cube {
      position: relative;
      top: 200px;
}
.rightFace,.leftFace,.topFace{
      position: absolute;
      padding: 10px;
      width: 180px;
       height: 180px;
}
.leftFace {
      -webkit-transform: skew(0deg, 30deg);
}
.rightFace {
      -webkit-transform: skew(0deg, -30deg);
      left: 200px;
}
.topFace {
      -webkit-transform: rotate(60deg) skew(0deg, -30deg) scale(1,
1.16);
      top: -158px;
      left: 100px;
}
Lab
Create a skewed box
Animation!
Transitions

#box {
    transition-property: width,height;
    transition-duration: 2s;
    height: 150px;
    width: 150px;
}

#box:hover{
    height: 500px;
    width: 500px;
}
Lab
Create a transition on hover.
Use scale, skew, translate, or change
width or height
Triggering Animation
:hover as used in previous versions of CSS
:target trigger animation with a anchor link, e.g. page.html#start

<div id="b" class="brick">foo</div>
<div id="c" class="brick">foo</div>
<p><a href="#c">drop c</a></p>

div.brick:target{
   -webkit-transform: rotate(30deg);
}

onclick using javascript

<div onclick=
"this.style.webkitTransform='rotate(360deg)'">
Animation: keyframes




             Illustration: Yurike Cynthia Go
                Creative Commons License
Animation: keyframes
@-webkit-keyframes moveitaround{ {
  @-webkit-keyframes moveitaround
  from { {
     from
     -webkit-transform: translate(50px,50px) rotate(30deg);
        -webkit-transform: translate(50px,50px) rotate(30deg);
  } }
  50% { {
     50%
           -webkit-transform: translate(100px,100px) rotate(140deg);
         -webkit-transform: translate(100px,100px) rotate(140deg);
  } }
     to {
  to -webkit-transform: translate(500px,200px) rotate(360deg) ;
       {
    -webkit-transform: translate(500px,200px) rotate(360deg) ;
     }
  }
  }
}


div.mydiv {
     -webkit-animation-name: moveitaround;
     -webkit-animation-duration: 1s;
     -webkit-animation-iteration-count: 3;

}
Animation Examples
Lab
Make an object move across the
screen using keyframes

More Related Content

What's hot

Media queries A to Z
Media queries A to ZMedia queries A to Z
Media queries A to Z
Shameem Reza
 
Flexbox
FlexboxFlexbox
Flexbox
Netcetera
 
Tailwind CSS.11.pptx
Tailwind CSS.11.pptxTailwind CSS.11.pptx
Tailwind CSS.11.pptx
Harish Verma
 
Html5 tutorial for beginners
Html5 tutorial for beginnersHtml5 tutorial for beginners
Html5 tutorial for beginners
Singsys Pte Ltd
 
CSS framework By Palash
CSS framework By PalashCSS framework By Palash
CSS framework By Palash
PalashBajpai
 
CSS Grid vs. Flexbox
CSS Grid vs. FlexboxCSS Grid vs. Flexbox
CSS Grid vs. Flexbox
Ecaterina Moraru (Valica)
 
Html5 and-css3-overview
Html5 and-css3-overviewHtml5 and-css3-overview
Html5 and-css3-overview
Jacob Nelson
 
HTML5
HTML5HTML5
New Elements & Features in CSS3
New Elements & Features in CSS3New Elements & Features in CSS3
New Elements & Features in CSS3Jamshid Hashimi
 
CSS
CSSCSS
An Introduction to CSS Frameworks
An Introduction to CSS FrameworksAn Introduction to CSS Frameworks
An Introduction to CSS Frameworks
Adrian Westlake
 
Introduction to HTML and CSS
Introduction to HTML and CSSIntroduction to HTML and CSS
Introduction to HTML and CSS
Mario Hernandez
 
Introduction to Bootstrap
Introduction to BootstrapIntroduction to Bootstrap
Introduction to Bootstrap
Ron Reiter
 
Introduction to BOOTSTRAP
Introduction to BOOTSTRAPIntroduction to BOOTSTRAP
Introduction to BOOTSTRAP
Jeanie Arnoco
 
Bootstrap 5 basic
Bootstrap 5 basicBootstrap 5 basic
Bootstrap 5 basic
Jubair Ahmed Junjun
 
CSS - OOCSS, SMACSS and more
CSS - OOCSS, SMACSS and moreCSS - OOCSS, SMACSS and more
CSS - OOCSS, SMACSS and more
Russ Weakley
 
Bootstrap Part - 1
Bootstrap Part - 1Bootstrap Part - 1
Bootstrap Part - 1
EPAM Systems
 
HTML and Responsive Design
HTML and Responsive Design HTML and Responsive Design
HTML and Responsive Design
Mindy McAdams
 
Bootstrap 5 ppt
Bootstrap 5 pptBootstrap 5 ppt
Bootstrap 5 ppt
Mallikarjuna G D
 

What's hot (20)

Media queries A to Z
Media queries A to ZMedia queries A to Z
Media queries A to Z
 
Flexbox
FlexboxFlexbox
Flexbox
 
Tailwind CSS.11.pptx
Tailwind CSS.11.pptxTailwind CSS.11.pptx
Tailwind CSS.11.pptx
 
Html5 tutorial for beginners
Html5 tutorial for beginnersHtml5 tutorial for beginners
Html5 tutorial for beginners
 
CSS framework By Palash
CSS framework By PalashCSS framework By Palash
CSS framework By Palash
 
CSS Grid vs. Flexbox
CSS Grid vs. FlexboxCSS Grid vs. Flexbox
CSS Grid vs. Flexbox
 
Html5 and-css3-overview
Html5 and-css3-overviewHtml5 and-css3-overview
Html5 and-css3-overview
 
HTML5
HTML5HTML5
HTML5
 
New Elements & Features in CSS3
New Elements & Features in CSS3New Elements & Features in CSS3
New Elements & Features in CSS3
 
CSS
CSSCSS
CSS
 
An Introduction to CSS Frameworks
An Introduction to CSS FrameworksAn Introduction to CSS Frameworks
An Introduction to CSS Frameworks
 
Introduction to HTML and CSS
Introduction to HTML and CSSIntroduction to HTML and CSS
Introduction to HTML and CSS
 
Introduction to Bootstrap
Introduction to BootstrapIntroduction to Bootstrap
Introduction to Bootstrap
 
CSS
CSSCSS
CSS
 
Introduction to BOOTSTRAP
Introduction to BOOTSTRAPIntroduction to BOOTSTRAP
Introduction to BOOTSTRAP
 
Bootstrap 5 basic
Bootstrap 5 basicBootstrap 5 basic
Bootstrap 5 basic
 
CSS - OOCSS, SMACSS and more
CSS - OOCSS, SMACSS and moreCSS - OOCSS, SMACSS and more
CSS - OOCSS, SMACSS and more
 
Bootstrap Part - 1
Bootstrap Part - 1Bootstrap Part - 1
Bootstrap Part - 1
 
HTML and Responsive Design
HTML and Responsive Design HTML and Responsive Design
HTML and Responsive Design
 
Bootstrap 5 ppt
Bootstrap 5 pptBootstrap 5 ppt
Bootstrap 5 ppt
 

Similar to CSS and CSS3

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
applicake
 
MTA managing the graphical interface by using css
MTA managing the graphical interface by using cssMTA managing the graphical interface by using css
MTA managing the graphical interface by using css
Dhairya Joshi
 
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
Lohith Goudagere Nagaraj
 
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 4Erin M. Kidwell
 
The Future State of Layout
The Future State of LayoutThe Future State of Layout
The Future State of Layout
Stephen Hay
 
Trendsetting: Web Design and Beyond
Trendsetting: Web Design and BeyondTrendsetting: Web Design and Beyond
Trendsetting: Web Design and Beyond
Andy Stratton
 
Css3 and gwt in perfect harmony
Css3 and gwt in perfect harmonyCss3 and gwt in perfect harmony
Css3 and gwt in perfect harmony
jdramaix
 
Css3 and gwt in perfect harmony
Css3 and gwt in perfect harmonyCss3 and gwt in perfect harmony
Css3 and gwt in perfect harmony
Arcbees
 
Intro to CSS3
Intro to CSS3Intro to CSS3
Intro to CSS3
Denise Jacobs
 
CSS3: Ripe and Ready
CSS3: Ripe and ReadyCSS3: Ripe and Ready
CSS3: Ripe and Ready
Denise Jacobs
 
The Future of CSS Layout
The Future of CSS LayoutThe Future of CSS Layout
The Future of CSS Layout
Zoe Gillenwater
 
JavaONE 2012 Using Java with HTML5 and CSS3
JavaONE 2012 Using Java with HTML5 and CSS3JavaONE 2012 Using Java with HTML5 and CSS3
JavaONE 2012 Using Java with HTML5 and CSS3
Helder da Rocha
 
HTML5 - A Whirlwind tour
HTML5 - A Whirlwind tourHTML5 - A Whirlwind tour
HTML5 - A Whirlwind tour
Lohith Goudagere Nagaraj
 
GOTO Berlin - You can use CSS for that
GOTO Berlin - You can use CSS for thatGOTO Berlin - You can use CSS for that
GOTO Berlin - You can use CSS for that
Rachel Andrew
 
Advanced CSS Tricks and Techniques
Advanced CSS Tricks and TechniquesAdvanced CSS Tricks and Techniques
Advanced CSS Tricks and Techniques
Robert Richelieu
 
Simply Responsive CSS3
Simply Responsive CSS3Simply Responsive CSS3
Simply Responsive CSS3
Denise Jacobs
 
Css3 transitions and animations + graceful degradation with jQuery
Css3 transitions and animations + graceful degradation with jQueryCss3 transitions and animations + graceful degradation with jQuery
Css3 transitions and animations + graceful degradation with jQueryAndrea Verlicchi
 
CSS3: Ripe and Ready to Respond
CSS3: Ripe and Ready to RespondCSS3: Ripe and Ready to Respond
CSS3: Ripe and Ready to Respond
Denise Jacobs
 
Ease into HTML5 and CSS3
Ease into HTML5 and CSS3Ease into HTML5 and CSS3
Ease into HTML5 and CSS3
Brian Moon
 

Similar to CSS and 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
 
MTA managing the graphical interface by using css
MTA managing the graphical interface by using cssMTA managing the graphical interface by using css
MTA managing the graphical interface by using css
 
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
 
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
 
The Future State of Layout
The Future State of LayoutThe Future State of Layout
The Future State of Layout
 
Trendsetting: Web Design and Beyond
Trendsetting: Web Design and BeyondTrendsetting: Web Design and Beyond
Trendsetting: Web Design and Beyond
 
Css3 and gwt in perfect harmony
Css3 and gwt in perfect harmonyCss3 and gwt in perfect harmony
Css3 and gwt in perfect harmony
 
Css3 and gwt in perfect harmony
Css3 and gwt in perfect harmonyCss3 and gwt in perfect harmony
Css3 and gwt in perfect harmony
 
Intro to CSS3
Intro to CSS3Intro to CSS3
Intro to CSS3
 
CSS3: Ripe and Ready
CSS3: Ripe and ReadyCSS3: Ripe and Ready
CSS3: Ripe and Ready
 
The Future of CSS Layout
The Future of CSS LayoutThe Future of CSS Layout
The Future of CSS Layout
 
JavaONE 2012 Using Java with HTML5 and CSS3
JavaONE 2012 Using Java with HTML5 and CSS3JavaONE 2012 Using Java with HTML5 and CSS3
JavaONE 2012 Using Java with HTML5 and CSS3
 
HTML5 - A Whirlwind tour
HTML5 - A Whirlwind tourHTML5 - A Whirlwind tour
HTML5 - A Whirlwind tour
 
GOTO Berlin - You can use CSS for that
GOTO Berlin - You can use CSS for thatGOTO Berlin - You can use CSS for that
GOTO Berlin - You can use CSS for that
 
Advanced CSS Tricks and Techniques
Advanced CSS Tricks and TechniquesAdvanced CSS Tricks and Techniques
Advanced CSS Tricks and Techniques
 
Simply Responsive CSS3
Simply Responsive CSS3Simply Responsive CSS3
Simply Responsive CSS3
 
Css3 transitions and animations + graceful degradation with jQuery
Css3 transitions and animations + graceful degradation with jQueryCss3 transitions and animations + graceful degradation with jQuery
Css3 transitions and animations + graceful degradation with jQuery
 
CSS3: Ripe and Ready to Respond
CSS3: Ripe and Ready to RespondCSS3: Ripe and Ready to Respond
CSS3: Ripe and Ready to Respond
 
Ease into HTML5 and CSS3
Ease into HTML5 and CSS3Ease into HTML5 and CSS3
Ease into HTML5 and CSS3
 
Iagc2
Iagc2Iagc2
Iagc2
 

Recently uploaded

JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
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 ...
Product School
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
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...
Thierry Lestable
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
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
Paul Groth
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
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...
Product School
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
Fwdays
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
Abida Shariff
 

Recently uploaded (20)

JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
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 ...
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
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...
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
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
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
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...
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 

CSS and CSS3

  • 1. CSS & CSS3 Robyn Overstreet
  • 3. CSS Layout • Positioning • Display • Floats
  • 4. Inline vs. Block Block Start and end with new lines. Can have a width. <p>, <table>, <div>, ... Inline Does not force new lines. Cannot have width. <b>, <span>, <img>, ... 4
  • 5. Display property Switch elements between block and inline display or hide elements Possible properties Text • block • inline • none #search-results{ display:none; }
  • 6. The Box Model Four parts: Content Padding Border Margin 6
  • 7. Box Model Measurements‫‏‬ In most browsers, a box with a 70px width take up 100px with margin and padding … 7
  • 8. Box Model Measurements‫‏‬ In IE browsers, the padding is subtracted instead of added, so the box will take up only 90px. 8
  • 10. Relative Position Positioned in relation to the other elements around it
  • 11. Absolute Position Positioned in relation to its parent without regard to the normal flow of elements
  • 12. Fixed Position Absolutely positioned, but relative to the viewport, instead of its parent element. The element's position is specified with the "left", "top", "right", and "bottom" properties
  • 13. Positioning Properties  Positioning properties specify the left, right, top, and bottom positions of an absolutely positioned element  They set the shape of an element, place one element behind another, and indicate directions for fitting an element's content in a specified area img.logo { position: absolute; top: 0; left:0; width: 150px; height: 150px; 13 }
  • 14. Floating for Layout Floating allows elements to align to the left or the right of the page. Inline elements will wrap around floated elements. Left Float
  • 15. Clear The clear property sets the sides of an element where other elements are not allowed. Possible values: • left • right • both • none 15
  • 16. 2-column Layout • Experiment with floating both divs right, both divs left, or one left and one right
  • 18. Lab: Layout • Sketch a design layout on paper • Build the wireframe in CSS and HTML • Try positioning a sidebar on the left or the right by just changing the CSS (not the HTML) • Extra: Position a logo over the columns using absolute positioning
  • 19. CSS 3
  • 20. Modular CSS3 is a collection of modules • Allows updates on a module-by- module basis (instead of waiting for an update of the full spec) • Browsers can add support for features one module at a time • Browsers are able to implement some modules and not others
  • 21. New Features in CSS 3 New Selectors  Rounded Corners  Text-Overflow  Border Image  Multi-Column Layout  Color and Opacity: RGBA  Web Fonts  Gradients  Transitions  Box and Text Shadows  Transformations  Multiple Backgrounds  Animation  Masks  Reflection 
  • 22. Browser Compatibility • Many of the CSS3 features only work on specific browsers. • Need to use browser-specific property names in those cases. • Prefix with -webkit or -moz Webkit-specific properties http://qooxdoo.org/documentation/general/webkit_css_styles Mozilla-specific properties https://developer.mozilla.org/en/CSS_Reference/Mozilla_Extensions
  • 23. Browser compatibility charts References for finding browser support of CSS3 properties • CanIUse.com • FindMeByIP.com charts
  • 25. Web Fonts @font-face allows use of fonts from URLs The Basics: Call a font from a URL and give it a name @font-face { font-family: Gentium; src: url(http://site/fonts/Gentium.ttf); } p { font-family: Gentium, serif; }
  • 26. Web Fonts The Thorough: Best bet for cross-browser support @font-face { font-family: "Your typeface"; src: url("type/filename.eot"); src: local("Your Typeface"), url("type/filename.woff") format("woff"), url("type/filename.otf") format("opentype"), url("type/filename.svg#filename") format("svg"); } • Start with the IE compatible font (.eot)‫‏‬ • Check for a local version of the font (this also prevents IE from trying to load formats it can't understand) • Offer other formats
  • 27. Font Services ! Copyright. Fonts are copyrighted material. Downloadable Fonts • Font Squirrel fontsquirrel.com Freeware fonts to download and host yourself, with helpers to write CSS code Font Hosting Fonts delivered from server, with Javascript helpers • Google Font API code.google.com/webfonts Open-source font library with limited number of fonts • TypeKit typekit.com Subscription-based font service with a large library
  • 28. Lab: Fonts • Add fonts to your page using the Google web fonts API • Check display across browsers
  • 30. Text Overflow A new option for content that overflows its containing box Two roads diverged in a yellow wood, and sorry I could not ... #poem_box{ text-overflow: ellipsis; }
  • 31. Multi-Column Layout Add -moz- and/ or -webkit- to each of these column-count:2; column-width:250px; column-gap:20px; column-rule:1px dotted;
  • 32. Multi-Column Layout column-count column-gap column-rule column-break-after column-break-before column-span column-fill These require -webkit- or -moz- prefixes
  • 34. RGBA background: rgba(255,70,280,.6); red green blue alpha 60% opacity
  • 35. Rounded Corners W3C Official Spec: border-radius: 55pt / 25pt; Text Browser Implementation: New in FF 3.5 ! -webkit-border-radius: 55pt 25pt; Previous versions did not support -moz-border-radius: 55pt / 25pt; elliptical borders
  • 36. Quick-fire Lab Round the corners of a div
  • 37. Shadows Applies to text and boxes with text-shadow and box-shadow. box-shadow: 10px 10px 20px #000; -webkit-box-shadow: 10px 10px 20px #000; <horizontal distance> <vertical distance> <blur> <color>
  • 38. Quick-fire Lab Apply a shadow to a box or to text
  • 39. Gradients background: -webkit-gradient(linear,0 0, 0 100%, from(#333),to(#fff)); 0, 0 type: linear or radial. points: space separated from() and to(): value color stop (optional)‫‏‬ color-stop(80%, #e4c700)‫‏‬ 0, 100%
  • 40. Quick-fire Lab Create a gradient background for a div
  • 41. Multiple Backgrounds Add multiple background images by separating urls with a comma #box{ background: url(top.gif) top left no-repeat, url(bottom.gif) bottom left no-repeat, url(middle.gif) left repeat-y; }
  • 42. Reflection -webkit-box-reflect: <direction> <offset> <mask-box-image> <direction> can be one of above, below, left or right. <offset> is a length or percentage that specifies the distance of the reflection from the edge of the original border box (using the direction specified). It can be omitted, in which case it defaults to 0. <mask-box-image> is a mask-box-image that can be used to overlay the reflection. If omitted, the reflection has no mask. img.simple_reflect{ -webkit-box-reflect:below 5px; } img.deluxe_reflect{ -webkit-box-reflect:below 5px -webkit- gradient(linear, left top, left bottom, from(transparent), color-stop(.7, transparent), to(rgba(255, 255, 255, 0.5))); }
  • 43. Reflection img.deluxe_reflect{ -webkit-box-reflect:below 5px -webkit- gradient(linear, left top, left bottom, from(transparent), color-stop(.7, transparent), to(rgba(255, 255, 255, 0.5))); }
  • 44. Quick-fire Lab Try multiple background images and/or reflection
  • 45. Masks img.photo { -webkit-mask-box-image: url(mask.png); } + =
  • 46. Border Image #box{ border-width: 8px; -webkit-border-image: url("border2.png") 8 round; } <div id=”box”> border2.png
  • 48. 2D Transformations The transformation functions: scale, scaleX, scaleY translate, translateX, translateY skew, skewX, skewY rotate matrix -webkit-transform: skew(0deg, 30deg); -webkit-transform: rotate(30deg);
  • 49. Transformations: scale -moz-transform: scale(3); 1 = 100% or transform: scale(1,4); .2 = 20% -webkit-transform: scaleY(1.5); 1.5 = 150% transform: scaleX(.2); 3 = 300%
  • 50. Transformations: skew transform: skew(0deg, 30deg); skewX skewY -webkit-transform: skew(-25deg); -moz-transform: skew(0deg,-25deg);
  • 51. Faking 3D: a 2D Cube .cube { position: relative; top: 200px; } .rightFace,.leftFace,.topFace{ position: absolute; padding: 10px; width: 180px; height: 180px; } .leftFace { -webkit-transform: skew(0deg, 30deg); } .rightFace { -webkit-transform: skew(0deg, -30deg); left: 200px; } .topFace { -webkit-transform: rotate(60deg) skew(0deg, -30deg) scale(1, 1.16); top: -158px; left: 100px; }
  • 54. Transitions #box { transition-property: width,height; transition-duration: 2s; height: 150px; width: 150px; } #box:hover{ height: 500px; width: 500px; }
  • 55. Lab Create a transition on hover. Use scale, skew, translate, or change width or height
  • 56. Triggering Animation :hover as used in previous versions of CSS :target trigger animation with a anchor link, e.g. page.html#start <div id="b" class="brick">foo</div> <div id="c" class="brick">foo</div> <p><a href="#c">drop c</a></p> div.brick:target{ -webkit-transform: rotate(30deg); } onclick using javascript <div onclick= "this.style.webkitTransform='rotate(360deg)'">
  • 57. Animation: keyframes Illustration: Yurike Cynthia Go Creative Commons License
  • 58. Animation: keyframes @-webkit-keyframes moveitaround{ { @-webkit-keyframes moveitaround from { { from -webkit-transform: translate(50px,50px) rotate(30deg); -webkit-transform: translate(50px,50px) rotate(30deg); } } 50% { { 50% -webkit-transform: translate(100px,100px) rotate(140deg); -webkit-transform: translate(100px,100px) rotate(140deg); } } to { to -webkit-transform: translate(500px,200px) rotate(360deg) ; { -webkit-transform: translate(500px,200px) rotate(360deg) ; } } } } div.mydiv { -webkit-animation-name: moveitaround; -webkit-animation-duration: 1s; -webkit-animation-iteration-count: 3; }
  • 60. Lab Make an object move across the screen using keyframes

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. Tip: Start basic.\nLayout and Design Inspiration: \nhttp://www.smashingmagazine.com/2010/08/19/100-free-high-quality-wordpress-themes-for-2010/\nhttp://www.smashingmagazine.com/2010/11/11/designing-memorable-websites-showcase-of-creative-designs/\nhttp://designm.ag/inspiration/non-profit-websites/\nhttp://designm.ag/inspiration/30-beautifully-simple-websites/\nSee the CSS cheat sheet\n\nHTML example:\n &lt;html&gt;&lt;head&gt;&lt;title&gt;The Site&lt;/title&gt;\n &lt;link href=&quot;layout1.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;/&gt;\n &lt;/head&gt;\n &lt;body&gt;\n &lt;div id=&quot;header&quot;&gt;&lt;h1&gt;The Site.&lt;/h1&gt;&lt;/div&gt;\n &lt;div id=&quot;navigation&gt;\n &lt;ul&gt;\n &lt;li&gt;Home&lt;/li&gt;\n &lt;li&gt;Services&lt;/li&gt;\n &lt;li&gt;Blog&lt;/li&gt;\n &lt;li&gt;About&lt;/li&gt;\n &lt;/ul&gt;\n &lt;/div&gt;\n &lt;div id=&quot;sidebar&quot;&gt;\n &lt;h3&gt;Sites I like&lt;/h3&gt;\n &lt;ul&gt;\n &lt;li&gt;alistapart.com&lt;/li&gt;\n &lt;li&gt;lifehacker.com&lt;/li&gt;\n &lt;/ul&gt;\n &lt;/div&gt; \n &lt;div id=&quot;main-content&quot;&gt;\n &lt;h2&gt;Welcome to my site&lt;/h2&gt;\n &lt;p&gt;But, soft! What light through yonder window breaks?\n It is the east, and Juliet is the sun!\n Arise fair sun and kill the envious moon,\n Who is already sick and pale with grief\n That thou her maid are more fair than she. &lt;/p&gt;\n \n &lt;/div&gt;\n&lt;/body&gt;\n
  19. \n
  20. \n
  21. \n
  22. \n
  23. http://caniuse.com/#cats=CSS\nhttp://www.findmebyip.com/litmus\n
  24. \n
  25. \n
  26. \n
  27. http://code.google.com/webfonts\nhttp://typekit.com/\n
  28. http://code.google.com/apis/webfonts/docs/getting_started.html#Quick_Start\nhttps://browserlab.adobe.com\n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n
  46. http://www.lrbabe.com/sdoms/borderImage/\n
  47. \n
  48. \n
  49. \n
  50. \n
  51. \n
  52. \n
  53. \n
  54. \n
  55. \n
  56. \n
  57. \n
  58. \n
  59. keyframes example : anim.html\nother links: walk cycle, photo viewer\n
  60. \n