SlideShare a Scribd company logo
CSS Layout Basics
Starting with a new HTML document, letโ€™s just start with our divs.

       <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
           "http://www.w3.org/TR/html4/strict.dtd"
           >
       <html lang="en">
       <head>
           <title>Let's Learn Layouts!</title>
       </head>
       <body>
          <div id="container">

           <div id="headerโ€><div id=โ€œlogoโ€></div></div>

           <div id=โ€contentโ€></div>

           <div id=โ€right_columnโ€></div>

           <div class="featureโ€></div>
           <div class="featureโ€></div>
           <div class="featureโ€></div>

           <div id="footer">THIS IS THE FOOTER</div>

          </div> <!--end of container div-->
       </body>
       </html>
Add content (text, images) to the divs.



  <body>
     <div id="container">
                                                                                                       HTML
      <div id="header"><div id="logo"><img
  src="http://openclipart.org/image/90px/svg_to_png/170921/tikigiki_abstract-element-029.png"></div>THIS IS THE
  HEADER</div>

      <div id="content"><h1>Headline</h1>
        <p>Halvah powder oat cake. <a href="#">Pie oat cake</a> candy halvah cookie topping. Tootsie roll
  toffee faworki cookie ice cream. Jujubes jelly-o caramels. Dragรฉe bear claw biscuit bear claw. Bear claw
  brownie chupa chups ice cream gummi bears sweet. Toffee jujubes topping. Oat cake cake lemon drops jelly
  beans marshmallow marzipan cheesecake lollipop tart.</p>
     <p>Halvah powder oat cake. Pie oat cake candy halvah cookie topping. <a href="#">Tootsie roll toffee</a>
  faworki cookie ice cream. Jujubes jelly-o caramels. Dragรฉe bear claw biscuit bear claw. Bear claw brownie
  chupa chups ice cream gummi bears sweet. Toffee jujubes topping. Oat cake cake lemon drops jelly beans
  marshmallow marzipan cheesecake lollipop tart.</p></div>

  <div id=โ€right_columnโ€></div>

     <div class="featureโ€></div>
     <div class="featureโ€></div>
     <div class="featureโ€></div>

  <div id="footer">THIS IS THE FOOTER</div>

  </div> <!--end of container div-->
  </body>
  </html>
All the HTML with no styling
This is what it looks like if we preview the HTML document. The borders shows how the divs react
without any styling. Notice that by default they are displaying 100% the width of the page. That is
because by default, divs are block-level elements.
Create a stylesheet (CSS) file and link the file to your HTML page. Letโ€™s begin by adding style to the
body and to the #container div.


  body{
      font-family: Futura;
  }

  #container{
      width:800px;
      margin: 0 auto;
      background-color: #FAFCE8;
  }




 Notice that you do NOT need a # on
 the body tag. The body is not a div, it
 is a root element.
Also notice that margin: 0 auto; centers the #container div to the viewport & removes any space
between the very top of the page and the container.
Next, letโ€™s style the #header div.

  #header{                           Because the image is in a div, it is taking up the entire
      height: 80px;
      border:1px solid blue;
                                     width of the parent div, #container and pushing the
      text-align: center;            โ€œTHIS IS THE HEADERโ€ text down.
      padding: 10px;
      margin-bottom: 5px;
      }
This can easily be fixed by adding โ€œfloat:left;โ€ to the #logo div.

   #logo{
       float:left;
       }




   In the normal flow, each block element (div, p, h1, etc.) stacks on top of each other vertically, from the top of the
   viewport down. Floated elements are first laid out according to the normal flow, then taken out of the normal
   flow and sent as far to the right or left (depending on which value is applied) of the parent element. In other
   words, they go from stacking on top of each other to sitting next to each other, given that there is enough room
   in the parent element for each floated element to sit. This behavior is crucial to remember as you build your
   websites.

   http://www.alistapart.com/articles/css-floats-101/
Now letโ€™s style the #content div.

  #content{
      float: left;
      width: 595px;
      border:1px solid red;
  }
When we highlight the #right_column div we see that because it is not styled, the div still has its 100% width. The
content within the div is being pushed by the content in the #content div.
Add styling to the #right_column div.

  #right_column{
      width: 190px;
      border: 1px solid green;
      float: right;
  }




Notice the width of #right_column is
small enough to fit in the 800px width
we created for the #container div.
This is what happens if the width of
#right_column is too big to fit both the
#content div and #right_column. It getโ€™s
pushed out and by default, the other
divs below #right_column move up.

This is why it is important to give your
divs widths.

Heights are not always necessary โ€“ it
depends on whether you want a
specific height to the div OR if you want
the content within your div to
determine the size of the div.
Now we add our .feature styles.

   .feature{
       float: left;
       width: 150px;
       height: 100px;
       border: 1px solid grey;
       margin-right: 10px;
       margin-top: 10px;
       margin-bottom: 10px;
       padding: 5px;
   }




Because the .feature has a
float, the #footer div has moved
up. It helps to think that by
default, HTML elements are like
magnets that will stick to the left of
the page.
We can solve this problem once we style the #footer div.


       #footer{
           clear: both;
           height: 50px;
           border: 1px solid purple;
           text-align: center;
       }




 The clear property
 specifies which sides of
 an element where
 other floating elements
 are not allowed.
Letโ€™s add a little love to the text in the .feature divs so that it doesnโ€™t look broken.

  .feature h3 {
      margin-bottom: 2px;
      margin-top: 0;
  }

  .feature span{
      font-size: 11px;
  }




By default heading tags have a
margin top and a margin
bottom. By specifying the
margin in the h3 tag we
overrode the default.
Now we are left with styling the little details. I want that image to be in the center of the
#right_column div. So letโ€™s add a div around the image tag in our HTML page, with a little inline
styling.


  <div style=โ€display:block; margin-left: auto; margin-right: auto; width:
  175px;"><img src=โ€œimages/johnny_automatic_open_book.svg" height="90"></div>


                                                                 Sometimes it is not the text that needs to
                                                                 be centered, but the block as a whole.
                                                                 Or, phrased differently: we want the left
                                                                 and right margin to be equal. The way to
                                                                 do that is to set the margins to 'auto'. This
                                                                 is normally used with a block of fixed
                                                                 width, because if the block itself is
                                                                 flexible, it will simply take up all the
                                                                 available width.

                                                                 http://www.w3.org/Style/Examples/007/c
                                                                 enter.en.html
