SlideShare uma empresa Scribd logo
1 de 7
Nesting and Floating Elements
Nesting <div> elements: ,[object Object],[object Object],[object Object]
A nested <div> example: Here we have placed a container (pink) inside another container (blue), which itself is inside a parent container (yellow). <head> <style type=&quot;text/css&quot;> .yellow { width:400px; height:400px; background-color:yellow; } .blue { width:200px; height:200px; background-color:blue; } .pink { width:100px; height:100px; background-color:pink; } </style> </head> <div class=&quot;yellow&quot;> <div class=&quot;blue&quot;> <div class=&quot;pink&quot;></div> </div> <!-- blue --> </div> <!-- yellow --> Notice the comments added to the last two closing </div> tags. These can help us later, especially when there is a lot of code between the opening and closing tags.
Floating elements: ,[object Object],[object Object]
Floating <div> elements: When we float elements, subsequent content stays at the same horizontal level and uses whatever space remains.  Once that space is used up, the content will &quot;wrap&quot; to the beginning of the next line. <head> <style type=&quot;text/css&quot;> .first { width:100px; height:100px; background-color:blue; float:left; } .second { width:100px; height:100px; background-color:yellow; float:left; } </style> </head> <div class=&quot;first&quot;></div> <div class=&quot;second&quot;></div> More content.<br /> More content.<br /> More content.<br /> More content.<br /> More content.<br /> More content. More content. More content. More content. More content.
Floating right and left: We can also float elements to both the right and left sides of the page.  The subsequent content will still behave the same way, filling whatever space remains untaken by the floated elements. <head> <style type=&quot;text/css&quot;> .first { width:100px; height:100px; background-color:blue; float:left; } .second { width:100px; height:100px; background-color:yellow; float:right; } </style> </head> <div class=&quot;first&quot;></div> <div class=&quot;second&quot;></div> More content.<br /> More content.<br /> More content.<br /> More content.<br /> More content.<br /> More content. More content. More content. More content. More content. This is commonly done to create a web page with three columns.  A navigation bar will be floated left, an information bar floated right, and the main content will reside in the middle of the page.
Clearing the float: If we want to force the next element to start below the floated elements, we can clear the float. <head> <style type=&quot;text/css&quot;> .first { width:100px; height:100px; background-color:blue; float:left; } .second { width:100px; height:100px; background-color:yellow; float:right; } .clearfloat { clear:both; } </style> </head> <div class=&quot;first&quot;></div> <div class=&quot;second&quot;></div> <div class=&quot;clearfloat&quot;></div> More content.<br /> . . . More content. More content. More content. More content. More content.

Mais conteúdo relacionado

Mais procurados

C S S Top Elements
C S S  Top  ElementsC S S  Top  Elements
C S S Top Elementsehorner
 
Block2 Session2 Presentation
Block2 Session2 PresentationBlock2 Session2 Presentation
Block2 Session2 PresentationMichael Gwyther
 
How an html file is structured
How an html file is structuredHow an html file is structured
How an html file is structuredcrmolloy
 
Hour 02
Hour 02Hour 02
Hour 02dpd
 
JWU Guest Talk: JavaScript and AJAX
JWU Guest Talk: JavaScript and AJAXJWU Guest Talk: JavaScript and AJAX
JWU Guest Talk: JavaScript and AJAXHilary Mason
 
Randy Witt Audio Assignment
Randy Witt Audio AssignmentRandy Witt Audio Assignment
Randy Witt Audio AssignmentPAVenturer
 
How To Become A Web Page Master Builder
How To Become A Web Page Master BuilderHow To Become A Web Page Master Builder
How To Become A Web Page Master Buildermarcgr1
 
Anvita Dynamic Fontson Web Feb2001
Anvita Dynamic Fontson Web Feb2001Anvita Dynamic Fontson Web Feb2001
Anvita Dynamic Fontson Web Feb2001guest6e7a1b1
 
Basics tags for HTML
Basics tags for HTMLBasics tags for HTML
Basics tags for HTMLvidyamittal
 
La sociedad del conocimiento
La sociedad del conocimientoLa sociedad del conocimiento
La sociedad del conocimientovyalb
 
HTML presentation for beginners
HTML presentation for beginnersHTML presentation for beginners
HTML presentation for beginnersjeroenvdmeer
 
