SlideShare a Scribd company logo
1 of 51
Download to read offline
If you have not already done so,
                   please download Aptana:
                       http://aptana.com




       GDI Cincinnati
Intro to HTML/CSS: Class 4
      Erin M. Kidwell / @erinmkidwell/ erin@girldevelopit.com
  John David Back / @johndavidback / johndavidback@gmail.com
Agenda
1. Review of terms, topics, and styling
2. Print stylesheets
3. Layouts
4. HTML5
5. Detecting browser support
6. CSS3
      Rounded corners / unevenly rounded corners
      Drop shadows / inset shadows
      Text shadows
      Color: RGBA / HSL / HSLA
      Animations: CSS Transforms / Transitions
7. Bonus exercises
      Building a menubar
      Building a two column layout
Review: Terms
Brief Review of HTML Terms
  •     Tag
  •     Elements
  •     Attributes
Brief Review of CSS Terms
  •     Element Selector
  •     Class Selector
  •     Id Selector
  •     Pseudoclasses
Quiz
<html>                                  A) ID Selector
<head>                                  B) Element Selector
       <style>                          C) Class Selector
       .SamplePics
       {
       border: 2px solid pink
       }
       </style>
</head>
<body>
 <img src=“sample_picture.jpg” alt=“Sample”
Width=“100” height=“200” class=“SamplePics”>
Quiz
<html>                                  A) Property
<head>                                  B) Pseudoclass
       <style>                          C) Attribute
       .SamplePics
       {
       border: 2px solid pink
       }
       </style>
</head>
<body>
 <img src=“sample_picture.jpg” alt=“Sample”
Width=“100” height=“200” class=“SamplePics”>
Review: Topics
CSS:
  • Margin and Padding
  • Borders
  • Float
Positioning:
  • Static
  • Fixed
  • Relative
  • Absolute
Quiz
<html>                           To position the div in the
<head>                           middle of the page; we can
    <style>                      add margin: 0 auto; but we
    #centerMe                    also need to specify one more
    {                            property:
        ???: ??? ;               A) Position
        margin: 0px auto;        B) Width
    }                            C) Float
    </style>
</head>
<body>
<div id=”centerMe”>I should be centered on the page!</div>
Review: Styling
CSS Float: an element can be pushed to the left
or right, allowing other elements to wrap around it.
When an element is set to float, text and other
content will flow around the floated element.

The float property specifies whether or not an
element should float. It also specifies which direction it
should float (left, right). Example:
   .alignLeft
   {
        float: left;
   }
CSS Float
This is most
commonly used with
images, in order to
align them left or
right so text flows
around an image.

It is also useful when
working with layouts.
CSS Clear
The clear
property controls
the flow of text
when you’re using
float.
Print Stylesheets
If your webpage contains a variety of background colors it can
be difficult for visitors to print.

We can create a separate stylesheet just to allow visitors to
print by using a new attribute, MEDIA.

It works by adding a second link element to your head
section:
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-
   8" />
   <title>New Web Project</title>
   <link rel="stylesheet" href="style.css">
   <link rel="stylesheet" media="print" href="print.css">
</head>
Print Stylesheets
What do we do in the print.css stylesheet?
We can remove ALL background colors with one
simple line in the body selector:
     background: white;

   Body {
            background: white;
   }
Print Stylesheets
We may also want to remove the menu bar,
which is currently in the footer.
We can do that by leveraging the display
property:

  #footer
  {
      display: none;
  }


 Good resource for tips and tricks on what to add to your print.css stylesheet:
 http://www.alistapart.com/articles/goingtoprint/
Liquid vs Fixed Layout
Fixed Layout:
In a Fixed Layout, the columns are set to a specific width: 500
pixels total (by total, I mean if you add up the widths of all the
columns), 750 pixels total, 900 pixels total, etc. If you resize the
browser on a fixed layout page, the columns will stay the same
size.


Liquid Layout:
In a Liquid Layout, instead of using pixels to set a specific width,
the columns change sizes as you adjust the browser size. One
way to do this is with percentages. The left column could be 20%
of the page, the middle column 50% and the right column 30%,
for example.
Further reading
Samples of just about every layout you can imagine:
http://layouts.ironmyers.com/
http://matthewjamestaylor.com/blog/perfect-3-column.htm

Web Grids - Column-based Layouts:
http://webdesign.about.com/od/layout/ss/web_grids.htm

Fixed-width Layouts Versus Liquid Layouts:
http://webdesign.about.com/od/layout/i/aa060506.htm
Exercise: fixed layout to liquid
Let’s assume we have a three-column layout that uses Absolute
Positioning in CSS, which we reviewed last week.

File: http://livetotry.com/GDI/codeSamples/imitationIsFlattery.html


We’ll use this JSFiddle as our starting point:
http://jsfiddle.net/GzwVb/1/

Finished file: http://jsfiddle.net/GzwVb/5/
HTML5?
Formally, HTML5 is the W3C’s specification for
the next version of HTML.

Informally, people use “HTML5” to refer to a
whole set of new web standards:
  • HTML5
  • CSS3
  • JavaScript
HTML5: Progress and Implementation
HTML5 is still in "working draft" stage

Some of the tech is making it into browsers now, but it'll
still be a while until the specification is
finalized.

It remains to be seen if all browsers will support
all features, and WHEN they will support them.

Here is a good page summarizing which features are
supported by which browser: http://caniuse.com
Detecting browser support
Modernizr: open-source JavaScript library that helps you understand what
your visitor’s browsers do and do not support.