Now letโ€™s style the liโ€™s within the #right_column div so they arenโ€™t so bigโ€ฆ

  #right_column li{
      font-size: 12px;
  }




 โ€œGREAT!โ€ The smaller font
 allows for the first feature
 enough room to move up! We
 can solve this one of two ways.

 1. We can give the
 #right_column a specific height
 so that it pushes the .feature div
 down. ORโ€ฆ
2. We can nest our .feature divs in a div with an inline style of โ€œclear:both;โ€

    <div style="clear: both;">
  <div class="feature"><h3>feature1</h3><span>Tootsie roll toffee faworki cookie ice cream.</span></div>
  <div class="feature"><h3>feature2</h3><span>Tootsie roll toffee faworki cookie ice cream.</span></div>
  <div class="feature"><h3>feature3</h3><span>Tootsie roll toffee faworki cookie ice cream.</span></div>
    </div>



                                                                   Here we have all the divs highlighted. You
                                                                   can see the features โ€œlivingโ€ in their new
                                                                   div โ€“ on separate row.
One last detail left! Adding colors to our links in the #content div.

  #content a:link, #content a:visited{
      color: #333;
  }

  #content a:focus, #content a:hover, #content a:active{
      color: green;
  }




                                                                        The first link is highlighted to show the
                                                                        โ€œhoverโ€ state.
Finished HTML
Finished CSS

More Related Content

What's hot (20)

BEM Methodology โ€” @Frontenders Ticino โ€”17/09/2014
BEM Methodology โ€” @Frontenders Ticino โ€”17/09/2014BEM Methodology โ€” @Frontenders Ticino โ€”17/09/2014
BEM Methodology โ€” @Frontenders Ticino โ€”17/09/2014
vzaccaria
ย 
Html n css tutorial
Html n css tutorialHtml n css tutorial
Html n css tutorial
zubeditufail
ย 
Modular HTML, CSS, & JS Workshop
Modular HTML, CSS, & JS WorkshopModular HTML, CSS, & JS Workshop
Modular HTML, CSS, & JS Workshop
Shay Howe
ย 
HTML & CSS Workshop Notes
HTML & CSS Workshop NotesHTML & CSS Workshop Notes
HTML & CSS Workshop Notes
Pamela Fox
ย 
The Cascade, Grids, Headings, and Selectors from an OOCSS Perspective, Ajax ...
The Cascade, Grids, Headings, and Selectors from an OOCSS Perspective,  Ajax ...The Cascade, Grids, Headings, and Selectors from an OOCSS Perspective,  Ajax ...
The Cascade, Grids, Headings, and Selectors from an OOCSS Perspective, Ajax ...
Nicole Sullivan
ย 
Progressive Prototyping w/HTML5, CSS3 and jQuery
Progressive Prototyping w/HTML5, CSS3 and jQueryProgressive Prototyping w/HTML5, CSS3 and jQuery
Progressive Prototyping w/HTML5, CSS3 and jQuery
Todd Zaki Warfel
ย 
Using Core Themes in Drupal 8
Using Core Themes in Drupal 8Using Core Themes in Drupal 8
Using Core Themes in Drupal 8
Suzanne Dergacheva
ย 
Html5 ux london
Html5 ux londonHtml5 ux london
Html5 ux london
Todd Zaki Warfel
ย 
Learn SUIT: CSS Naming Convention
Learn SUIT: CSS Naming ConventionLearn SUIT: CSS Naming Convention
Learn SUIT: CSS Naming Convention
In a Rocket
ย 
About Best friends - HTML, CSS and JS
About Best friends - HTML, CSS and JSAbout Best friends - HTML, CSS and JS
About Best friends - HTML, CSS and JS
Naga Harish M
ย 
Web Design 101
Web Design 101Web Design 101
Web Design 101
vegdwk
ย 
Supercharged HTML & CSS
Supercharged HTML & CSSSupercharged HTML & CSS
Supercharged HTML & CSS
Max Kraszewski
ย 
Pamela - Brining back the pleasure of hand-written HTML - Montrรฉal Python 8
Pamela - Brining back the pleasure of hand-written HTML - Montrรฉal Python 8Pamela - Brining back the pleasure of hand-written HTML - Montrรฉal Python 8
Pamela - Brining back the pleasure of hand-written HTML - Montrรฉal Python 8
spierre
ย 
Prototyping w/HTML5 and CSS3
Prototyping w/HTML5 and CSS3Prototyping w/HTML5 and CSS3
Prototyping w/HTML5 and CSS3
Todd Zaki Warfel
ย 
Shaping Up With CSS
Shaping Up With CSSShaping Up With CSS
Shaping Up With CSS
sdireland
ย 
Introduction to HTML5
Introduction to HTML5Introduction to HTML5
Introduction to HTML5
Terry Ryan
ย 
Haml, Sass and Compass for Sane Web Development
Haml, Sass and Compass for Sane Web DevelopmentHaml, Sass and Compass for Sane Web Development
Haml, Sass and Compass for Sane Web Development
jeremyw
ย 
Web 2.0 - what is it?
Web 2.0  - what is it?Web 2.0  - what is it?
Web 2.0 - what is it?
Andy Forbes
ย 
Page layout with css
Page layout with cssPage layout with css
Page layout with css
Er. Nawaraj Bhandari
ย 
Css
CssCss
Css
actacademy
ย 
BEM Methodology โ€” @Frontenders Ticino โ€”17/09/2014
BEM Methodology โ€” @Frontenders Ticino โ€”17/09/2014BEM Methodology โ€” @Frontenders Ticino โ€”17/09/2014
BEM Methodology โ€” @Frontenders Ticino โ€”17/09/2014
vzaccaria
ย 
Html n css tutorial
Html n css tutorialHtml n css tutorial
Html n css tutorial
zubeditufail
ย 
Modular HTML, CSS, & JS Workshop
Modular HTML, CSS, & JS WorkshopModular HTML, CSS, & JS Workshop
Modular HTML, CSS, & JS Workshop
Shay Howe
ย 
HTML & CSS Workshop Notes
HTML & CSS Workshop NotesHTML & CSS Workshop Notes
HTML & CSS Workshop Notes
Pamela Fox
ย 
The Cascade, Grids, Headings, and Selectors from an OOCSS Perspective, Ajax ...
The Cascade, Grids, Headings, and Selectors from an OOCSS Perspective,  Ajax ...The Cascade, Grids, Headings, and Selectors from an OOCSS Perspective,  Ajax ...
The Cascade, Grids, Headings, and Selectors from an OOCSS Perspective, Ajax ...
Nicole Sullivan
ย 
Progressive Prototyping w/HTML5, CSS3 and jQuery
Progressive Prototyping w/HTML5, CSS3 and jQueryProgressive Prototyping w/HTML5, CSS3 and jQuery
Progressive Prototyping w/HTML5, CSS3 and jQuery
Todd Zaki Warfel
ย 
Using Core Themes in Drupal 8
Using Core Themes in Drupal 8Using Core Themes in Drupal 8
Using Core Themes in Drupal 8
Suzanne Dergacheva
ย 
Learn SUIT: CSS Naming Convention
Learn SUIT: CSS Naming ConventionLearn SUIT: CSS Naming Convention
Learn SUIT: CSS Naming Convention
In a Rocket
ย 
About Best friends - HTML, CSS and JS
About Best friends - HTML, CSS and JSAbout Best friends - HTML, CSS and JS
About Best friends - HTML, CSS and JS
Naga Harish M
ย 
Web Design 101
Web Design 101Web Design 101
Web Design 101
vegdwk
ย 
Supercharged HTML & CSS
Supercharged HTML & CSSSupercharged HTML & CSS
Supercharged HTML & CSS
Max Kraszewski
ย 
Pamela - Brining back the pleasure of hand-written HTML - Montrรฉal Python 8
Pamela - Brining back the pleasure of hand-written HTML - Montrรฉal Python 8Pamela - Brining back the pleasure of hand-written HTML - Montrรฉal Python 8
Pamela - Brining back the pleasure of hand-written HTML - Montrรฉal Python 8
spierre
ย 
Prototyping w/HTML5 and CSS3
Prototyping w/HTML5 and CSS3Prototyping w/HTML5 and CSS3
Prototyping w/HTML5 and CSS3
Todd Zaki Warfel
ย 
Shaping Up With CSS
Shaping Up With CSSShaping Up With CSS
Shaping Up With CSS
sdireland
ย 
Introduction to HTML5
Introduction to HTML5Introduction to HTML5
Introduction to HTML5
Terry Ryan
ย 
Haml, Sass and Compass for Sane Web Development
Haml, Sass and Compass for Sane Web DevelopmentHaml, Sass and Compass for Sane Web Development
Haml, Sass and Compass for Sane Web Development
jeremyw
ย 
Web 2.0 - what is it?
Web 2.0  - what is it?Web 2.0  - what is it?
Web 2.0 - what is it?
Andy Forbes
ย 