Html basics IML 140 (weeks 2-3)
Html basics IML 140 (weeks 2-3)Html basics IML 140 (weeks 2-3)
Html basics IML 140 (weeks 2-3)Evan Hughes
 
The Basics of (X)HTML Tags
The Basics of (X)HTML TagsThe Basics of (X)HTML Tags
The Basics of (X)HTML TagsLearningNerd
 

Mais procurados (20)

C S S Top Elements
C S S  Top  ElementsC S S  Top  Elements
C S S Top Elements
 
Block2 Session2 Presentation
Block2 Session2 PresentationBlock2 Session2 Presentation
Block2 Session2 Presentation
 
Learning HTML
Learning HTMLLearning HTML
Learning HTML
 
How an html file is structured
How an html file is structuredHow an html file is structured
How an html file is structured
 
Hour 02
Hour 02Hour 02
Hour 02
 
Html tutorial
Html tutorialHtml tutorial
Html tutorial
 
JWU Guest Talk: JavaScript and AJAX
JWU Guest Talk: JavaScript and AJAXJWU Guest Talk: JavaScript and AJAX
JWU Guest Talk: JavaScript and AJAX
 
Randy Witt Audio Assignment
Randy Witt Audio AssignmentRandy Witt Audio Assignment
Randy Witt Audio Assignment
 
Basic HTML
Basic HTMLBasic HTML
Basic HTML
 
Cheat codes
Cheat codesCheat codes
Cheat codes
 
How To Become A Web Page Master Builder
How To Become A Web Page Master BuilderHow To Become A Web Page Master Builder
How To Become A Web Page Master Builder
 
Anvita Dynamic Fontson Web Feb2001
Anvita Dynamic Fontson Web Feb2001Anvita Dynamic Fontson Web Feb2001
Anvita Dynamic Fontson Web Feb2001
 
Basics tags for HTML
Basics tags for HTMLBasics tags for HTML
Basics tags for HTML
 
New HTML5/CSS3 techniques
New HTML5/CSS3 techniquesNew HTML5/CSS3 techniques
New HTML5/CSS3 techniques
 
La sociedad del conocimiento
La sociedad del conocimientoLa sociedad del conocimiento
La sociedad del conocimiento
 
HTML presentation for beginners
HTML presentation for beginnersHTML presentation for beginners
HTML presentation for beginners
 
Html basics IML 140 (weeks 2-3)
Html basics IML 140 (weeks 2-3)Html basics IML 140 (weeks 2-3)
Html basics IML 140 (weeks 2-3)
 
Javascript
JavascriptJavascript
Javascript
 
The Basics of (X)HTML Tags
The Basics of (X)HTML TagsThe Basics of (X)HTML Tags
The Basics of (X)HTML Tags
 
Understanding html
Understanding htmlUnderstanding html
Understanding html
 

Destaque

Chachies del boske nuboso
Chachies del boske nubosoChachies del boske nuboso
Chachies del boske nubosokuckling2010
 
TPA-AL Wiki Explained
TPA-AL Wiki ExplainedTPA-AL Wiki Explained
TPA-AL Wiki Explainedmendi2333
 
Kade karu ott 2
Kade karu ott 2Kade karu ott 2
Kade karu ott 2max97
 
Eco world- Snežana
Eco world- SnežanaEco world- Snežana
Eco world- SnežanaEva Vovka
 
Comenius Liiverpool
Comenius LiiverpoolComenius Liiverpool
Comenius LiiverpoolEva Vovka
 
Ecologic footprint
Ecologic footprintEcologic footprint
Ecologic footprintEva Vovka
 
Jingle bells power point
Jingle bells power pointJingle bells power point
Jingle bells power pointMartis Flower
 
1.4 adding comments copy (2)
1.4 adding comments   copy (2)1.4 adding comments   copy (2)
1.4 adding comments copy (2)Bulldogs83
 
Špoģi-Syke
Špoģi-Syke  Špoģi-Syke
Špoģi-Syke Eva Vovka
 
This is our school, zrenjaninska gimnazija (zrenjanin grammar school), serbia
This is our school, zrenjaninska gimnazija (zrenjanin grammar school), serbiaThis is our school, zrenjaninska gimnazija (zrenjanin grammar school), serbia
This is our school, zrenjaninska gimnazija (zrenjanin grammar school), serbiaMihajlo Gajic
 
Dress from newspapers_-_copy (1)
Dress from newspapers_-_copy (1)Dress from newspapers_-_copy (1)
Dress from newspapers_-_copy (1)Eva Vovka
 
