SlideShare une entreprise Scribd logo
1  sur  31
CSS Layout

Svetlin Nakov
Manager Technical Training
http://nakov.com
Telerik Web Design Course
html5course.telerik.com
Table of Contents
   Positioning
     Positioning inline elements
   Floating
     Left and right
     Clearing
 Opacity
 Visibility

 Display




                                                    2
Positioning



              3
Positioning
 position: defines the positioning of the
    element in the page content flow
   The value is one of:
     static (default)
     relative – relative position according to where
      the element would appear with static position
     absolute – position according to the innermost
      positioned parent element
     fixed – same as absolute, but ignores page
      scrolling
                                                        4
Positioning (2)
 Margin VS relative positioning

 Fixed and absolutely positioned elements do
 not influence the page normal flow and usually
 stay on top of other elements
   Their position and size is ignored when
    calculating the size of parent element or
    position of surrounding elements
   Overlaid according to their z-index
   Inline fixed or absolutely positioned elements
    can apply height like block-level elements
                                                     5
Positioning (3)
 top, left, bottom, right: specifies offset of
 absolute/fixed/relative positioned element as
 numerical values
 z-index : specifies the stack level of
 positioned elements
   Understanding stacking context
  Each positioned element creates a stacking
  context.
  Elements in different stacking contexts are
  overlapped according to the stacking order of
  their containers. For example, there is no way
  for #A1 and #A2 (children of #A) to be placed
  over #B without increasing the z-index of #A.
                                                                     6
Positioning
      Live Demo
positioning-rules.html
Inline element positioning
 vertical-align: sets the vertical-alignment
    of an inline element, according to the line
    height
     Values: baseline, sub, super, top, text-top,
      middle, bottom, text-bottom or numeric
   Also used for content of table cells (which apply
    middle alignment by default)




                                                        8
Alignment and Z-Index
           Live Demo
alignments-and-z-index-rules.html
Floating
Float
 float: the element “floats” to one side

   left: places the element on the left and
    following content on the right
   right: places the element on the right and
    following content on the left
   floated elements should come before the
    content that will wrap around them in the code
   margins of floated elements do not collapse
   floated inline elements can apply height

                                                       11
Float (2)
 How floated elements are positioned




                                                12
Clear
 clear

     Sets the sides of the element where other
      floating elements are NOT allowed
     Used to "drop" elements below floated ones or
      expand a container, which contains only floated
      children
     Possible values: left, right, both
   Clearing floats
     additional element (<div>) with a clear style

                                                        13
Clear (2)
   Clearing floats (continued)
     :after { content: ""; display: block;
      clear: both; height: 0; }
     Triggering hasLayout in IE expands a container
      of floated elements
       display: inline-block;
       zoom: 1;




                                                       14
Floating Elements
     Live Demo
   float-rules.html
Opacity
Opacity
 opacity: specifies the opacity of the element

   Floating point number from 0 to 1
   For old Mozilla browsers use –moz-opacity
   For IE use filter:alpha(opacity=value)
    where value is from 0 to 100; also, "binary and
    script behaviors" must be enabled and
    hasLayout must be triggered, e.g. with zoom:1




                                                      17
Opacity
   Live Demo
opacity-rule.html
Visibility
Visibility
 visibility

  Determines whether the element is visible
  hidden: element is not rendered, but still
   occupies place on the page (similar to
   opacity:0)
  visible: element is rendered normally




                                                    20
Visibility
    Live Demo
visibility-rule.html
Display
Display
 display: controls the displayof the element
 and the way it is rendered and if breaks should
 be placed before and after the element
   inline: no breaks are placed before and after
    (<span> is an inline element)
   block: breaks are placed before AND after the
    element (<div> is a block element)




                                                    23
Display (2)
 display: controls the displayof the element
 and the way it is rendered and if breaks should
 be placed before and after the element
   none: element is hidden and its dimensions are
    not used to calculate the surrounding elements
    rendering (differs from visibility: hidden!)
   There are some more possible values, but not
    all browsers support them
    Specific displays like table-cell and table-row

                                                       24
Display
   Live Demo
display-rule.html
CSS – Part II




Questions?

       http://frontendcourse.telerik.com
Homework
1.   Create the following Web page using HTML and
     external CSS. Using tables, inline styles and
     deprecated tags is not allowed.




                                                     27
Homework (2)
2.   Create the following
     Web page using
     external CSS styles.
     Buttons should consist
     of PNG images with
     text over them.




                                             28
Homework (3)
3.   Create the following Web page using HTML with
     external CSS file. Note that the images should be
     PNG with transparent background.




                                                         29