Viewers also liked (20)

Acc 626 slidecast - Forensics for IT
Acc 626 slidecast - Forensics for ITAcc 626 slidecast - Forensics for IT
Acc 626 slidecast - Forensics for IT
j9lai
ย 
Basketball game
Basketball gameBasketball game
Basketball game
Peapod Ledesma
ย 
270611%20bezoek%20roosendaal[1]
270611%20bezoek%20roosendaal[1]270611%20bezoek%20roosendaal[1]
270611%20bezoek%20roosendaal[1]
Mieke Sanden, van der
ย 
Cooll usersguide 5
Cooll usersguide 5Cooll usersguide 5
Cooll usersguide 5
Yasuhito Kishi
ย 
Silver
SilverSilver
Silver
rickie57
ย 
Bab i pendahuluan
Bab i pendahuluanBab i pendahuluan
Bab i pendahuluan
Febri Phaniank
ย 
Expo ingles
Expo inglesExpo ingles
Expo ingles
loboazul2009
ย 
Los videojuegos
Los videojuegosLos videojuegos
Los videojuegos
Edgar Flores
ย 
SAP FICO COMPLETE PACKAGE
SAP FICO COMPLETE PACKAGESAP FICO COMPLETE PACKAGE
SAP FICO COMPLETE PACKAGE
Mani Ganesan
ย 
CONCESSร•ES E PPPs NO GOVERNO TEMER:ARTIGO MAURICIO PORTUGAL RIBEIRO
CONCESSร•ES  E PPPs  NO GOVERNO TEMER:ARTIGO  MAURICIO  PORTUGAL RIBEIROCONCESSร•ES  E PPPs  NO GOVERNO TEMER:ARTIGO  MAURICIO  PORTUGAL RIBEIRO
CONCESSร•ES E PPPs NO GOVERNO TEMER:ARTIGO MAURICIO PORTUGAL RIBEIRO
PLANORS
ย 
"Fashions fade, style is eternal"
"Fashions fade, style is eternal""Fashions fade, style is eternal"
"Fashions fade, style is eternal"
Israel Caballero Yebenes
ย 
Cooll usersguide 1
Cooll usersguide 1Cooll usersguide 1
Cooll usersguide 1
Yasuhito Kishi
ย 
Corespring
CorespringCorespring
Corespring
mrinalbagaria
ย 
6 Development Tools we Love for Mac
6 Development Tools we Love for Mac6 Development Tools we Love for Mac
6 Development Tools we Love for Mac
CopperEgg
ย 
Blue corridor
Blue corridorBlue corridor
Blue corridor
qqwweerrttyyqqwweerrttyy
ย 
Overview of CTG3 and our tools
Overview of CTG3 and our toolsOverview of CTG3 and our tools
Overview of CTG3 and our tools
dlaskowski
ย 
Shifts in the music industry
Shifts in the music industryShifts in the music industry
Shifts in the music industry
sadieolen
ย 
Ukita june 2011pptx
Ukita june 2011pptxUkita june 2011pptx
Ukita june 2011pptx
ECDStaffsUni
ย 

Similar to CSS Layout Tutorial (20)