American Campaign to supress Islam
American Campaign to supress IslamAmerican Campaign to supress Islam
American Campaign to supress IslamAbu Talha
 
Millatfacebook
MillatfacebookMillatfacebook
Millatfacebookpakakir
 
The reed flute cave
The reed flute caveThe reed flute cave
The reed flute caveEva Vovka
 
1.3 creating links
1.3 creating links1.3 creating links
1.3 creating linksBulldogs83
 
Questionnaire results students-teachers-zr
Questionnaire results students-teachers-zrQuestionnaire results students-teachers-zr
Questionnaire results students-teachers-zrMihajlo Gajic
 

Destaque (20)

Dövrlər
DövrlərDövrlər
Dövrlər
 
Chachies del boske nuboso
Chachies del boske nubosoChachies del boske nuboso
Chachies del boske nuboso
 
TPA-AL Wiki Explained
TPA-AL Wiki ExplainedTPA-AL Wiki Explained
TPA-AL Wiki Explained
 
Kade karu ott 2
Kade karu ott 2Kade karu ott 2
Kade karu ott 2
 
Erosion pdf
Erosion pdfErosion pdf
Erosion pdf
 
Eco world- Snežana
Eco world- SnežanaEco world- Snežana
Eco world- Snežana
 
Comenius Liiverpool
Comenius LiiverpoolComenius Liiverpool
Comenius Liiverpool
 
Ecologic footprint
Ecologic footprintEcologic footprint
Ecologic footprint
 
Jingle bells power point
Jingle bells power pointJingle bells power point
Jingle bells power point
 
1.4 adding comments copy (2)
1.4 adding comments   copy (2)1.4 adding comments   copy (2)
1.4 adding comments copy (2)
 
Špoģi-Syke
Špoģi-Syke  Špoģi-Syke
Špoģi-Syke
 
This is our school, zrenjaninska gimnazija (zrenjanin grammar school), serbia
This is our school, zrenjaninska gimnazija (zrenjanin grammar school), serbiaThis is our school, zrenjaninska gimnazija (zrenjanin grammar school), serbia
This is our school, zrenjaninska gimnazija (zrenjanin grammar school), serbia
 
Dress from newspapers_-_copy (1)
Dress from newspapers_-_copy (1)Dress from newspapers_-_copy (1)
Dress from newspapers_-_copy (1)
 
American Campaign to supress Islam
American Campaign to supress IslamAmerican Campaign to supress Islam
American Campaign to supress Islam
 
Millatfacebook
MillatfacebookMillatfacebook
Millatfacebook
 
The reed flute cave
The reed flute caveThe reed flute cave
The reed flute cave
 
1.3 creating links
1.3 creating links1.3 creating links
1.3 creating links
 
Idiom 1
Idiom  1Idiom  1
Idiom 1
 
Power e
Power ePower e
Power e
 
Questionnaire results students-teachers-zr
Questionnaire results students-teachers-zrQuestionnaire results students-teachers-zr
Questionnaire results students-teachers-zr
 

Semelhante a 5.2 nesting and floating elements

How To Create Personal Web Pages On My Web
How To Create Personal Web Pages On My WebHow To Create Personal Web Pages On My Web
How To Create Personal Web Pages On My Websritikumar
 
KMUTNB - Internet Programming 3/7
KMUTNB - Internet Programming 3/7KMUTNB - Internet Programming 3/7
KMUTNB - Internet Programming 3/7phuphax
 
Introduction to html
Introduction to htmlIntroduction to html
Introduction to htmlvikasgaur31
 
Introduction to html
Introduction to htmlIntroduction to html
Introduction to htmlvikasgaur31
 
1.2 elements and attributes copy (3)
1.2 elements and attributes   copy (3)1.2 elements and attributes   copy (3)
1.2 elements and attributes copy (3)Bulldogs83
 
1.2 elements and attributes copy (3)
1.2 elements and attributes   copy (3)1.2 elements and attributes   copy (3)
1.2 elements and attributes copy (3)Bulldogs83
 
The Frameless Opac
The Frameless OpacThe Frameless Opac
The Frameless OpacBill Drew
 
Lecture 2 - Comm Lab: Web @ ITP
Lecture 2 - Comm Lab: Web @ ITPLecture 2 - Comm Lab: Web @ ITP
Lecture 2 - Comm Lab: Web @ ITPyucefmerhi
 