Homework (4)
4.       Given the picture below create the Web site
          Use CSS and HTML 5




                                                       30
Homework (5)
5.    Create the following HTML 5 Page
      Do it without tables




                                                   31

Contenu connexe

Similaire à Css layout

Fundamentals of Browser Rendering Css Overview PT 2
Fundamentals of Browser Rendering Css Overview PT 2Fundamentals of Browser Rendering Css Overview PT 2
Fundamentals of Browser Rendering Css Overview PT 2Barak Drechsler
 
Web Design & Development - Session 3
Web Design & Development - Session 3Web Design & Development - Session 3
Web Design & Development - Session 3Shahrzad Peyman
 
Lecture 10 CSS part 2.pptxvvvvvvvvvvvvvv
Lecture 10 CSS part 2.pptxvvvvvvvvvvvvvvLecture 10 CSS part 2.pptxvvvvvvvvvvvvvv
Lecture 10 CSS part 2.pptxvvvvvvvvvvvvvvZahouAmel1
 
CSS_Day_Three (W3schools)
CSS_Day_Three (W3schools)CSS_Day_Three (W3schools)
CSS_Day_Three (W3schools)Rafi Haidari
 
Advanced CSS.pptx
Advanced CSS.pptxAdvanced CSS.pptx
Advanced CSS.pptxDiyonaVas
 
Designing for the web - 101
Designing for the web - 101Designing for the web - 101
Designing for the web - 101Ashraf Hamdy
 
WDES106 CSS Advanced Part 1
WDES106 CSS Advanced Part 1WDES106 CSS Advanced Part 1
WDES106 CSS Advanced Part 1Gene Babon
 
Fundamentals of Browser Rendering Css Overview PT 1
Fundamentals of Browser Rendering Css Overview PT 1Fundamentals of Browser Rendering Css Overview PT 1
Fundamentals of Browser Rendering Css Overview PT 1Barak Drechsler
 
Introduction to HTML
Introduction to HTMLIntroduction to HTML
Introduction to HTMLAmit Tyagi
 
Introduction to CSS: Part Deux
Introduction to CSS: Part DeuxIntroduction to CSS: Part Deux
Introduction to CSS: Part DeuxLarry King
 
Web Programming Basic topic.pptx
Web Programming Basic topic.pptxWeb Programming Basic topic.pptx
Web Programming Basic topic.pptxShouravPodder3
 
Leveling Up With Flexbox (Smart Web Conference)
Leveling Up With Flexbox (Smart Web Conference)Leveling Up With Flexbox (Smart Web Conference)
Leveling Up With Flexbox (Smart Web Conference)Zoe Gillenwater
 
How Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) WorksHow Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) WorksAmit Tyagi
 

Similaire à Css layout (20)

Fundamentals of Browser Rendering Css Overview PT 2
Fundamentals of Browser Rendering Css Overview PT 2Fundamentals of Browser Rendering Css Overview PT 2
Fundamentals of Browser Rendering Css Overview PT 2
 
Web Design & Development - Session 3
Web Design & Development - Session 3Web Design & Development - Session 3
Web Design & Development - Session 3
 
Lecture 10 CSS part 2.pptxvvvvvvvvvvvvvv
Lecture 10 CSS part 2.pptxvvvvvvvvvvvvvvLecture 10 CSS part 2.pptxvvvvvvvvvvvvvv
Lecture 10 CSS part 2.pptxvvvvvvvvvvvvvv
 
Displaying.pptx
Displaying.pptxDisplaying.pptx
Displaying.pptx
 
CSS_Day_Three (W3schools)
CSS_Day_Three (W3schools)CSS_Day_Three (W3schools)
CSS_Day_Three (W3schools)
 
Advanced CSS.pptx
Advanced CSS.pptxAdvanced CSS.pptx
Advanced CSS.pptx
 
CSS3 Refresher
CSS3 RefresherCSS3 Refresher
CSS3 Refresher
 
Designing for the web - 101
Designing for the web - 101Designing for the web - 101
Designing for the web - 101
 
Floats
FloatsFloats
Floats
 
Exp13 write up
Exp13 write upExp13 write up
Exp13 write up
 
Css advanced – session 4
Css advanced – session 4Css advanced – session 4
Css advanced – session 4
 
HTML5 and CSS3
HTML5 and CSS3HTML5 and CSS3
HTML5 and CSS3
 
WDES106 CSS Advanced Part 1
WDES106 CSS Advanced Part 1WDES106 CSS Advanced Part 1
WDES106 CSS Advanced Part 1
 