Web Designing Bugs - Fixes By Nyros Developer
Web Designing Bugs - Fixes By Nyros DeveloperWeb Designing Bugs - Fixes By Nyros Developer
Web Designing Bugs - Fixes By Nyros Developer
Nyros Technologies
ย 
Slice and Dice
Slice and DiceSlice and Dice
Slice and Dice
Doncho Minkov
ย 
Creating Web Sites with HTML and CSS
Creating Web Sites with HTML and CSSCreating Web Sites with HTML and CSS
Creating Web Sites with HTML and CSS
BG Java EE Course
ย 
Tutorial1 - Part 2
Tutorial1 - Part 2Tutorial1 - Part 2
Tutorial1 - Part 2
hstryk
ย 
Introduction to HTML
Introduction to HTMLIntroduction to HTML
Introduction to HTML
Amit Tyagi
ย 
HTML5 & CSS3 Flag
HTML5 & CSS3 FlagHTML5 & CSS3 Flag
HTML5 & CSS3 Flag
Christopher Schmitt
ย 
Tfbyoweb.4.9.17
Tfbyoweb.4.9.17Tfbyoweb.4.9.17
Tfbyoweb.4.9.17
Jordan Zurowski
ย 
Tfbyoweb.4.9.17
Tfbyoweb.4.9.17Tfbyoweb.4.9.17
Tfbyoweb.4.9.17
Jordan Zurowski
ย 
How to create a basic template
How to create a basic templateHow to create a basic template
How to create a basic template
vathur
ย 
Basic CSS concepts by naveen kumar veligeti
Basic CSS concepts by naveen kumar veligetiBasic CSS concepts by naveen kumar veligeti
Basic CSS concepts by naveen kumar veligeti
Naveen Kumar Veligeti
ย 
How to Create simple One Page site
How to Create simple One Page siteHow to Create simple One Page site
How to Create simple One Page site
Moneer kamal
ย 
HTML5- Create divisions in a web page
HTML5- Create divisions in a web pageHTML5- Create divisions in a web page
HTML5- Create divisions in a web page
Grayzon Gonzales, LPT
ย 
Sacramento web design
Sacramento web designSacramento web design
Sacramento web design
lambertvilleg_5
ย 
Css tips & tricks
Css tips & tricksCss tips & tricks
Css tips & tricks
anubavam-techkt
ย 
Source Ordered Templates - - Joomla!Days NL 2009 #jd09nl
Source Ordered Templates - - Joomla!Days NL 2009 #jd09nlSource Ordered Templates - - Joomla!Days NL 2009 #jd09nl
Source Ordered Templates - - Joomla!Days NL 2009 #jd09nl
Joomla!Days Netherlands
ย 
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Erin M. Kidwell
ย 
CSS Basics
CSS BasicsCSS Basics
CSS Basics
WordPress Memphis
ย 
Let's build a website with Dreamweaver I
Let's build a website with Dreamweaver ILet's build a website with Dreamweaver I
Let's build a website with Dreamweaver I
Narayan Kumar
ย 
HTML/CSS Web Blog Example
HTML/CSS Web Blog ExampleHTML/CSS Web Blog Example
HTML/CSS Web Blog Example
Michael Bodie
ย 
Blog HTML example for IML 295
Blog HTML example for IML 295Blog HTML example for IML 295
Blog HTML example for IML 295
Evan Hughes
ย 
Web Designing Bugs - Fixes By Nyros Developer
Web Designing Bugs - Fixes By Nyros DeveloperWeb Designing Bugs - Fixes By Nyros Developer
Web Designing Bugs - Fixes By Nyros Developer
Nyros Technologies
ย 
Slice and Dice
Slice and DiceSlice and Dice
Slice and Dice
Doncho Minkov
ย 
Creating Web Sites with HTML and CSS
Creating Web Sites with HTML and CSSCreating Web Sites with HTML and CSS
Creating Web Sites with HTML and CSS
BG Java EE Course
ย 
Tutorial1 - Part 2
Tutorial1 - Part 2Tutorial1 - Part 2
Tutorial1 - Part 2
hstryk
ย 
Introduction to HTML
Introduction to HTMLIntroduction to HTML
Introduction to HTML
Amit Tyagi
ย 
Tfbyoweb.4.9.17
Tfbyoweb.4.9.17Tfbyoweb.4.9.17
Tfbyoweb.4.9.17
Jordan Zurowski
ย 
Tfbyoweb.4.9.17
Tfbyoweb.4.9.17Tfbyoweb.4.9.17
Tfbyoweb.4.9.17
Jordan Zurowski
ย 
How to create a basic template
How to create a basic templateHow to create a basic template
How to create a basic template
vathur
ย 
Basic CSS concepts by naveen kumar veligeti
Basic CSS concepts by naveen kumar veligetiBasic CSS concepts by naveen kumar veligeti
Basic CSS concepts by naveen kumar veligeti
Naveen Kumar Veligeti
ย 
How to Create simple One Page site
How to Create simple One Page siteHow to Create simple One Page site
How to Create simple One Page site
Moneer kamal
ย 
HTML5- Create divisions in a web page
HTML5- Create divisions in a web pageHTML5- Create divisions in a web page
HTML5- Create divisions in a web page
Grayzon Gonzales, LPT
ย 
Sacramento web design
Sacramento web designSacramento web design
Sacramento web design
lambertvilleg_5
ย 
Css tips & tricks
Css tips & tricksCss tips & tricks
Css tips & tricks
anubavam-techkt
ย 
Source Ordered Templates - - Joomla!Days NL 2009 #jd09nl
Source Ordered Templates - - Joomla!Days NL 2009 #jd09nlSource Ordered Templates - - Joomla!Days NL 2009 #jd09nl
Source Ordered Templates - - Joomla!Days NL 2009 #jd09nl
Joomla!Days Netherlands
ย 
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Erin M. Kidwell
ย 
Let's build a website with Dreamweaver I
Let's build a website with Dreamweaver ILet's build a website with Dreamweaver I
Let's build a website with Dreamweaver I
Narayan Kumar
ย 
HTML/CSS Web Blog Example
HTML/CSS Web Blog ExampleHTML/CSS Web Blog Example
HTML/CSS Web Blog Example
Michael Bodie
ย 
Blog HTML example for IML 295
Blog HTML example for IML 295Blog HTML example for IML 295
Blog HTML example for IML 295
Evan Hughes
ย 

More from hstryk (15)