Webpages And Dynamic Content
Webpages And Dynamic ContentWebpages And Dynamic Content
Webpages And Dynamic Contentmaycourse
 
Lecture 1 - Comm Lab: Web @ ITP
Lecture 1 - Comm Lab: Web @ ITPLecture 1 - Comm Lab: Web @ ITP
Lecture 1 - Comm Lab: Web @ ITPyucefmerhi
 
Kml Basics Chpt 2 Placemarks
Kml Basics Chpt  2   PlacemarksKml Basics Chpt  2   Placemarks
Kml Basics Chpt 2 Placemarkstcooper66
 

Semelhante a 5.2 nesting and floating elements (20)

Haml, Sass & Compass
Haml, Sass & CompassHaml, Sass & Compass
Haml, Sass & Compass
 
How To Create Personal Web Pages On My Web
How To Create Personal Web Pages On My WebHow To Create Personal Web Pages On My Web
How To Create Personal Web Pages On My Web
 
Front End on Rails
Front End on RailsFront End on Rails
Front End on Rails
 
KMUTNB - Internet Programming 3/7
KMUTNB - Internet Programming 3/7KMUTNB - Internet Programming 3/7
KMUTNB - Internet Programming 3/7
 
Introduction to html
Introduction to htmlIntroduction to html
Introduction to html
 
Introduction to html
Introduction to htmlIntroduction to html
Introduction to html
 
1.2 elements and attributes copy (3)
1.2 elements and attributes   copy (3)1.2 elements and attributes   copy (3)
1.2 elements and attributes copy (3)
 
1.2 elements and attributes copy (3)
1.2 elements and attributes   copy (3)1.2 elements and attributes   copy (3)
1.2 elements and attributes copy (3)
 
The Frameless Opac
The Frameless OpacThe Frameless Opac
The Frameless Opac
 
Lecture 2 - Comm Lab: Web @ ITP
Lecture 2 - Comm Lab: Web @ ITPLecture 2 - Comm Lab: Web @ ITP
Lecture 2 - Comm Lab: Web @ ITP
 
Webpages And Dynamic Content
Webpages And Dynamic ContentWebpages And Dynamic Content
Webpages And Dynamic Content
 
CSS
CSSCSS
CSS
 
Web Designing
Web DesigningWeb Designing
Web Designing
 
Lecture 1 - Comm Lab: Web @ ITP
Lecture 1 - Comm Lab: Web @ ITPLecture 1 - Comm Lab: Web @ ITP
Lecture 1 - Comm Lab: Web @ ITP
 
Kml Basics Chpt 2 Placemarks
Kml Basics Chpt  2   PlacemarksKml Basics Chpt  2   Placemarks
Kml Basics Chpt 2 Placemarks
 
CSS
CSSCSS
CSS
 
Diva
DivaDiva
Diva
 
Tor2
Tor2Tor2
Tor2
 
Css advanced – session 5
Css advanced – session 5Css advanced – session 5
Css advanced – session 5
 
HTML & CSS
HTML & CSSHTML & CSS
HTML & CSS
 

Mais de Bulldogs83

7.2 external style sheets
7.2 external style sheets7.2 external style sheets
7.2 external style sheetsBulldogs83
 
7.1 xhtml validation
7.1 xhtml validation7.1 xhtml validation
7.1 xhtml validationBulldogs83
 
6.2 css link styling
6.2 css link styling6.2 css link styling
6.2 css link stylingBulldogs83
 
6.1 special characters
6.1 special characters6.1 special characters
6.1 special charactersBulldogs83
 
5.1 css box model
5.1 css box model5.1 css box model
5.1 css box modelBulldogs83
 
4.3 table styling
4.3 table styling4.3 table styling
4.3 table stylingBulldogs83
 
4.2 css classes
4.2 css classes4.2 css classes
4.2 css classesBulldogs83
 
4.1 advanced tables
4.1 advanced tables4.1 advanced tables
4.1 advanced tablesBulldogs83
 
3.2 introduction to css
3.2 introduction to css3.2 introduction to css
3.2 introduction to cssBulldogs83
 
3.1 xhtml tables
3.1 xhtml tables3.1 xhtml tables
3.1 xhtml tablesBulldogs83
 
3.2 introduction to css
3.2 introduction to css3.2 introduction to css
3.2 introduction to cssBulldogs83
 