With Modernizr, you can provide different CSS styling for browsers that do not
support new CSS3 features, or use JavaScript to fall back gracefully if the
visitor’s browser does not support the new video element.

Download Modernizr and then include it in your <head> section:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>My Beautiful Sample Page</title>
    <script src="modernizr-1.7.min.js"></script>
</head>
Detecting browser support
Next, add the class “no-js” to the <html> element:
<html class="no-js">

When Modernizr runs, if your browser has JavaScript
enabled, it will replace that class with the class “js”.
<html class="js">

Modernizr will then add classes for every feature it
detects, prefixing them with “no-” if the browser
doesn’t support it.
Detecting browser support
If you are using Safari 5, which supports almost everything in
HTML5/CSS3 currently, your <html> element will look
something like this:

   <html class="js canvas canvastext geolocation rgba hsla multiplebgs
   borderimage borderradius boxshadow opacity cssanimations csscolumns
   cssgradients cssreflections csstransforms csstransforms3d csstransitions video
   audio localstorage sessionstorage webworkers applicationcache fontface">

If you are using IE 8, which supports almost nothing in HTML5/
CSS3 currently, your <html> element will look something like
this:
   <html class="js no-canvas no-canvastext no-geolocation no-rgba no-hsla
   nomultiplebgs
   no-borderimage ... you get the idea >
Modernizer CSS Example
If the browser supports CSS         .csscolumns ol {
columns, the .csscolumns style is
applied.                                -moz-column-count: 2;
                                        -webkit-columns: 2;
If the browser doesn’t support          -o-columns: 2;
CSS columns, as determined by           columns: 2;
the “nocsscolumns” class added
by Modernizr, the .no-              }
csscolumns style is applied.        .no-csscolumns ol {
                                        float: left;
Instead of using CSS columns,           margin: 0 0 20px;
we float our list items and apply
some margins and widths to get      }
a similar result.                   .no-csscolumns ol li {
                                        float: left;
                                        width: 180px;
                                    }
Modernizer
To learn more about how to use Modernizr, see:
http://www.alistapart.com/articles/taking-
advantage-of-html5-and-css3-with-modernizr/

http://www.modernizr.com/docs/
CSS3 Effects
CSS3 is the latest standard for CSS.

It is backwards compatible, so you do not have
to change existing designs.

Browsers will always support CSS2; many of the
CSS3 properties have been adopted by modern
browsers as well.
Old way:

font-family: Helvetica, Verdana, Arial, sans-serif;

Have fallback fonts in case your visitors did not have your favorite font installed.
Create an image with a specific font, to ensure it looks the way you want.

New Way:
With CSS3, instead of relying on fonts everyone has installed, or using a specific font in an
image, you can instruct the browser to download the font if the person viewing your site is
missing the font:

    @font-face
    {
    font-family: "Bitstream Vera Serif Bold";
         src:
         url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");
    }
    body
    {
    font-family: "Bitstream Vera Serif Bold", serif
    }

NOTE that this will only make the font available to the browser, not to the rest of the
computer.
Browser Prefixes
The CSS3 (and HTML5) specs are still in draft format.

Using the browser prefixes ensures that the functionality will
work, even if the w3c changes the standard.
Chrome/Safari: -webkit prefix
Firefox: -moz prefix

While the names and parameters of the new CSS properties are
not likely to change, there is no guarantee that they won’t.

In cases where the spec has been mostly finalized you can simply
use the property name. Ex: border-radius
Exercises: CSS3
Please use: JSFiddle:

Refer to Handout 1 for
Instruction:
Rounded Corners
Unevenly rounded corners
Drop shadows
Inset shadows
Text shadows
Color
RGBA
HSL
HSLA
Transforms
Link to handout
Color
Before, we had three ways to define colors on websites:

1. Color Name (color: blue);
2. Hexadecimal Value (color: #CCC);
3. rgb [color: rgb(255, 255, 255) or color:rgb(90%, 80%, 90%)]

CSS3 has introduced two new ways:
1. rgba
         The a stands for alpha (the level of transparency).
2. hsl and hsla
         HSL = Hue, Saturation and Lightness

rgba = Red, Green, Blue, Alpha
Example: background-color: rgba(255, 255, 255, 0.5);
Color: hsl and hsla
HSL = Hue, Saturation and Lightness
HSLA = Hue, Saturation, Lightness and Alpha
Syntax:
  hsl( hue--in degrees from 0-359, saturation--
  in % from 0-100%, lightness--in % from 0-100%)
  hsla( hue--in degrees from 0-359,
  saturation--in % from 0-100%, lightness--in
  % from 0-100%, alpha--from 0.0-1.0)
Animations
CSS Transforms and Transitions

We can create animations by leveraging the new CSS
Transform and Transition properties.

Transforms allow us to manipulate our elements.

Transitions allow us to specify over what time duration
these changes should happen: effectively animating the
changes.
CSS Transforms
You can use CSS transforms to rotate or scale elements on
your page.

We used to need JavaScript in order to do this!

• Our options: rotate, scale, skew and translate.

starting file: http://jsfiddle.net/8etSs/1/
finished file: http://jsfiddle.net/fiddlefiddle/8etSs/18/
CSS Transforms: Translate
-webkit-transform: translateX(90px);
-moz-transform: translateX(90px);

This will move your element over 90px to the
right (along the x-axis)
CSS Transforms: Scale
-webkit-transform: scale(2.0);
-moz-transform: scale(2.0);
CSS Transforms: Scale
We can also scale only the vertical or the horizontal
by specifying two values

For example, this code will double the width, but
keep the height the same:
   -webkit-transform: scale(2.0, 1.0);
   -moz-transform: scale(2.0, 1.0);

This code will keep the width the same, but shrink
the height to 1/10th of its original size:
   -webkit-transform: scale(1.0, 0.1);
   -moz-transform: scale(1.0, 0.1);
CSS Transforms: Example
/* make a picture 1.25 times its
normal size*/
  -webkit-transform: scale(1.25);
  -moz-transform: scale(1.25);
  -o-transform: scale(1.25);
CSS Transforms: the origin
By default, all the transforms occur from the
center of the element.

If you’d like the origin of the element to be
somewhere other than the center, you can use
the transform-origin property.
     Example:
     -webkit-transform-origin: 0 0;
     -moz-transform-origin: 0 0;
     -op-transform-origin: 0 0;
     transform-origin: 0 0;
CSS Transforms: another example
This JSFiddle example uses two divs to build a circle with a
shadow underneath.

The example uses a combination of CSS3 effects to create the
shadow:

A radial gradient and two transforms, a scale and a translateY.

It also uses two more basic, CSS2 properties to position the
shadow behind the circle along the z-axis: position and z-index

CSS Transforms: another example
Starting file: http://jsfiddle.net/fiddlefiddle/patYu/2/
Ending file: http://jsfiddle.net/fiddlefiddle/patYu/4/
CSS Transitions

Right now, all of these Transforms happen instantly.

Usually, we want Transforms to happen over time,
over at least one second, for example.

We can make that happen by combining our
Transforms with Transitions.
CSS Transitions: No Javascript
We can also leverage CSS pseudoclasses to use CSS
Transitions.

In the sample page:
http://alexisgo.com/resistor/css3effects/transform.html a
combination of Transitions and Transforms are used to both fade
in and scale up the paintings as you hover your mouse over them.
CSS Transitions: No Javascript
CSS Transitions
Making things animate!

With the combination of HTML, CSS and a little bit of JavaScript, we
can animate our HTML elements.

Here is a no-JavaScript example:
http://w3schools.com/css3/tryit.asp?filename=trycss3_transition1

Current support for CSS3 Transitions:
Chrome
Safari 3.1+ (mobile safari on iPhone if you have iOS 2.0+)
Firefox 4.0
IE 10.0
Opera 10.5x
CSS Transitions

More on CSS3 Transitions:
http://css3.bradshawenterprises.com/

http://samuli.hakoniemi.net/css3-transitions-are-wethere-yet/

Final version of transform and transitions JSFiddle:
http://jsfiddle.net/8etSs/
Further Exercises
Sample 2 and 3 Column Layout
Refer to Handout 2 for instructions

Two: http://bit.ly/two_col

Three: http://store.apple.com/us (all fixed)
http://www.amnesty.org/en/who-we-are
 (middle column is liquid)
http://www.sparkfun.com/commerce//news.php?id=448
(all fixed width columns)
Link to Handout
Building a menubar
We will practice using the following CSS and HTML concepts to
build a navigation bar:

    HTML div element
    Using CSS to style an HTML list element
    Using tricks with CSS borders to make an arrow pointing to
     our current page
    Use CSS background-color, margin, and padding to make it
     look nice
    Leverage CSS pseudo-classes to give our links some
     interactivity
    Practice CSS nesting to target only the ul and lis inside a
     given div
Building a menubar




    http://alexisgo.com/teaching/codesamples/lists.html
Building a fixed menubar




      Finished product: http://alexisgo.com/
      teaching/codesamples/fixedMenu.html
THANK YOU!
Congratulations on completing our Intro to HTML/CSS
course!

We want to know your feedback so we can make the class
better each time.

Watch your email for a link to an anonymous survey
about the class.

You can always reach us via the Meetup group, or via
email at erin@girldevelopit.com

More Related Content

What's hot

CSS - OOCSS, SMACSS and more
CSS - OOCSS, SMACSS and moreCSS - OOCSS, SMACSS and more
CSS - OOCSS, SMACSS and moreRuss Weakley
 
2022 HTML5: The future is now
2022 HTML5: The future is now2022 HTML5: The future is now
2022 HTML5: The future is nowGonzalo Cordero
 
Quality Development with CSS3
Quality Development with CSS3Quality Development with CSS3
Quality Development with CSS3Shay Howe
 
CSS3: Simply Responsive
CSS3: Simply ResponsiveCSS3: Simply Responsive
CSS3: Simply ResponsiveDenise Jacobs
 
Whirlwind Tour of SVG (plus RaphaelJS)
Whirlwind Tour of SVG (plus RaphaelJS)Whirlwind Tour of SVG (plus RaphaelJS)
Whirlwind Tour of SVG (plus RaphaelJS)Marc Grabanski
 
Efficient, maintainable CSS
Efficient, maintainable CSSEfficient, maintainable CSS
Efficient, maintainable CSSRuss Weakley
 
Slow kinda sucks
Slow kinda sucksSlow kinda sucks
Slow kinda sucksTim Wright
 
Html & Css presentation
Html  & Css presentation Html  & Css presentation
Html & Css presentation joilrahat
 
CSS in React - The Good, The Bad, and The Ugly
CSS in React - The Good, The Bad, and The UglyCSS in React - The Good, The Bad, and The Ugly
CSS in React - The Good, The Bad, and The UglyJoe Seifi
 
Basics of Front End Web Dev PowerPoint
Basics of Front End Web Dev PowerPointBasics of Front End Web Dev PowerPoint
Basics of Front End Web Dev PowerPointSahil Gandhi
 
Cartegraph Live HTML, CSS, JavaScript and jQuery Training
Cartegraph Live HTML, CSS, JavaScript and jQuery TrainingCartegraph Live HTML, CSS, JavaScript and jQuery Training
Cartegraph Live HTML, CSS, JavaScript and jQuery TrainingShane Church
 
CSS in React
CSS in ReactCSS in React
CSS in ReactJoe Seifi
 
HTML/CSS Crash Course (april 4 2017)
HTML/CSS Crash Course (april 4 2017)HTML/CSS Crash Course (april 4 2017)
HTML/CSS Crash Course (april 4 2017)Daniel Friedman
 
Bootstrap: the full overview
Bootstrap: the full overviewBootstrap: the full overview
Bootstrap: the full overviewGill Cleeren
 

What's hot (19)

CSS3 Introduction
CSS3 IntroductionCSS3 Introduction
CSS3 Introduction
 
Fundamental CSS3
Fundamental CSS3Fundamental CSS3
Fundamental CSS3
 
CSS - OOCSS, SMACSS and more
CSS - OOCSS, SMACSS and moreCSS - OOCSS, SMACSS and more
CSS - OOCSS, SMACSS and more
 
Css
CssCss
Css
 
2022 HTML5: The future is now
2022 HTML5: The future is now2022 HTML5: The future is now
2022 HTML5: The future is now
 
Jquery News Packages
Jquery News PackagesJquery News Packages
Jquery News Packages
 
HTML CSS & Javascript
HTML CSS & JavascriptHTML CSS & Javascript
HTML CSS & Javascript
 
Quality Development with CSS3
Quality Development with CSS3Quality Development with CSS3
Quality Development with CSS3
 
CSS3: Simply Responsive
CSS3: Simply ResponsiveCSS3: Simply Responsive
CSS3: Simply Responsive
 
Whirlwind Tour of SVG (plus RaphaelJS)
Whirlwind Tour of SVG (plus RaphaelJS)Whirlwind Tour of SVG (plus RaphaelJS)
Whirlwind Tour of SVG (plus RaphaelJS)
 
Efficient, maintainable CSS
Efficient, maintainable CSSEfficient, maintainable CSS
Efficient, maintainable CSS
 
Slow kinda sucks
Slow kinda sucksSlow kinda sucks
Slow kinda sucks
 
Html & Css presentation
Html  & Css presentation Html  & Css presentation
Html & Css presentation
 
CSS in React - The Good, The Bad, and The Ugly
CSS in React - The Good, The Bad, and The UglyCSS in React - The Good, The Bad, and The Ugly
CSS in React - The Good, The Bad, and The Ugly
 
Basics of Front End Web Dev PowerPoint
Basics of Front End Web Dev PowerPointBasics of Front End Web Dev PowerPoint
Basics of Front End Web Dev PowerPoint
 
Cartegraph Live HTML, CSS, JavaScript and jQuery Training
Cartegraph Live HTML, CSS, JavaScript and jQuery TrainingCartegraph Live HTML, CSS, JavaScript and jQuery Training
Cartegraph Live HTML, CSS, JavaScript and jQuery Training
 
CSS in React
CSS in ReactCSS in React
CSS in React
 
HTML/CSS Crash Course (april 4 2017)
HTML/CSS Crash Course (april 4 2017)HTML/CSS Crash Course (april 4 2017)
HTML/CSS Crash Course (april 4 2017)
 
Bootstrap: the full overview
Bootstrap: the full overviewBootstrap: the full overview
Bootstrap: the full overview
 

Similar to Girl Develop It Cincinnati: Intro to HTML/CSS Class 4

Organize Your Website With Advanced CSS Tricks
Organize Your Website With Advanced CSS TricksOrganize Your Website With Advanced CSS Tricks
Organize Your Website With Advanced CSS TricksAndolasoft Inc
 
Vskills certified css designer Notes
Vskills certified css designer NotesVskills certified css designer Notes
Vskills certified css designer NotesVskills
 
Structuring your CSS for maintainability: rules and guile lines to write CSS
Structuring your CSS for maintainability: rules and guile lines to write CSSStructuring your CSS for maintainability: rules and guile lines to write CSS
Structuring your CSS for maintainability: rules and guile lines to write CSSSanjoy Kr. Paul
 
Front-End Frameworks: a quick overview
Front-End Frameworks: a quick overviewFront-End Frameworks: a quick overview
Front-End Frameworks: a quick overviewDiacode
 
Thinkful - Frontend Crash Course - Intro to HTML/CSS
Thinkful - Frontend Crash Course - Intro to HTML/CSSThinkful - Frontend Crash Course - Intro to HTML/CSS
Thinkful - Frontend Crash Course - Intro to HTML/CSSTJ Stalcup
 
The CSS Handbook
The CSS HandbookThe CSS Handbook
The CSS Handbookjackchenvlo
 
CSS For Coders
CSS For CodersCSS For Coders
CSS For Codersggfergu
 
CSS Methodology
CSS MethodologyCSS Methodology
CSS MethodologyZohar Arad
 
Howcssworks 100207024009-phpapp01
Howcssworks 100207024009-phpapp01Howcssworks 100207024009-phpapp01
Howcssworks 100207024009-phpapp01Likitha47
 

Similar to Girl Develop It Cincinnati: Intro to HTML/CSS Class 4 (20)

Organize Your Website With Advanced CSS Tricks
Organize Your Website With Advanced CSS TricksOrganize Your Website With Advanced CSS Tricks
Organize Your Website With Advanced CSS Tricks
 
html5_css3
html5_css3html5_css3
html5_css3
 
Pfnp slides
Pfnp slidesPfnp slides
Pfnp slides
 
David Weliver
David WeliverDavid Weliver
David Weliver
 
HowTo_CSS
HowTo_CSSHowTo_CSS
HowTo_CSS
 
HowTo_CSS
HowTo_CSSHowTo_CSS
HowTo_CSS
 
Vskills certified css designer Notes
Vskills certified css designer NotesVskills certified css designer Notes
Vskills certified css designer Notes
 
Structuring your CSS for maintainability: rules and guile lines to write CSS
Structuring your CSS for maintainability: rules and guile lines to write CSSStructuring your CSS for maintainability: rules and guile lines to write CSS
Structuring your CSS for maintainability: rules and guile lines to write CSS
 
Front-End Frameworks: a quick overview
Front-End Frameworks: a quick overviewFront-End Frameworks: a quick overview
Front-End Frameworks: a quick overview
 
Thinkful - Frontend Crash Course - Intro to HTML/CSS
Thinkful - Frontend Crash Course - Intro to HTML/CSSThinkful - Frontend Crash Course - Intro to HTML/CSS
Thinkful - Frontend Crash Course - Intro to HTML/CSS
 
CSS3
CSS3CSS3
CSS3
 
The CSS Handbook
The CSS HandbookThe CSS Handbook
The CSS Handbook
 
Css
CssCss
Css
 
css v1 guru
css v1 gurucss v1 guru
css v1 guru
 
Full
FullFull
Full
 
CSS For Coders
CSS For CodersCSS For Coders
CSS For Coders
 
CSS Methodology
CSS MethodologyCSS Methodology
CSS Methodology
 
Howcssworks 100207024009-phpapp01
Howcssworks 100207024009-phpapp01Howcssworks 100207024009-phpapp01
Howcssworks 100207024009-phpapp01
 
Introduction to css
Introduction to cssIntroduction to css
Introduction to css
 
INTRODUCTIONS OF CSS
INTRODUCTIONS OF CSSINTRODUCTIONS OF CSS
INTRODUCTIONS OF CSS
 

More from Erin M. Kidwell

Class 4 handout w css3 using j fiddle
Class 4 handout w css3 using j fiddleClass 4 handout w css3 using j fiddle
Class 4 handout w css3 using j fiddleErin M. Kidwell
 
Class 4 handout two column layout w mobile web design
Class 4 handout two column layout w mobile web designClass 4 handout two column layout w mobile web design
Class 4 handout two column layout w mobile web designErin M. Kidwell
 
Class 3 create an absolute layout with css abs position (aptana)
Class 3  create an absolute layout with css abs position (aptana)Class 3  create an absolute layout with css abs position (aptana)
Class 3 create an absolute layout with css abs position (aptana)Erin M. Kidwell
 
Class 3 Intro to HTML/ CSS Gdi cincinnati create a table layout with html (...
Class 3 Intro to HTML/ CSS Gdi cincinnati   create a table layout with html (...Class 3 Intro to HTML/ CSS Gdi cincinnati   create a table layout with html (...
Class 3 Intro to HTML/ CSS Gdi cincinnati create a table layout with html (...Erin M. Kidwell
 
Class 2 handout css exercises (2)
Class 2 handout css exercises (2)Class 2 handout css exercises (2)
Class 2 handout css exercises (2)Erin M. Kidwell
 
Class 2 handout (1) adding a css stylesheet
Class 2 handout (1) adding a css stylesheetClass 2 handout (1) adding a css stylesheet
Class 2 handout (1) adding a css stylesheetErin M. Kidwell
 
Class 1 handout (2) html exercises
Class 1 handout (2) html exercisesClass 1 handout (2) html exercises
Class 1 handout (2) html exercisesErin M. Kidwell
 
Class 1 handout (1) aptana create a new presentation and stylesheet
Class 1 handout (1) aptana  create a new presentation and stylesheetClass 1 handout (1) aptana  create a new presentation and stylesheet
Class 1 handout (1) aptana create a new presentation and stylesheetErin M. Kidwell
 
Girl Develop It Cincinnati: Intro to HTML/CSS Class 2
Girl Develop It Cincinnati: Intro to HTML/CSS Class 2Girl Develop It Cincinnati: Intro to HTML/CSS Class 2
Girl Develop It Cincinnati: Intro to HTML/CSS Class 2Erin M. Kidwell
 
Girl Develop It Cincinnati: Intro to HTML/CSS Class 1
Girl Develop It Cincinnati: Intro to HTML/CSS Class 1Girl Develop It Cincinnati: Intro to HTML/CSS Class 1
Girl Develop It Cincinnati: Intro to HTML/CSS Class 1Erin M. Kidwell
 

More from Erin M. Kidwell (10)

Class 4 handout w css3 using j fiddle
Class 4 handout w css3 using j fiddleClass 4 handout w css3 using j fiddle
Class 4 handout w css3 using j fiddle
 
Class 4 handout two column layout w mobile web design
Class 4 handout two column layout w mobile web designClass 4 handout two column layout w mobile web design
Class 4 handout two column layout w mobile web design
 
Class 3 create an absolute layout with css abs position (aptana)
Class 3  create an absolute layout with css abs position (aptana)Class 3  create an absolute layout with css abs position (aptana)
Class 3 create an absolute layout with css abs position (aptana)
 
Class 3 Intro to HTML/ CSS Gdi cincinnati create a table layout with html (...
Class 3 Intro to HTML/ CSS Gdi cincinnati   create a table layout with html (...Class 3 Intro to HTML/ CSS Gdi cincinnati   create a table layout with html (...
Class 3 Intro to HTML/ CSS Gdi cincinnati create a table layout with html (...
 
Class 2 handout css exercises (2)
Class 2 handout css exercises (2)Class 2 handout css exercises (2)
Class 2 handout css exercises (2)
 
Class 2 handout (1) adding a css stylesheet
Class 2 handout (1) adding a css stylesheetClass 2 handout (1) adding a css stylesheet
Class 2 handout (1) adding a css stylesheet
 
Class 1 handout (2) html exercises
Class 1 handout (2) html exercisesClass 1 handout (2) html exercises
Class 1 handout (2) html exercises
 
Class 1 handout (1) aptana create a new presentation and stylesheet
Class 1 handout (1) aptana  create a new presentation and stylesheetClass 1 handout (1) aptana  create a new presentation and stylesheet
Class 1 handout (1) aptana create a new presentation and stylesheet
 
Girl Develop It Cincinnati: Intro to HTML/CSS Class 2
Girl Develop It Cincinnati: Intro to HTML/CSS Class 2Girl Develop It Cincinnati: Intro to HTML/CSS Class 2
Girl Develop It Cincinnati: Intro to HTML/CSS Class 2
 
Girl Develop It Cincinnati: Intro to HTML/CSS Class 1
Girl Develop It Cincinnati: Intro to HTML/CSS Class 1Girl Develop It Cincinnati: Intro to HTML/CSS Class 1
Girl Develop It Cincinnati: Intro to HTML/CSS Class 1
 

Recently uploaded

DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 

Recently uploaded (20)

DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 

Girl Develop It Cincinnati: Intro to HTML/CSS Class 4

  • 1. If you have not already done so, please download Aptana: http://aptana.com GDI Cincinnati Intro to HTML/CSS: Class 4 Erin M. Kidwell / @erinmkidwell/ erin@girldevelopit.com John David Back / @johndavidback / johndavidback@gmail.com
  • 2. Agenda 1. Review of terms, topics, and styling 2. Print stylesheets 3. Layouts 4. HTML5 5. Detecting browser support 6. CSS3 Rounded corners / unevenly rounded corners Drop shadows / inset shadows Text shadows Color: RGBA / HSL / HSLA Animations: CSS Transforms / Transitions 7. Bonus exercises Building a menubar Building a two column layout
  • 3. Review: Terms Brief Review of HTML Terms • Tag • Elements • Attributes Brief Review of CSS Terms • Element Selector • Class Selector • Id Selector • Pseudoclasses
  • 4. Quiz <html> A) ID Selector <head> B) Element Selector <style> C) Class Selector .SamplePics { border: 2px solid pink } </style> </head> <body> <img src=“sample_picture.jpg” alt=“Sample” Width=“100” height=“200” class=“SamplePics”>
  • 5. Quiz <html> A) Property <head> B) Pseudoclass <style> C) Attribute .SamplePics { border: 2px solid pink } </style> </head> <body> <img src=“sample_picture.jpg” alt=“Sample” Width=“100” height=“200” class=“SamplePics”>
  • 6. Review: Topics CSS: • Margin and Padding • Borders • Float Positioning: • Static • Fixed • Relative • Absolute
  • 7. Quiz <html> To position the div in the <head> middle of the page; we can <style> add margin: 0 auto; but we #centerMe also need to specify one more { property: ???: ??? ; A) Position margin: 0px auto; B) Width } C) Float </style> </head> <body> <div id=”centerMe”>I should be centered on the page!</div>
  • 8. Review: Styling CSS Float: an element can be pushed to the left or right, allowing other elements to wrap around it. When an element is set to float, text and other content will flow around the floated element. The float property specifies whether or not an element should float. It also specifies which direction it should float (left, right). Example: .alignLeft { float: left; }
  • 9. CSS Float This is most commonly used with images, in order to align them left or right so text flows around an image. It is also useful when working with layouts.
  • 10. CSS Clear The clear property controls the flow of text when you’re using float.
  • 11. Print Stylesheets If your webpage contains a variety of background colors it can be difficult for visitors to print. We can create a separate stylesheet just to allow visitors to print by using a new attribute, MEDIA. It works by adding a second link element to your head section: <head> <meta http-equiv="Content-Type" content="text/html; charset=utf- 8" /> <title>New Web Project</title> <link rel="stylesheet" href="style.css"> <link rel="stylesheet" media="print" href="print.css"> </head>
  • 12. Print Stylesheets What do we do in the print.css stylesheet? We can remove ALL background colors with one simple line in the body selector: background: white; Body { background: white; }
  • 13. Print Stylesheets We may also want to remove the menu bar, which is currently in the footer. We can do that by leveraging the display property: #footer { display: none; } Good resource for tips and tricks on what to add to your print.css stylesheet: http://www.alistapart.com/articles/goingtoprint/
  • 14. Liquid vs Fixed Layout Fixed Layout: In a Fixed Layout, the columns are set to a specific width: 500 pixels total (by total, I mean if you add up the widths of all the columns), 750 pixels total, 900 pixels total, etc. If you resize the browser on a fixed layout page, the columns will stay the same size. Liquid Layout: In a Liquid Layout, instead of using pixels to set a specific width, the columns change sizes as you adjust the browser size. One way to do this is with percentages. The left column could be 20% of the page, the middle column 50% and the right column 30%, for example.
  • 15. Further reading Samples of just about every layout you can imagine: http://layouts.ironmyers.com/ http://matthewjamestaylor.com/blog/perfect-3-column.htm Web Grids - Column-based Layouts: http://webdesign.about.com/od/layout/ss/web_grids.htm Fixed-width Layouts Versus Liquid Layouts: http://webdesign.about.com/od/layout/i/aa060506.htm
  • 16. Exercise: fixed layout to liquid Let’s assume we have a three-column layout that uses Absolute Positioning in CSS, which we reviewed last week. File: http://livetotry.com/GDI/codeSamples/imitationIsFlattery.html We’ll use this JSFiddle as our starting point: http://jsfiddle.net/GzwVb/1/ Finished file: http://jsfiddle.net/GzwVb/5/
  • 17.
  • 18. HTML5? Formally, HTML5 is the W3C’s specification for the next version of HTML. Informally, people use “HTML5” to refer to a whole set of new web standards: • HTML5 • CSS3 • JavaScript
  • 19. HTML5: Progress and Implementation HTML5 is still in "working draft" stage Some of the tech is making it into browsers now, but it'll still be a while until the specification is finalized. It remains to be seen if all browsers will support all features, and WHEN they will support them. Here is a good page summarizing which features are supported by which browser: http://caniuse.com
  • 20. Detecting browser support Modernizr: open-source JavaScript library that helps you understand what your visitor’s browsers do and do not support. With Modernizr, you can provide different CSS styling for browsers that do not support new CSS3 features, or use JavaScript to fall back gracefully if the visitor’s browser does not support the new video element. Download Modernizr and then include it in your <head> section: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>My Beautiful Sample Page</title> <script src="modernizr-1.7.min.js"></script> </head>
  • 21. Detecting browser support Next, add the class “no-js” to the <html> element: <html class="no-js"> When Modernizr runs, if your browser has JavaScript enabled, it will replace that class with the class “js”. <html class="js"> Modernizr will then add classes for every feature it detects, prefixing them with “no-” if the browser doesn’t support it.
  • 22. Detecting browser support If you are using Safari 5, which supports almost everything in HTML5/CSS3 currently, your <html> element will look something like this: <html class="js canvas canvastext geolocation rgba hsla multiplebgs borderimage borderradius boxshadow opacity cssanimations csscolumns cssgradients cssreflections csstransforms csstransforms3d csstransitions video audio localstorage sessionstorage webworkers applicationcache fontface"> If you are using IE 8, which supports almost nothing in HTML5/ CSS3 currently, your <html> element will look something like this: <html class="js no-canvas no-canvastext no-geolocation no-rgba no-hsla nomultiplebgs no-borderimage ... you get the idea >
  • 23. Modernizer CSS Example If the browser supports CSS .csscolumns ol { columns, the .csscolumns style is applied. -moz-column-count: 2; -webkit-columns: 2; If the browser doesn’t support -o-columns: 2; CSS columns, as determined by columns: 2; the “nocsscolumns” class added by Modernizr, the .no- } csscolumns style is applied. .no-csscolumns ol { float: left; Instead of using CSS columns, margin: 0 0 20px; we float our list items and apply some margins and widths to get } a similar result. .no-csscolumns ol li { float: left; width: 180px; }
  • 24. Modernizer To learn more about how to use Modernizr, see: http://www.alistapart.com/articles/taking- advantage-of-html5-and-css3-with-modernizr/ http://www.modernizr.com/docs/
  • 25. CSS3 Effects CSS3 is the latest standard for CSS. It is backwards compatible, so you do not have to change existing designs. Browsers will always support CSS2; many of the CSS3 properties have been adopted by modern browsers as well.
  • 26. Old way: font-family: Helvetica, Verdana, Arial, sans-serif; Have fallback fonts in case your visitors did not have your favorite font installed. Create an image with a specific font, to ensure it looks the way you want. New Way: With CSS3, instead of relying on fonts everyone has installed, or using a specific font in an image, you can instruct the browser to download the font if the person viewing your site is missing the font: @font-face { font-family: "Bitstream Vera Serif Bold"; src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf"); } body { font-family: "Bitstream Vera Serif Bold", serif } NOTE that this will only make the font available to the browser, not to the rest of the computer.
  • 27. Browser Prefixes The CSS3 (and HTML5) specs are still in draft format. Using the browser prefixes ensures that the functionality will work, even if the w3c changes the standard. Chrome/Safari: -webkit prefix Firefox: -moz prefix While the names and parameters of the new CSS properties are not likely to change, there is no guarantee that they won’t. In cases where the spec has been mostly finalized you can simply use the property name. Ex: border-radius
  • 28. Exercises: CSS3 Please use: JSFiddle: Refer to Handout 1 for Instruction: Rounded Corners Unevenly rounded corners Drop shadows Inset shadows Text shadows Color RGBA HSL HSLA Transforms
  • 30. Color Before, we had three ways to define colors on websites: 1. Color Name (color: blue); 2. Hexadecimal Value (color: #CCC); 3. rgb [color: rgb(255, 255, 255) or color:rgb(90%, 80%, 90%)] CSS3 has introduced two new ways: 1. rgba The a stands for alpha (the level of transparency). 2. hsl and hsla HSL = Hue, Saturation and Lightness rgba = Red, Green, Blue, Alpha Example: background-color: rgba(255, 255, 255, 0.5);
  • 31. Color: hsl and hsla HSL = Hue, Saturation and Lightness HSLA = Hue, Saturation, Lightness and Alpha Syntax: hsl( hue--in degrees from 0-359, saturation-- in % from 0-100%, lightness--in % from 0-100%) hsla( hue--in degrees from 0-359, saturation--in % from 0-100%, lightness--in % from 0-100%, alpha--from 0.0-1.0)
  • 32. Animations CSS Transforms and Transitions We can create animations by leveraging the new CSS Transform and Transition properties. Transforms allow us to manipulate our elements. Transitions allow us to specify over what time duration these changes should happen: effectively animating the changes.
  • 33. CSS Transforms You can use CSS transforms to rotate or scale elements on your page. We used to need JavaScript in order to do this! • Our options: rotate, scale, skew and translate. starting file: http://jsfiddle.net/8etSs/1/ finished file: http://jsfiddle.net/fiddlefiddle/8etSs/18/
  • 34. CSS Transforms: Translate -webkit-transform: translateX(90px); -moz-transform: translateX(90px); This will move your element over 90px to the right (along the x-axis)
  • 35. CSS Transforms: Scale -webkit-transform: scale(2.0); -moz-transform: scale(2.0);
  • 36. CSS Transforms: Scale We can also scale only the vertical or the horizontal by specifying two values For example, this code will double the width, but keep the height the same: -webkit-transform: scale(2.0, 1.0); -moz-transform: scale(2.0, 1.0); This code will keep the width the same, but shrink the height to 1/10th of its original size: -webkit-transform: scale(1.0, 0.1); -moz-transform: scale(1.0, 0.1);
  • 37. CSS Transforms: Example /* make a picture 1.25 times its normal size*/ -webkit-transform: scale(1.25); -moz-transform: scale(1.25); -o-transform: scale(1.25);
  • 38. CSS Transforms: the origin By default, all the transforms occur from the center of the element. If you’d like the origin of the element to be somewhere other than the center, you can use the transform-origin property. Example: -webkit-transform-origin: 0 0; -moz-transform-origin: 0 0; -op-transform-origin: 0 0; transform-origin: 0 0;
  • 39. CSS Transforms: another example This JSFiddle example uses two divs to build a circle with a shadow underneath. The example uses a combination of CSS3 effects to create the shadow: A radial gradient and two transforms, a scale and a translateY. It also uses two more basic, CSS2 properties to position the shadow behind the circle along the z-axis: position and z-index CSS Transforms: another example Starting file: http://jsfiddle.net/fiddlefiddle/patYu/2/ Ending file: http://jsfiddle.net/fiddlefiddle/patYu/4/
  • 40. CSS Transitions Right now, all of these Transforms happen instantly. Usually, we want Transforms to happen over time, over at least one second, for example. We can make that happen by combining our Transforms with Transitions.
  • 41. CSS Transitions: No Javascript We can also leverage CSS pseudoclasses to use CSS Transitions. In the sample page: http://alexisgo.com/resistor/css3effects/transform.html a combination of Transitions and Transforms are used to both fade in and scale up the paintings as you hover your mouse over them.
  • 42. CSS Transitions: No Javascript
  • 43. CSS Transitions Making things animate! With the combination of HTML, CSS and a little bit of JavaScript, we can animate our HTML elements. Here is a no-JavaScript example: http://w3schools.com/css3/tryit.asp?filename=trycss3_transition1 Current support for CSS3 Transitions: Chrome Safari 3.1+ (mobile safari on iPhone if you have iOS 2.0+) Firefox 4.0 IE 10.0 Opera 10.5x
  • 44. CSS Transitions More on CSS3 Transitions: http://css3.bradshawenterprises.com/ http://samuli.hakoniemi.net/css3-transitions-are-wethere-yet/ Final version of transform and transitions JSFiddle: http://jsfiddle.net/8etSs/
  • 46. Sample 2 and 3 Column Layout Refer to Handout 2 for instructions Two: http://bit.ly/two_col Three: http://store.apple.com/us (all fixed) http://www.amnesty.org/en/who-we-are (middle column is liquid) http://www.sparkfun.com/commerce//news.php?id=448 (all fixed width columns)
  • 48. Building a menubar We will practice using the following CSS and HTML concepts to build a navigation bar:  HTML div element  Using CSS to style an HTML list element  Using tricks with CSS borders to make an arrow pointing to our current page  Use CSS background-color, margin, and padding to make it look nice  Leverage CSS pseudo-classes to give our links some interactivity  Practice CSS nesting to target only the ul and lis inside a given div
  • 49. Building a menubar http://alexisgo.com/teaching/codesamples/lists.html
  • 50. Building a fixed menubar Finished product: http://alexisgo.com/ teaching/codesamples/fixedMenu.html
  • 51. THANK YOU! Congratulations on completing our Intro to HTML/CSS course! We want to know your feedback so we can make the class better each time. Watch your email for a link to an anonymous survey about the class. You can always reach us via the Meetup group, or via email at erin@girldevelopit.com