CSS - Text Properties
CSS - Text PropertiesCSS - Text Properties
CSS - Text Properties
hstryk
ย 
Lesson 3 - HTML & CSS Part 2
Lesson 3 - HTML & CSS Part 2Lesson 3 - HTML & CSS Part 2
Lesson 3 - HTML & CSS Part 2
hstryk
ย 
Lesson1 - Fall 2013
Lesson1 - Fall 2013Lesson1 - Fall 2013
Lesson1 - Fall 2013
hstryk
ย 
Lesson2
Lesson2Lesson2
Lesson2
hstryk
ย 
CSS3 Transitions
CSS3 TransitionsCSS3 Transitions
CSS3 Transitions
hstryk
ย 
Introduction to CSS3
Introduction to CSS3Introduction to CSS3
Introduction to CSS3
hstryk
ย 
Sprites rollovers
Sprites rolloversSprites rollovers
Sprites rollovers
hstryk
ย 
Building a Website from Planning to Photoshop Mockup to HTML/CSS
Building a Website from Planning to Photoshop Mockup to HTML/CSSBuilding a Website from Planning to Photoshop Mockup to HTML/CSS
Building a Website from Planning to Photoshop Mockup to HTML/CSS
hstryk
ย 
Lecture4
Lecture4Lecture4
Lecture4
hstryk
ย 
Tutorial1
Tutorial1Tutorial1
Tutorial1
hstryk
ย 
Project1
Project1Project1
Project1
hstryk
ย 
Lesson 3
Lesson 3Lesson 3
Lesson 3
hstryk
ย 
Lesson2
Lesson2Lesson2
Lesson2
hstryk
ย 
Lesson1
Lesson1Lesson1
Lesson1
hstryk
ย 
Heather Strycharz - Resume
Heather Strycharz - ResumeHeather Strycharz - Resume
Heather Strycharz - Resume
hstryk
ย 
CSS - Text Properties
CSS - Text PropertiesCSS - Text Properties
CSS - Text Properties
hstryk
ย 
Lesson 3 - HTML & CSS Part 2
Lesson 3 - HTML & CSS Part 2Lesson 3 - HTML & CSS Part 2
Lesson 3 - HTML & CSS Part 2
hstryk
ย 
Lesson1 - Fall 2013
Lesson1 - Fall 2013Lesson1 - Fall 2013
Lesson1 - Fall 2013
hstryk
ย 
Lesson2
Lesson2Lesson2
Lesson2
hstryk
ย 
CSS3 Transitions
CSS3 TransitionsCSS3 Transitions
CSS3 Transitions
hstryk
ย 
Introduction to CSS3
Introduction to CSS3Introduction to CSS3
Introduction to CSS3
hstryk
ย 
Sprites rollovers
Sprites rolloversSprites rollovers
Sprites rollovers
hstryk
ย 
Building a Website from Planning to Photoshop Mockup to HTML/CSS
Building a Website from Planning to Photoshop Mockup to HTML/CSSBuilding a Website from Planning to Photoshop Mockup to HTML/CSS
Building a Website from Planning to Photoshop Mockup to HTML/CSS
hstryk
ย 
Lecture4
Lecture4Lecture4
Lecture4
hstryk
ย 
Tutorial1
Tutorial1Tutorial1
Tutorial1
hstryk
ย 
Project1
Project1Project1
Project1
hstryk
ย 
Lesson 3
Lesson 3Lesson 3
Lesson 3
hstryk
ย 
Lesson2
Lesson2Lesson2
Lesson2
hstryk
ย 
Lesson1
Lesson1Lesson1
Lesson1
hstryk
ย 
Heather Strycharz - Resume
Heather Strycharz - ResumeHeather Strycharz - Resume
Heather Strycharz - Resume
hstryk
ย 

Recently uploaded (20)