2.1 adding images
2.1 adding images2.1 adding images
2.1 adding imagesBulldogs83
 
1.4 adding comments copy (2)
1.4 adding comments   copy (2)1.4 adding comments   copy (2)
1.4 adding comments copy (2)Bulldogs83
 
1.3 creating links
1.3 creating links1.3 creating links
1.3 creating linksBulldogs83
 

Mais de Bulldogs83 (14)

7.2 external style sheets
7.2 external style sheets7.2 external style sheets
7.2 external style sheets
 
7.1 xhtml validation
7.1 xhtml validation7.1 xhtml validation
7.1 xhtml validation
 
6.2 css link styling
6.2 css link styling6.2 css link styling
6.2 css link styling
 
6.1 special characters
6.1 special characters6.1 special characters
6.1 special characters
 
5.1 css box model
5.1 css box model5.1 css box model
5.1 css box model
 
4.3 table styling
4.3 table styling4.3 table styling
4.3 table styling
 
4.2 css classes
4.2 css classes4.2 css classes
4.2 css classes
 
4.1 advanced tables
4.1 advanced tables4.1 advanced tables
4.1 advanced tables
 
3.2 introduction to css
3.2 introduction to css3.2 introduction to css
3.2 introduction to css
 
3.1 xhtml tables
3.1 xhtml tables3.1 xhtml tables
3.1 xhtml tables
 
3.2 introduction to css
3.2 introduction to css3.2 introduction to css
3.2 introduction to css
 
2.1 adding images
2.1 adding images2.1 adding images
2.1 adding images
 
1.4 adding comments copy (2)
1.4 adding comments   copy (2)1.4 adding comments   copy (2)
1.4 adding comments copy (2)
 
1.3 creating links
1.3 creating links1.3 creating links
1.3 creating links
 

Último

Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesShubhangi Sonawane
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docxPoojaSen20
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 

Último (20)

Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 

5.2 nesting and floating elements

  • 2.
  • 3. A nested <div> example: Here we have placed a container (pink) inside another container (blue), which itself is inside a parent container (yellow). <head> <style type=&quot;text/css&quot;> .yellow { width:400px; height:400px; background-color:yellow; } .blue { width:200px; height:200px; background-color:blue; } .pink { width:100px; height:100px; background-color:pink; } </style> </head> <div class=&quot;yellow&quot;> <div class=&quot;blue&quot;> <div class=&quot;pink&quot;></div> </div> <!-- blue --> </div> <!-- yellow --> Notice the comments added to the last two closing </div> tags. These can help us later, especially when there is a lot of code between the opening and closing tags.
  • 4.
  • 5. Floating <div> elements: When we float elements, subsequent content stays at the same horizontal level and uses whatever space remains. Once that space is used up, the content will &quot;wrap&quot; to the beginning of the next line. <head> <style type=&quot;text/css&quot;> .first { width:100px; height:100px; background-color:blue; float:left; } .second { width:100px; height:100px; background-color:yellow; float:left; } </style> </head> <div class=&quot;first&quot;></div> <div class=&quot;second&quot;></div> More content.<br /> More content.<br /> More content.<br /> More content.<br /> More content.<br /> More content. More content. More content. More content. More content.
  • 6. Floating right and left: We can also float elements to both the right and left sides of the page. The subsequent content will still behave the same way, filling whatever space remains untaken by the floated elements. <head> <style type=&quot;text/css&quot;> .first { width:100px; height:100px; background-color:blue; float:left; } .second { width:100px; height:100px; background-color:yellow; float:right; } </style> </head> <div class=&quot;first&quot;></div> <div class=&quot;second&quot;></div> More content.<br /> More content.<br /> More content.<br /> More content.<br /> More content.<br /> More content. More content. More content. More content. More content. This is commonly done to create a web page with three columns. A navigation bar will be floated left, an information bar floated right, and the main content will reside in the middle of the page.
  • 7. Clearing the float: If we want to force the next element to start below the floated elements, we can clear the float. <head> <style type=&quot;text/css&quot;> .first { width:100px; height:100px; background-color:blue; float:left; } .second { width:100px; height:100px; background-color:yellow; float:right; } .clearfloat { clear:both; } </style> </head> <div class=&quot;first&quot;></div> <div class=&quot;second&quot;></div> <div class=&quot;clearfloat&quot;></div> More content.<br /> . . . More content. More content. More content. More content. More content.