Fundamentals of Browser Rendering Css Overview PT 1
Fundamentals of Browser Rendering Css Overview PT 1Fundamentals of Browser Rendering Css Overview PT 1
Fundamentals of Browser Rendering Css Overview PT 1
 
Introduction to HTML
Introduction to HTMLIntroduction to HTML
Introduction to HTML
 
Introduction to CSS: Part Deux
Introduction to CSS: Part DeuxIntroduction to CSS: Part Deux
Introduction to CSS: Part Deux
 
Web Programming Basic topic.pptx
Web Programming Basic topic.pptxWeb Programming Basic topic.pptx
Web Programming Basic topic.pptx
 
Leveling Up With Flexbox (Smart Web Conference)
Leveling Up With Flexbox (Smart Web Conference)Leveling Up With Flexbox (Smart Web Conference)
Leveling Up With Flexbox (Smart Web Conference)
 
How Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) WorksHow Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) Works
 
HTML and CSS part 3
HTML and CSS part 3HTML and CSS part 3
HTML and CSS part 3
 

Plus de club23

Ms office word 2007
Ms office word 2007Ms office word 2007
Ms office word 2007club23
 
кои сме ние
кои сме ниекои сме ние
кои сме ниеclub23
 
компания2
компания2компания2
компания2club23
 
използване на специализирани програми за получаване и изпращане на файлове в ...
използване на специализирани програми за получаване и изпращане на файлове в ...използване на специализирани програми за получаване и изпращане на файлове в ...
използване на специализирани програми за получаване и изпращане на файлове в ...club23
 
Html 5-tables-forms-frames (1)
Html 5-tables-forms-frames (1)Html 5-tables-forms-frames (1)
Html 5-tables-forms-frames (1)club23
 
Project 1 challenge
Project 1   challenge Project 1   challenge
Project 1 challenge club23
 
Project 1 module 3 -9kl
Project 1   module 3 -9klProject 1   module 3 -9kl
Project 1 module 3 -9klclub23
 
Project 1 module 2-9kl
Project 1   module 2-9klProject 1   module 2-9kl
Project 1 module 2-9klclub23
 
Project 1 module 1-9kl
Project 1   module 1-9klProject 1   module 1-9kl
Project 1 module 1-9klclub23
 
20090510 unicheats.net 520_6094
20090510 unicheats.net 520_609420090510 unicheats.net 520_6094
20090510 unicheats.net 520_6094club23
 
Kolelo
KoleloKolelo
Koleloclub23
 
Proekt
ProektProekt
Proektclub23
 
Prolet
ProletProlet
Proletclub23
 
езици за програмиране. Php
езици за програмиране. Phpезици за програмиране. Php
езици за програмиране. Phpclub23
 

Plus de club23 (15)

Ms office word 2007
Ms office word 2007Ms office word 2007
Ms office word 2007
 
кои сме ние
кои сме ниекои сме ние
кои сме ние
 
Karma
KarmaKarma
Karma
 
компания2
компания2компания2
компания2
 
използване на специализирани програми за получаване и изпращане на файлове в ...
използване на специализирани програми за получаване и изпращане на файлове в ...използване на специализирани програми за получаване и изпращане на файлове в ...
използване на специализирани програми за получаване и изпращане на файлове в ...
 
Html 5-tables-forms-frames (1)
Html 5-tables-forms-frames (1)Html 5-tables-forms-frames (1)
Html 5-tables-forms-frames (1)
 
Project 1 challenge
Project 1   challenge Project 1   challenge
Project 1 challenge
 
Project 1 module 3 -9kl
Project 1   module 3 -9klProject 1   module 3 -9kl
Project 1 module 3 -9kl
 
Project 1 module 2-9kl
Project 1   module 2-9klProject 1   module 2-9kl
Project 1 module 2-9kl
 
Project 1 module 1-9kl
Project 1   module 1-9klProject 1   module 1-9kl
Project 1 module 1-9kl
 
20090510 unicheats.net 520_6094
20090510 unicheats.net 520_609420090510 unicheats.net 520_6094
20090510 unicheats.net 520_6094
 
Kolelo
KoleloKolelo
Kolelo
 
Proekt
ProektProekt
Proekt
 
Prolet
ProletProlet
Prolet
 
езици за програмиране. Php
езици за програмиране. Phpезици за програмиране. Php
езици за програмиране. Php
 

Dernier

Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationRosabel UA
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
The Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsThe Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsRommel Regala
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
Presentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxPresentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxRosabel UA
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxVanesaIglesias10
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSMae Pangan
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptshraddhaparab530
 
TEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docxTEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docxruthvilladarez
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmStan Meyer
 

Dernier (20)

FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translation
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
The Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsThe Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World Politics
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
Presentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxPresentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptx
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptx
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHS
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.ppt
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
TEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docxTEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docx
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and Film
 

Css layout

  • 1. CSS Layout Svetlin Nakov Manager Technical Training http://nakov.com Telerik Web Design Course html5course.telerik.com
  • 2. Table of Contents  Positioning  Positioning inline elements  Floating  Left and right  Clearing  Opacity  Visibility  Display 2
  • 4. Positioning  position: defines the positioning of the element in the page content flow  The value is one of:  static (default)  relative – relative position according to where the element would appear with static position  absolute – position according to the innermost positioned parent element  fixed – same as absolute, but ignores page scrolling 4
  • 5. Positioning (2)  Margin VS relative positioning  Fixed and absolutely positioned elements do not influence the page normal flow and usually stay on top of other elements  Their position and size is ignored when calculating the size of parent element or position of surrounding elements  Overlaid according to their z-index  Inline fixed or absolutely positioned elements can apply height like block-level elements 5
  • 6. Positioning (3)  top, left, bottom, right: specifies offset of absolute/fixed/relative positioned element as numerical values  z-index : specifies the stack level of positioned elements  Understanding stacking context Each positioned element creates a stacking context. Elements in different stacking contexts are overlapped according to the stacking order of their containers. For example, there is no way for #A1 and #A2 (children of #A) to be placed over #B without increasing the z-index of #A. 6
  • 7. Positioning Live Demo positioning-rules.html
  • 8. Inline element positioning  vertical-align: sets the vertical-alignment of an inline element, according to the line height  Values: baseline, sub, super, top, text-top, middle, bottom, text-bottom or numeric  Also used for content of table cells (which apply middle alignment by default) 8
  • 9. Alignment and Z-Index Live Demo alignments-and-z-index-rules.html
  • 11. Float  float: the element “floats” to one side  left: places the element on the left and following content on the right  right: places the element on the right and following content on the left  floated elements should come before the content that will wrap around them in the code  margins of floated elements do not collapse  floated inline elements can apply height 11
  • 12. Float (2)  How floated elements are positioned 12
  • 13. Clear  clear  Sets the sides of the element where other floating elements are NOT allowed  Used to "drop" elements below floated ones or expand a container, which contains only floated children  Possible values: left, right, both  Clearing floats  additional element (<div>) with a clear style 13
  • 14. Clear (2)  Clearing floats (continued)  :after { content: ""; display: block; clear: both; height: 0; }  Triggering hasLayout in IE expands a container of floated elements  display: inline-block;  zoom: 1; 14
  • 15. Floating Elements Live Demo float-rules.html
  • 17. Opacity  opacity: specifies the opacity of the element  Floating point number from 0 to 1  For old Mozilla browsers use –moz-opacity  For IE use filter:alpha(opacity=value) where value is from 0 to 100; also, "binary and script behaviors" must be enabled and hasLayout must be triggered, e.g. with zoom:1 17
  • 18. Opacity Live Demo opacity-rule.html
  • 20. Visibility  visibility  Determines whether the element is visible  hidden: element is not rendered, but still occupies place on the page (similar to opacity:0)  visible: element is rendered normally 20
  • 21. Visibility Live Demo visibility-rule.html
  • 23. Display  display: controls the displayof the element and the way it is rendered and if breaks should be placed before and after the element  inline: no breaks are placed before and after (<span> is an inline element)  block: breaks are placed before AND after the element (<div> is a block element) 23
  • 24. Display (2)  display: controls the displayof the element and the way it is rendered and if breaks should be placed before and after the element  none: element is hidden and its dimensions are not used to calculate the surrounding elements rendering (differs from visibility: hidden!)  There are some more possible values, but not all browsers support them  Specific displays like table-cell and table-row 24
  • 25. Display Live Demo display-rule.html
  • 26. CSS – Part II Questions? http://frontendcourse.telerik.com
  • 27. Homework 1. Create the following Web page using HTML and external CSS. Using tables, inline styles and deprecated tags is not allowed. 27
  • 28. Homework (2) 2. Create the following Web page using external CSS styles. Buttons should consist of PNG images with text over them. 28
  • 29. Homework (3) 3. Create the following Web page using HTML with external CSS file. Note that the images should be PNG with transparent background. 29
  • 30. Homework (4) 4. Given the picture below create the Web site  Use CSS and HTML 5 30
  • 31. Homework (5) 5. Create the following HTML 5 Page  Do it without tables 31