Are you Transitioning or Refining Now..?
Are you Transitioning or Refining Now..?Are you Transitioning or Refining Now..?
Are you Transitioning or Refining Now..?
Gregory Vigneaux
ย 
๐——๐—ฒ๐˜€๐—ถ๐—ด๐—ป๐—ถ๐—ป๐—ด ๐—ณ๐—ผ๐—ฟ ๐—ฎ๐—น๐—น: ๐—œ๐—ป๐—ฐ๐—น๐˜‚๐˜€๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ฎ๐—ฐ๐˜๐—ถ๐—ฐ๐—ฒ ๐—ณ๐—ผ๐—ฟ ๐—•๐—ฒ๐˜๐˜๐—ฒ๐—ฟ ๐—˜๐˜…๐—ฝ๐—ฒ๐—ฟ๐—ถ๐—ฒ๐—ป๐—ฐ๐—ฒ๐˜€
๐——๐—ฒ๐˜€๐—ถ๐—ด๐—ป๐—ถ๐—ป๐—ด ๐—ณ๐—ผ๐—ฟ ๐—ฎ๐—น๐—น: ๐—œ๐—ป๐—ฐ๐—น๐˜‚๐˜€๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ฎ๐—ฐ๐˜๐—ถ๐—ฐ๐—ฒ ๐—ณ๐—ผ๐—ฟ ๐—•๐—ฒ๐˜๐˜๐—ฒ๐—ฟ ๐—˜๐˜…๐—ฝ๐—ฒ๐—ฟ๐—ถ๐—ฒ๐—ป๐—ฐ๐—ฒ๐˜€๐——๐—ฒ๐˜€๐—ถ๐—ด๐—ป๐—ถ๐—ป๐—ด ๐—ณ๐—ผ๐—ฟ ๐—ฎ๐—น๐—น: ๐—œ๐—ป๐—ฐ๐—น๐˜‚๐˜€๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ฎ๐—ฐ๐˜๐—ถ๐—ฐ๐—ฒ ๐—ณ๐—ผ๐—ฟ ๐—•๐—ฒ๐˜๐˜๐—ฒ๐—ฟ ๐—˜๐˜…๐—ฝ๐—ฒ๐—ฟ๐—ถ๐—ฒ๐—ป๐—ฐ๐—ฒ๐˜€
๐——๐—ฒ๐˜€๐—ถ๐—ด๐—ป๐—ถ๐—ป๐—ด ๐—ณ๐—ผ๐—ฟ ๐—ฎ๐—น๐—น: ๐—œ๐—ป๐—ฐ๐—น๐˜‚๐˜€๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ฎ๐—ฐ๐˜๐—ถ๐—ฐ๐—ฒ ๐—ณ๐—ผ๐—ฟ ๐—•๐—ฒ๐˜๐˜๐—ฒ๐—ฟ ๐—˜๐˜…๐—ฝ๐—ฒ๐—ฟ๐—ถ๐—ฒ๐—ป๐—ฐ๐—ฒ๐˜€
Friends of Figm a, Sydney
ย 
Minimalist Business Slides XL by Slidesgo.pptx
Minimalist Business Slides XL by Slidesgo.pptxMinimalist Business Slides XL by Slidesgo.pptx
Minimalist Business Slides XL by Slidesgo.pptx
karenalavamoran
ย 
Lori Vanzant Online Presence. Take a look!
Lori Vanzant Online Presence. Take a look!Lori Vanzant Online Presence. Take a look!
Lori Vanzant Online Presence. Take a look!
vanzan01
ย 
10.1155-2024-1048933Figurefig0008.pptx.ppt
10.1155-2024-1048933Figurefig0008.pptx.ppt10.1155-2024-1048933Figurefig0008.pptx.ppt
10.1155-2024-1048933Figurefig0008.pptx.ppt
suchandasaha7
ย 
Take this ppt refference and give content on mahindra commitment to sustainab...
Take this ppt refference and give content on mahindra commitment to sustainab...Take this ppt refference and give content on mahindra commitment to sustainab...
Take this ppt refference and give content on mahindra commitment to sustainab...
kochars428
ย 
325295919-AAC-Blocks-Seminar-Presentation.pdf
325295919-AAC-Blocks-Seminar-Presentation.pdf325295919-AAC-Blocks-Seminar-Presentation.pdf
325295919-AAC-Blocks-Seminar-Presentation.pdf
shivsin165
ย 
Lori Vanzant's portfolio. Please take a look!
Lori Vanzant's portfolio. Please take a look!Lori Vanzant's portfolio. Please take a look!
Lori Vanzant's portfolio. Please take a look!
vanzan01
ย 
Designing Interactive and Engaging Museum Exhibits
Designing Interactive and Engaging Museum ExhibitsDesigning Interactive and Engaging Museum Exhibits
Designing Interactive and Engaging Museum Exhibits
Peach Prime Consultancy
ย 
Presentation for Schoool Management System
Presentation for Schoool Management SystemPresentation for Schoool Management System
Presentation for Schoool Management System
kolay922013
ย 
presentation on healing architecture .pptx
presentation on healing architecture .pptxpresentation on healing architecture .pptx
presentation on healing architecture .pptx
buildnpl
ย 
Download Chimera Tool Setup V42.47.0924 [Latest Version]
Download Chimera Tool Setup V42.47.0924 [Latest Version]Download Chimera Tool Setup V42.47.0924 [Latest Version]
Download Chimera Tool Setup V42.47.0924 [Latest Version]
Designer
ย 
2nd taxonomy, nomen microorganisms-.pptx
2nd  taxonomy, nomen  microorganisms-.pptx2nd  taxonomy, nomen  microorganisms-.pptx
2nd taxonomy, nomen microorganisms-.pptx
ayeleasefa2
ย 
Templates Wind Generator.pdf ahรญ. Ais d Ai d f
Templates Wind Generator.pdf ahรญ. Ais d Ai d fTemplates Wind Generator.pdf ahรญ. Ais d Ai d f
Templates Wind Generator.pdf ahรญ. Ais d Ai d f
jeremysegundob
ย 
Emily's slide design 101 - training module
Emily's slide design 101 - training moduleEmily's slide design 101 - training module
Emily's slide design 101 - training module
yourmisswright
ย 
mid-term all revisions g11 s1.pmdzs,zxptx
mid-term all revisions g11 s1.pmdzs,zxptxmid-term all revisions g11 s1.pmdzs,zxptx
mid-term all revisions g11 s1.pmdzs,zxptx
omar164646
ย 
EEE178-PPT-Theme iasodhajsdkjashdlaskdjbaksdkashdlkasdlkja;dj;kdada.pptx.pdf
EEE178-PPT-Theme iasodhajsdkjashdlaskdjbaksdkashdlkasdlkja;dj;kdada.pptx.pdfEEE178-PPT-Theme iasodhajsdkjashdlaskdjbaksdkashdlkasdlkja;dj;kdada.pptx.pdf
EEE178-PPT-Theme iasodhajsdkjashdlaskdjbaksdkashdlkasdlkja;dj;kdada.pptx.pdf
CastroAngeloReoD
ย 
The Irrational City | Unseen Forces of Placemaking
The Irrational City | Unseen Forces of PlacemakingThe Irrational City | Unseen Forces of Placemaking
The Irrational City | Unseen Forces of Placemaking
Leanne Munyori
ย 
Design of a Low-Power VLSI Router for Network-on-Chip.pptx
Design of a Low-Power VLSI Router for Network-on-Chip.pptxDesign of a Low-Power VLSI Router for Network-on-Chip.pptx
Design of a Low-Power VLSI Router for Network-on-Chip.pptx
BapujiBanothu
ย 
Lori Vanzant Portfolio. Take a look! ty.
Lori Vanzant Portfolio. Take a look! ty.Lori Vanzant Portfolio. Take a look! ty.
Lori Vanzant Portfolio. Take a look! ty.
vanzan01
ย 
Are you Transitioning or Refining Now..?
Are you Transitioning or Refining Now..?Are you Transitioning or Refining Now..?
Are you Transitioning or Refining Now..?
Gregory Vigneaux
ย 
๐——๐—ฒ๐˜€๐—ถ๐—ด๐—ป๐—ถ๐—ป๐—ด ๐—ณ๐—ผ๐—ฟ ๐—ฎ๐—น๐—น: ๐—œ๐—ป๐—ฐ๐—น๐˜‚๐˜€๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ฎ๐—ฐ๐˜๐—ถ๐—ฐ๐—ฒ ๐—ณ๐—ผ๐—ฟ ๐—•๐—ฒ๐˜๐˜๐—ฒ๐—ฟ ๐—˜๐˜…๐—ฝ๐—ฒ๐—ฟ๐—ถ๐—ฒ๐—ป๐—ฐ๐—ฒ๐˜€
๐——๐—ฒ๐˜€๐—ถ๐—ด๐—ป๐—ถ๐—ป๐—ด ๐—ณ๐—ผ๐—ฟ ๐—ฎ๐—น๐—น: ๐—œ๐—ป๐—ฐ๐—น๐˜‚๐˜€๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ฎ๐—ฐ๐˜๐—ถ๐—ฐ๐—ฒ ๐—ณ๐—ผ๐—ฟ ๐—•๐—ฒ๐˜๐˜๐—ฒ๐—ฟ ๐—˜๐˜…๐—ฝ๐—ฒ๐—ฟ๐—ถ๐—ฒ๐—ป๐—ฐ๐—ฒ๐˜€๐——๐—ฒ๐˜€๐—ถ๐—ด๐—ป๐—ถ๐—ป๐—ด ๐—ณ๐—ผ๐—ฟ ๐—ฎ๐—น๐—น: ๐—œ๐—ป๐—ฐ๐—น๐˜‚๐˜€๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ฎ๐—ฐ๐˜๐—ถ๐—ฐ๐—ฒ ๐—ณ๐—ผ๐—ฟ ๐—•๐—ฒ๐˜๐˜๐—ฒ๐—ฟ ๐—˜๐˜…๐—ฝ๐—ฒ๐—ฟ๐—ถ๐—ฒ๐—ป๐—ฐ๐—ฒ๐˜€
๐——๐—ฒ๐˜€๐—ถ๐—ด๐—ป๐—ถ๐—ป๐—ด ๐—ณ๐—ผ๐—ฟ ๐—ฎ๐—น๐—น: ๐—œ๐—ป๐—ฐ๐—น๐˜‚๐˜€๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ฎ๐—ฐ๐˜๐—ถ๐—ฐ๐—ฒ ๐—ณ๐—ผ๐—ฟ ๐—•๐—ฒ๐˜๐˜๐—ฒ๐—ฟ ๐—˜๐˜…๐—ฝ๐—ฒ๐—ฟ๐—ถ๐—ฒ๐—ป๐—ฐ๐—ฒ๐˜€
Friends of Figm a, Sydney
ย 
Minimalist Business Slides XL by Slidesgo.pptx
Minimalist Business Slides XL by Slidesgo.pptxMinimalist Business Slides XL by Slidesgo.pptx
Minimalist Business Slides XL by Slidesgo.pptx
karenalavamoran
ย 
Lori Vanzant Online Presence. Take a look!
Lori Vanzant Online Presence. Take a look!Lori Vanzant Online Presence. Take a look!
Lori Vanzant Online Presence. Take a look!
vanzan01
ย 
10.1155-2024-1048933Figurefig0008.pptx.ppt
10.1155-2024-1048933Figurefig0008.pptx.ppt10.1155-2024-1048933Figurefig0008.pptx.ppt
10.1155-2024-1048933Figurefig0008.pptx.ppt
suchandasaha7
ย 
Take this ppt refference and give content on mahindra commitment to sustainab...
Take this ppt refference and give content on mahindra commitment to sustainab...Take this ppt refference and give content on mahindra commitment to sustainab...
Take this ppt refference and give content on mahindra commitment to sustainab...
kochars428
ย 
325295919-AAC-Blocks-Seminar-Presentation.pdf
325295919-AAC-Blocks-Seminar-Presentation.pdf325295919-AAC-Blocks-Seminar-Presentation.pdf
325295919-AAC-Blocks-Seminar-Presentation.pdf
shivsin165
ย 
Lori Vanzant's portfolio. Please take a look!
Lori Vanzant's portfolio. Please take a look!Lori Vanzant's portfolio. Please take a look!
Lori Vanzant's portfolio. Please take a look!
vanzan01
ย 
Designing Interactive and Engaging Museum Exhibits
Designing Interactive and Engaging Museum ExhibitsDesigning Interactive and Engaging Museum Exhibits
Designing Interactive and Engaging Museum Exhibits
Peach Prime Consultancy
ย 
Presentation for Schoool Management System
Presentation for Schoool Management SystemPresentation for Schoool Management System
Presentation for Schoool Management System
kolay922013
ย 
presentation on healing architecture .pptx
presentation on healing architecture .pptxpresentation on healing architecture .pptx
presentation on healing architecture .pptx
buildnpl
ย 
Download Chimera Tool Setup V42.47.0924 [Latest Version]
Download Chimera Tool Setup V42.47.0924 [Latest Version]Download Chimera Tool Setup V42.47.0924 [Latest Version]
Download Chimera Tool Setup V42.47.0924 [Latest Version]
Designer
ย 
2nd taxonomy, nomen microorganisms-.pptx
2nd  taxonomy, nomen  microorganisms-.pptx2nd  taxonomy, nomen  microorganisms-.pptx
2nd taxonomy, nomen microorganisms-.pptx
ayeleasefa2
ย 
Templates Wind Generator.pdf ahรญ. Ais d Ai d f
Templates Wind Generator.pdf ahรญ. Ais d Ai d fTemplates Wind Generator.pdf ahรญ. Ais d Ai d f
Templates Wind Generator.pdf ahรญ. Ais d Ai d f
jeremysegundob
ย 
Emily's slide design 101 - training module
Emily's slide design 101 - training moduleEmily's slide design 101 - training module
Emily's slide design 101 - training module
yourmisswright
ย 
mid-term all revisions g11 s1.pmdzs,zxptx
mid-term all revisions g11 s1.pmdzs,zxptxmid-term all revisions g11 s1.pmdzs,zxptx
mid-term all revisions g11 s1.pmdzs,zxptx
omar164646
ย 
EEE178-PPT-Theme iasodhajsdkjashdlaskdjbaksdkashdlkasdlkja;dj;kdada.pptx.pdf
EEE178-PPT-Theme iasodhajsdkjashdlaskdjbaksdkashdlkasdlkja;dj;kdada.pptx.pdfEEE178-PPT-Theme iasodhajsdkjashdlaskdjbaksdkashdlkasdlkja;dj;kdada.pptx.pdf
EEE178-PPT-Theme iasodhajsdkjashdlaskdjbaksdkashdlkasdlkja;dj;kdada.pptx.pdf
CastroAngeloReoD
ย 
The Irrational City | Unseen Forces of Placemaking
The Irrational City | Unseen Forces of PlacemakingThe Irrational City | Unseen Forces of Placemaking
The Irrational City | Unseen Forces of Placemaking
Leanne Munyori
ย 
Design of a Low-Power VLSI Router for Network-on-Chip.pptx
Design of a Low-Power VLSI Router for Network-on-Chip.pptxDesign of a Low-Power VLSI Router for Network-on-Chip.pptx
Design of a Low-Power VLSI Router for Network-on-Chip.pptx
BapujiBanothu
ย 
Lori Vanzant Portfolio. Take a look! ty.
Lori Vanzant Portfolio. Take a look! ty.Lori Vanzant Portfolio. Take a look! ty.
Lori Vanzant Portfolio. Take a look! ty.
vanzan01
ย 

