SlideShare una empresa de Scribd logo
1 de 15
Intro to HTML/CSS
                  Class 2 Handout: CSS Exercises

1. Link CSS

  Use the Aptana handout from the first class to create a CSS file for
  your project called style.css. Link the CSS file to your html by adding
  the following code to the head of your HTML document:

  <link rel="stylesheet" href="style.css"/>




2. body & font-family

  The font-family property specifies the font for an element. It can hold
  several font names as a “fallback” in case the user’s browser does
  not support the first font, in which case it tries the next font in the list.

  There are two types of font family names:

      • family-name
           o The name of a font-family, like “times”, “courier” or “ariel”,
               etc
      • generic-family
           o The name of a generic family, such as “serif”, “sans-serif”,
               “cursive” or “monospace”
           o
  Add a font-family to the body of our HTML page by adding the
  following to the style.css file:



                                                                                  1
body{
        font-family: Helvetica;
}




In our Aptana preview pane, our page is now in Helvetica:




That is, if you have Helvetica installed! (Mac users will probably see
the change, and Windows users that don’t have Helvetica installed


                                                                         2
will probably not.) To change our font for all users, we need to add
     some fallback fonts:

     body{
             font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
     }




     Now even if you do not have Helvetica installed, you should at least
     see a sans-serif font.

3.   background-color

     We will also add a background-color to our body selector:

     body{
             font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
             background-color: #88A33E;
     }




     CSS supports 17 standard plus 130 additional color names, such as
     aqua, black, white, gray, lime, etc. You can find those colors at
     http://www.w3schools.com/cssref/css_colornames.asp.

     To specify additional colors, we are using hex values, such as
     #88A33E in the example above, which is a green color. There are
     other ways to specify colors, which we will learn in the fourth class.

   To come up with interesting color schemes, Adobe has a free product
   at http://kuler.adobe.com that allows you to create different color
   schemes based on a starting color.
4. background-image

     Go to the following image on your browser:
     http://citrusmoon.typepad.com/photos/tiles/wikid2.gif


                                                                              3
Right click on the image and save as “background.gif”. In Aptana, in
your FirstProject project folder, right click on the project folder and
click New->Folder to make a new folder. Call this folder images.

In your downloads folder, where you saved the background tile, drag
the background.gif file into the “images” folder in Aptana. When
Aptana prompts you, copy the file.

This is what our directory should look like now:




In our style.css, add the following line to our body selector:

background-image: url('images/background.gif');




Our Aptana preview pane should look like this:




                                                                          4
By default, a background image is placed at the top left corner of an
element, and repeated both vertically and horizontally.

  5. background-attachment, background-position, background-
     repeat

     To alter the default behavior, we can use the following CSS
     properties:

     background-attachment – sets whether a background image is fixed
     or scrolls with the rest of the page

     background-position – sets the starting position of a background
     image

     background-repeat – sets if/how a background image will be repeated


     add the following to the body selector of our style.css file:

     background-repeat:no-repeat;
     background-attachment:fixed;
     background-position:center;




                                                                             5
Now our background tile is centered and does not repeat horizontally
  or vertically:




  But that looks awful, so we will remove those three lines. We just did
  that so we would see how these three CSS properties work.

  Our body selector should look like this again:

  body{
           font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
           background-color: #88A33E;
           background-image: url('images/background.gif');
  }


6. color

  The color property specifies the color of text. Black is a little hard to
  read on our new background, so we will add this color to our body
  selector:

  color: #F7F2B2;




                                                                              6
Now our page looks like this:




Let’s add some different colors for our h1 and h2 tags:

h1{
      color: #541E32;
}
h2{
      color: #8E3557;
}




                                                          7
7. text-indent

  The text-indent property specifies the indentation of the first line ina
  text-bock. We will add a text indent to our <p> tags:

  p{
        text-indent: 50px;
  }




                                                                             8
Now we can go into our index.html and remove the indent we created
with the &nbsp;




                                                                 9
Now our indents are matching:




8. text-transform

  The text-transform property controls the capitalization of text. For
  example, you an set the text-transform property value to uppercase,
  capitalize, or lowercase. Let’s say we want our h1 tags in all
  uppercase:

  h1{
        color: #541E32;
        text-transform: uppercase;
  }




                                                                         10