CSS Layout Tutorial

  • 2. Starting with a new HTML document, letโ€™s just start with our divs. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd" > <html lang="en"> <head> <title>Let's Learn Layouts!</title> </head> <body> <div id="container"> <div id="headerโ€><div id=โ€œlogoโ€></div></div> <div id=โ€contentโ€></div> <div id=โ€right_columnโ€></div> <div class="featureโ€></div> <div class="featureโ€></div> <div class="featureโ€></div> <div id="footer">THIS IS THE FOOTER</div> </div> <!--end of container div--> </body> </html>
  • 3. Add content (text, images) to the divs. <body> <div id="container"> HTML <div id="header"><div id="logo"><img src="http://openclipart.org/image/90px/svg_to_png/170921/tikigiki_abstract-element-029.png"></div>THIS IS THE HEADER</div> <div id="content"><h1>Headline</h1> <p>Halvah powder oat cake. <a href="#">Pie oat cake</a> candy halvah cookie topping. Tootsie roll toffee faworki cookie ice cream. Jujubes jelly-o caramels. Dragรฉe bear claw biscuit bear claw. Bear claw brownie chupa chups ice cream gummi bears sweet. Toffee jujubes topping. Oat cake cake lemon drops jelly beans marshmallow marzipan cheesecake lollipop tart.</p> <p>Halvah powder oat cake. Pie oat cake candy halvah cookie topping. <a href="#">Tootsie roll toffee</a> faworki cookie ice cream. Jujubes jelly-o caramels. Dragรฉe bear claw biscuit bear claw. Bear claw brownie chupa chups ice cream gummi bears sweet. Toffee jujubes topping. Oat cake cake lemon drops jelly beans marshmallow marzipan cheesecake lollipop tart.</p></div> <div id=โ€right_columnโ€></div> <div class="featureโ€></div> <div class="featureโ€></div> <div class="featureโ€></div> <div id="footer">THIS IS THE FOOTER</div> </div> <!--end of container div--> </body> </html>
  • 4. All the HTML with no styling
  • 5. This is what it looks like if we preview the HTML document. The borders shows how the divs react without any styling. Notice that by default they are displaying 100% the width of the page. That is because by default, divs are block-level elements.
  • 6. Create a stylesheet (CSS) file and link the file to your HTML page. Letโ€™s begin by adding style to the body and to the #container div. body{ font-family: Futura; } #container{ width:800px; margin: 0 auto; background-color: #FAFCE8; } Notice that you do NOT need a # on the body tag. The body is not a div, it is a root element.
  • 7. Also notice that margin: 0 auto; centers the #container div to the viewport & removes any space between the very top of the page and the container.
  • 8. Next, letโ€™s style the #header div. #header{ Because the image is in a div, it is taking up the entire height: 80px; border:1px solid blue; width of the parent div, #container and pushing the text-align: center; โ€œTHIS IS THE HEADERโ€ text down. padding: 10px; margin-bottom: 5px; }
  • 9. This can easily be fixed by adding โ€œfloat:left;โ€ to the #logo div. #logo{ float:left; } In the normal flow, each block element (div, p, h1, etc.) stacks on top of each other vertically, from the top of the viewport down. Floated elements are first laid out according to the normal flow, then taken out of the normal flow and sent as far to the right or left (depending on which value is applied) of the parent element. In other words, they go from stacking on top of each other to sitting next to each other, given that there is enough room in the parent element for each floated element to sit. This behavior is crucial to remember as you build your websites. http://www.alistapart.com/articles/css-floats-101/
  • 10. Now letโ€™s style the #content div. #content{ float: left; width: 595px; border:1px solid red; }
  • 11. When we highlight the #right_column div we see that because it is not styled, the div still has its 100% width. The content within the div is being pushed by the content in the #content div.
  • 12. Add styling to the #right_column div. #right_column{ width: 190px; border: 1px solid green; float: right; } Notice the width of #right_column is small enough to fit in the 800px width we created for the #container div.
  • 13. This is what happens if the width of #right_column is too big to fit both the #content div and #right_column. It getโ€™s pushed out and by default, the other divs below #right_column move up. This is why it is important to give your divs widths. Heights are not always necessary โ€“ it depends on whether you want a specific height to the div OR if you want the content within your div to determine the size of the div.
  • 14. Now we add our .feature styles. .feature{ float: left; width: 150px; height: 100px; border: 1px solid grey; margin-right: 10px; margin-top: 10px; margin-bottom: 10px; padding: 5px; } Because the .feature has a float, the #footer div has moved up. It helps to think that by default, HTML elements are like magnets that will stick to the left of the page.
  • 15. We can solve this problem once we style the #footer div. #footer{ clear: both; height: 50px; border: 1px solid purple; text-align: center; } The clear property specifies which sides of an element where other floating elements are not allowed.
  • 16. Letโ€™s add a little love to the text in the .feature divs so that it doesnโ€™t look broken. .feature h3 { margin-bottom: 2px; margin-top: 0; } .feature span{ font-size: 11px; } By default heading tags have a margin top and a margin bottom. By specifying the margin in the h3 tag we overrode the default.
  • 17. Now we are left with styling the little details. I want that image to be in the center of the #right_column div. So letโ€™s add a div around the image tag in our HTML page, with a little inline styling. <div style=โ€display:block; margin-left: auto; margin-right: auto; width: 175px;"><img src=โ€œimages/johnny_automatic_open_book.svg" height="90"></div> Sometimes it is not the text that needs to be centered, but the block as a whole. Or, phrased differently: we want the left and right margin to be equal. The way to do that is to set the margins to 'auto'. This is normally used with a block of fixed width, because if the block itself is flexible, it will simply take up all the available width. http://www.w3.org/Style/Examples/007/c enter.en.html
  • 18. Now letโ€™s style the liโ€™s within the #right_column div so they arenโ€™t so bigโ€ฆ #right_column li{ font-size: 12px; } โ€œGREAT!โ€ The smaller font allows for the first feature enough room to move up! We can solve this one of two ways. 1. We can give the #right_column a specific height so that it pushes the .feature div down. ORโ€ฆ
  • 19. 2. We can nest our .feature divs in a div with an inline style of โ€œclear:both;โ€ <div style="clear: both;"> <div class="feature"><h3>feature1</h3><span>Tootsie roll toffee faworki cookie ice cream.</span></div> <div class="feature"><h3>feature2</h3><span>Tootsie roll toffee faworki cookie ice cream.</span></div> <div class="feature"><h3>feature3</h3><span>Tootsie roll toffee faworki cookie ice cream.</span></div> </div> Here we have all the divs highlighted. You can see the features โ€œlivingโ€ in their new div โ€“ on separate row.
  • 20. One last detail left! Adding colors to our links in the #content div. #content a:link, #content a:visited{ color: #333; } #content a:focus, #content a:hover, #content a:active{ color: green; } The first link is highlighted to show the โ€œhoverโ€ state.