Now our h1 heading is all caps, even though our source code shows
  otherwise:




9. Other font properties

  We can use other font properties such as font-size, font-weight, and
  font-style to style our text.

  font-size – sets the size of a font. Several units can be specified for
  font-size. You will commonly see pixels (px), but could also see em
  (sets the font in relation to the browser’s default font size), ex (refers
  to the x-height of the font, absolute sizes such as xx-small, x-small,
  small, medium and large, or relative sizes such as smaller or larger.
  W3C recommends using em’s for accessibility.

  font-weight – sets how thick or thin certain characters appear.
  Property values include normal, bold, bolder and lighter.

  font-style: specifies a font-style for the text such as italic or oblique

  Let’s change the style of the text in our p tags:

  p{
        text-indent: 50px;
        font-size: 1.5em;
        font-weight:lighter;
        font-style:oblique;
  }




                                                                              11
10.     div

  Let’s add some div containers around our existing html code. We wll
  give our first div a class name of “info”.

  <div class="info">
        <h1>Learning New Skills</h1>
        <h2>With GDI Cincinnati!</h2>

        <p>Want to learn how to build your own website?<br> Already
  have your own Tumblr/Wordpress/etc site, but want to have more
  control over it?<br> Interested in learning to program but want to start
  small? This class is for you!</p>

        <p>We will guide you through the basics of HTML and CSS,
  give you some readily-applicable skills, and answer any questions
  you may have along the way.</p>
  </div>


                                                                        12
If you look in the Aptana preview pane, our page shouldn’t look any
different.

Let’s add some declarations for our new class, and a comment:

/*This is the style for our "info" class */
.info{
       width: 1024px;
       height: 768px;
       text-align: center;
}




If you scroll down, you will notice a lot of blank space before we reach
the image on our page. This is because of the div height we set in our
CSS.

Let’s add some classes to our lists:


             <ol class="roman">
                   <li>Do my laundry</li>
                   <li>Pay my bills</li>
                   <li>Go to the bank</li>
             </ol>

                                                                      13
<h3>More Things to Do</h3>
              <ul class="square">
                    <li>Do my laundry</li>
                    <li>Pay my bills</li>
                    <li>Go to the bank</li>
              </ul>

  And we will add some class selectors to our CSS:

  ul.square {
        list-style-type:square;
  }

  ol.roman {
        list-style-type: upper-roman;
  }

  Our Aptana preview should show our lists as styled:




11.     Styling tables with CSS

You can use CSS properties such as border, background-color and
color to style your tables.

Add the following selectors and declarations to your style.css:


                                                                  14
table, td, th{
   border: 1px solid #88A33E;
   background-color: #C2BD86;
   color: #88A33E;
}

th{
      background-color: #88A33E;
      color: #C2BD86;
}

Your table should look like this:




                                    15

Más contenido relacionado

La actualidad más candente

ID01 Week 3
ID01 Week 3ID01 Week 3
ID01 Week 3mkontopo
 
Learn CSS From Scratch
Learn CSS From ScratchLearn CSS From Scratch
Learn CSS From Scratchecobold
 
CSS Less framework overview, Pros and Cons
CSS Less framework overview, Pros and ConsCSS Less framework overview, Pros and Cons
CSS Less framework overview, Pros and ConsSanjoy Kr. Paul
 
Custom WordPress theme development
Custom WordPress theme developmentCustom WordPress theme development
Custom WordPress theme developmentTammy Hart
 
WordPress Theme Development for Designers
WordPress Theme Development for DesignersWordPress Theme Development for Designers
WordPress Theme Development for Designerselliotjaystocks
 
ID01 / W01
ID01 / W01ID01 / W01
ID01 / W01mkontopo
 
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...LinnAlexandra
 
WordPress theme development from scratch : ICT MeetUp 2013 Nepal
WordPress theme development from scratch : ICT MeetUp 2013 NepalWordPress theme development from scratch : ICT MeetUp 2013 Nepal
WordPress theme development from scratch : ICT MeetUp 2013 NepalChandra Prakash Thapa
 
Big Design Conference: CSS3
Big Design Conference: CSS3 Big Design Conference: CSS3
Big Design Conference: CSS3 Wynn Netherland
 
Getting Started with Sass & Compass
Getting Started with Sass & CompassGetting Started with Sass & Compass
Getting Started with Sass & CompassRob Davarnia
 
GDI Seattle Intermediate HTML and CSS Class 1
GDI Seattle Intermediate HTML and CSS Class 1GDI Seattle Intermediate HTML and CSS Class 1
GDI Seattle Intermediate HTML and CSS Class 1Heather Rock
 
Haml And Sass In 15 Minutes
Haml And Sass In 15 MinutesHaml And Sass In 15 Minutes
Haml And Sass In 15 MinutesPatrick Crowley
 
WordPress Theme Development: Part 2
WordPress Theme Development: Part 2WordPress Theme Development: Part 2
WordPress Theme Development: Part 2Josh Lee
 
CSS Layout Tutorial
CSS Layout TutorialCSS Layout Tutorial
CSS Layout Tutorialhstryk
 
Accelerated Native Mobile Development with the Ti gem
Accelerated Native Mobile Development with the Ti gemAccelerated Native Mobile Development with the Ti gem
Accelerated Native Mobile Development with the Ti gemWynn Netherland
 
Basic HTML & CSS
Basic HTML & CSSBasic HTML & CSS
Basic HTML & CSSJohn Nelson
 

La actualidad más candente (20)

ID01 Week 3
ID01 Week 3ID01 Week 3
ID01 Week 3
 
Learn CSS From Scratch
Learn CSS From ScratchLearn CSS From Scratch
Learn CSS From Scratch
 
CSS Less framework overview, Pros and Cons
CSS Less framework overview, Pros and ConsCSS Less framework overview, Pros and Cons
CSS Less framework overview, Pros and Cons
 
Custom WordPress theme development
Custom WordPress theme developmentCustom WordPress theme development
Custom WordPress theme development
 
Accelerated Stylesheets
Accelerated StylesheetsAccelerated Stylesheets
Accelerated Stylesheets
 
WordPress Theme Development for Designers
WordPress Theme Development for DesignersWordPress Theme Development for Designers
WordPress Theme Development for Designers
 
ID01 / W01
ID01 / W01ID01 / W01
ID01 / W01
 
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...
 
WordPress theme development from scratch : ICT MeetUp 2013 Nepal
WordPress theme development from scratch : ICT MeetUp 2013 NepalWordPress theme development from scratch : ICT MeetUp 2013 Nepal
WordPress theme development from scratch : ICT MeetUp 2013 Nepal
 
Big Design Conference: CSS3
Big Design Conference: CSS3 Big Design Conference: CSS3
Big Design Conference: CSS3
 
Getting Started with Sass & Compass
Getting Started with Sass & CompassGetting Started with Sass & Compass
Getting Started with Sass & Compass
 
GDI Seattle Intermediate HTML and CSS Class 1
GDI Seattle Intermediate HTML and CSS Class 1GDI Seattle Intermediate HTML and CSS Class 1
GDI Seattle Intermediate HTML and CSS Class 1
 
HTML 101
HTML 101HTML 101
HTML 101
 
Haml And Sass In 15 Minutes
Haml And Sass In 15 MinutesHaml And Sass In 15 Minutes
Haml And Sass In 15 Minutes
 
WordPress Theme Development: Part 2
WordPress Theme Development: Part 2WordPress Theme Development: Part 2
WordPress Theme Development: Part 2
 
Creating forms
Creating formsCreating forms
Creating forms
 
CSS Layout Tutorial
CSS Layout TutorialCSS Layout Tutorial
CSS Layout Tutorial
 
Accelerated Native Mobile Development with the Ti gem
Accelerated Native Mobile Development with the Ti gemAccelerated Native Mobile Development with the Ti gem
Accelerated Native Mobile Development with the Ti gem
 
Sass presentation
Sass presentationSass presentation
Sass presentation
 
Basic HTML & CSS
Basic HTML & CSSBasic HTML & CSS
Basic HTML & CSS
 

Similar a Class 2 handout css exercises (2)

Similar a Class 2 handout css exercises (2) (20)

CSS
CSSCSS
CSS
 
Web Typography
Web TypographyWeb Typography
Web Typography
 
Sacramento web design
Sacramento web designSacramento web design
Sacramento web design
 
Customizing WordPress Themes
Customizing WordPress ThemesCustomizing WordPress Themes
Customizing WordPress Themes
 
CSS
CSSCSS
CSS
 
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
 
INTRODUCTIONS OF CSS
INTRODUCTIONS OF CSSINTRODUCTIONS OF CSS
INTRODUCTIONS OF CSS
 
html-css
html-csshtml-css
html-css
 
CSS ppt
CSS pptCSS ppt
CSS ppt
 
Html n css tutorial
Html n css tutorialHtml n css tutorial
Html n css tutorial
 
Introduction to css
Introduction to cssIntroduction to css
Introduction to css
 
Css introduction
Css  introductionCss  introduction
Css introduction
 
css1.ppt
css1.pptcss1.ppt
css1.ppt
 
waxaada canshuurahaiyosiyaaddaguudeexamarwaaardaydaDAALBADAN.ppt
waxaada canshuurahaiyosiyaaddaguudeexamarwaaardaydaDAALBADAN.pptwaxaada canshuurahaiyosiyaaddaguudeexamarwaaardaydaDAALBADAN.ppt
waxaada canshuurahaiyosiyaaddaguudeexamarwaaardaydaDAALBADAN.ppt
 
Basic html training national
Basic html training nationalBasic html training national
Basic html training national
 
Css
CssCss
Css
 
HTML Lab ProjectTo create a simple web page you will need .docx
HTML Lab ProjectTo create a simple web page you will need .docxHTML Lab ProjectTo create a simple web page you will need .docx
HTML Lab ProjectTo create a simple web page you will need .docx
 
Thuray css3
Thuray css3Thuray css3
Thuray css3
 
Css notes
Css notesCss notes
Css notes
 
Spectrum 2015 going online with style - an intro to css
Spectrum 2015   going online with style - an intro to cssSpectrum 2015   going online with style - an intro to css
Spectrum 2015 going online with style - an intro to css
 

Más de 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 (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
 

Más de Erin M. Kidwell (9)

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 (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
 

Último

Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integrationmarketing932765
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesBernd Ruecker
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 

Último (20)

Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architectures
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 

Class 2 handout css exercises (2)

  • 1. Intro to HTML/CSS Class 2 Handout: CSS Exercises 1. Link CSS Use the Aptana handout from the first class to create a CSS file for your project called style.css. Link the CSS file to your html by adding the following code to the head of your HTML document: <link rel="stylesheet" href="style.css"/> 2. body & font-family The font-family property specifies the font for an element. It can hold several font names as a “fallback” in case the user’s browser does not support the first font, in which case it tries the next font in the list. There are two types of font family names: • family-name o The name of a font-family, like “times”, “courier” or “ariel”, etc • generic-family o The name of a generic family, such as “serif”, “sans-serif”, “cursive” or “monospace” o Add a font-family to the body of our HTML page by adding the following to the style.css file: 1
  • 2. body{ font-family: Helvetica; } In our Aptana preview pane, our page is now in Helvetica: That is, if you have Helvetica installed! (Mac users will probably see the change, and Windows users that don’t have Helvetica installed 2
  • 3. will probably not.) To change our font for all users, we need to add some fallback fonts: body{ font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; } Now even if you do not have Helvetica installed, you should at least see a sans-serif font. 3. background-color We will also add a background-color to our body selector: body{ font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #88A33E; } CSS supports 17 standard plus 130 additional color names, such as aqua, black, white, gray, lime, etc. You can find those colors at http://www.w3schools.com/cssref/css_colornames.asp. To specify additional colors, we are using hex values, such as #88A33E in the example above, which is a green color. There are other ways to specify colors, which we will learn in the fourth class. To come up with interesting color schemes, Adobe has a free product at http://kuler.adobe.com that allows you to create different color schemes based on a starting color. 4. background-image Go to the following image on your browser: http://citrusmoon.typepad.com/photos/tiles/wikid2.gif 3
  • 4. Right click on the image and save as “background.gif”. In Aptana, in your FirstProject project folder, right click on the project folder and click New->Folder to make a new folder. Call this folder images. In your downloads folder, where you saved the background tile, drag the background.gif file into the “images” folder in Aptana. When Aptana prompts you, copy the file. This is what our directory should look like now: In our style.css, add the following line to our body selector: background-image: url('images/background.gif'); Our Aptana preview pane should look like this: 4
  • 5. By default, a background image is placed at the top left corner of an element, and repeated both vertically and horizontally. 5. background-attachment, background-position, background- repeat To alter the default behavior, we can use the following CSS properties: background-attachment – sets whether a background image is fixed or scrolls with the rest of the page background-position – sets the starting position of a background image background-repeat – sets if/how a background image will be repeated add the following to the body selector of our style.css file: background-repeat:no-repeat; background-attachment:fixed; background-position:center; 5
  • 6. Now our background tile is centered and does not repeat horizontally or vertically: But that looks awful, so we will remove those three lines. We just did that so we would see how these three CSS properties work. Our body selector should look like this again: body{ font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; background-color: #88A33E; background-image: url('images/background.gif'); } 6. color The color property specifies the color of text. Black is a little hard to read on our new background, so we will add this color to our body selector: color: #F7F2B2; 6
  • 7. Now our page looks like this: Let’s add some different colors for our h1 and h2 tags: h1{ color: #541E32; } h2{ color: #8E3557; } 7
  • 8. 7. text-indent The text-indent property specifies the indentation of the first line ina text-bock. We will add a text indent to our <p> tags: p{ text-indent: 50px; } 8
  • 9. Now we can go into our index.html and remove the indent we created with the &nbsp; 9
  • 10. Now our indents are matching: 8. text-transform The text-transform property controls the capitalization of text. For example, you an set the text-transform property value to uppercase, capitalize, or lowercase. Let’s say we want our h1 tags in all uppercase: h1{ color: #541E32; text-transform: uppercase; } 10
  • 11. Now our h1 heading is all caps, even though our source code shows otherwise: 9. Other font properties We can use other font properties such as font-size, font-weight, and font-style to style our text. font-size – sets the size of a font. Several units can be specified for font-size. You will commonly see pixels (px), but could also see em (sets the font in relation to the browser’s default font size), ex (refers to the x-height of the font, absolute sizes such as xx-small, x-small, small, medium and large, or relative sizes such as smaller or larger. W3C recommends using em’s for accessibility. font-weight – sets how thick or thin certain characters appear. Property values include normal, bold, bolder and lighter. font-style: specifies a font-style for the text such as italic or oblique Let’s change the style of the text in our p tags: p{ text-indent: 50px; font-size: 1.5em; font-weight:lighter; font-style:oblique; } 11
  • 12. 10. div Let’s add some div containers around our existing html code. We wll give our first div a class name of “info”. <div class="info"> <h1>Learning New Skills</h1> <h2>With GDI Cincinnati!</h2> <p>Want to learn how to build your own website?<br> Already have your own Tumblr/Wordpress/etc site, but want to have more control over it?<br> Interested in learning to program but want to start small? This class is for you!</p> <p>We will guide you through the basics of HTML and CSS, give you some readily-applicable skills, and answer any questions you may have along the way.</p> </div> 12
  • 13. If you look in the Aptana preview pane, our page shouldn’t look any different. Let’s add some declarations for our new class, and a comment: /*This is the style for our "info" class */ .info{ width: 1024px; height: 768px; text-align: center; } If you scroll down, you will notice a lot of blank space before we reach the image on our page. This is because of the div height we set in our CSS. Let’s add some classes to our lists: <ol class="roman"> <li>Do my laundry</li> <li>Pay my bills</li> <li>Go to the bank</li> </ol> 13
  • 14. <h3>More Things to Do</h3> <ul class="square"> <li>Do my laundry</li> <li>Pay my bills</li> <li>Go to the bank</li> </ul> And we will add some class selectors to our CSS: ul.square { list-style-type:square; } ol.roman { list-style-type: upper-roman; } Our Aptana preview should show our lists as styled: 11. Styling tables with CSS You can use CSS properties such as border, background-color and color to style your tables. Add the following selectors and declarations to your style.css: 14
  • 15. table, td, th{ border: 1px solid #88A33E; background-color: #C2BD86; color: #88A33E; } th{ background-color: #88A33E; color: #C2BD86; } Your table should look like this: 15