SlideShare una empresa de Scribd logo
1 de 30
Descargar para leer sin conexión
The Question


 “     Trying to move toward absolute positioning versus floats for
       layout.... I am trying to figure out if [you] have to always use a height
       on the wrapper div. If I have text columns that have no specific



                                                                           ”
       height it seems everything breaks at that point.


                                                 Shane Perran, graphicalwonder.com




ethan marcottESXSW2006www.vertua.com
Absolute Positioning
                It’s all about the x and the y (axes, that is)
            ❖


                Treating parts of your document as distinct
            ❖

                “layers”
                Use CSS to precisely place them upon a
            ❖

                coordinate grid
            Cake, yes? Let’s look at an example.


ethan marcottESXSW2006www.vertua.com
A new “positioning context”




                                                     div.photo {
                 <div class="photo">
                                                     
    position: relative;
                    <p>Here’s a caption. Yay.</p>
                                                     }
                    <img src="photo.jpg" alt="" />
                 </div>
                                                     p.caption {
                                                     
    position: absolute;
                                                     
    bottom: 9px;
                                                     }
ethan marcottESXSW2006www.vertua.com
"Bottom-blindness"
position: relative;
position:                          position:
              margin-left: [x];
absolute;                          absolute;
              margin-right: [y];
width: [x];                        width: [y]
Remember <img            align="left">?




ethan marcottESXSW2006www.vertua.com
The basics




                                       img { float: left; }




ethan marcottESXSW2006www.vertua.com
The basics




                                       img { float: right; }




ethan marcottESXSW2006www.vertua.com
Reflow, floats, and you




                                       img { float: left; }



ethan marcottESXSW2006www.vertua.com
Restoring order to the flow




                                 p.clear { clear: left; }


ethan marcottESXSW2006www.vertua.com
Okay, great. Kitty pictures. So?
                Floats can provide us with a more flexible
            ❖

                layout model
                Clearing allows the components of our
            ❖

                designs to become “context aware”
                Let’s view a simple example.
            ❖




ethan marcottESXSW2006www.vertua.com
Marrying floats and positioning




ethan marcottESXSW2006www.vertua.com
The marvelous markup
            <div class="person">
               <div class="image">
                  <img src="photo.jpg" alt="" />
               </div>
               <dl>
                  <dt><a href="#">Durstan who?</a></dt>
                  <dd>
                       <ul>...</ul>
                  </dd>
               </dl>
            </div>

ethan marcottESXSW2006www.vertua.com
Getting our 2-column structure




ethan marcottESXSW2006www.vertua.com
Getting our 2-column structure

                                       .person {
                                       
    clear: left;
                                       }


                                       .person .image {
                                       
    float: left;
                                       }




ethan marcottESXSW2006www.vertua.com
One minor addition
            <div class="person">
               <div class="image">
                  <img src="photo.jpg" alt="" />
               </div>
               <dl>
                  <dt><a href="#">Durstan who?</a></dt>
                  <dd>
                       <ul>...</ul>
                  </dd>
               </dl>
            </div>

ethan marcottESXSW2006www.vertua.com
One minor addition
            <div class="person">
               <div class="image">
                  <img src="photo.jpg" alt="" />
               </div>
               <dl>
                  <dt><a href="#"><i></i>Durstan who?</a></dt>
                  <dd>
                       <ul>...</ul>
                  </dd>
               </dl>
            </div>

ethan marcottESXSW2006www.vertua.com
Layering the link
                                                .person {
                                                
    position: relative;
                                                }


                     position: relative;




ethan marcottESXSW2006www.vertua.com
Layering the link
                                                .person {
                                                
    position: relative;
                                                }


                                                .person dt i {
              <i></i>                           
    display: block;
                                                
    height: 160px;
                                                
    width: 160px;
                                                
    position: absolute;
                                                
    left: 0;
                                                
    top: 0;
                                                }




ethan marcottESXSW2006www.vertua.com
Ethan Marcotte
  vertua.com

Más contenido relacionado

Más de huer1278ft

Grids are Good (right?)
Grids are Good (right?)Grids are Good (right?)
Grids are Good (right?)huer1278ft
 
Funny & Humorous Signs
Funny & Humorous SignsFunny & Humorous Signs
Funny & Humorous Signshuer1278ft
 
How to drive your competition crazy
How to drive your competition crazyHow to drive your competition crazy
How to drive your competition crazyhuer1278ft
 
Rules for Revolutionaries
Rules for RevolutionariesRules for Revolutionaries
Rules for Revolutionarieshuer1278ft
 
Selling the Dream
Selling the DreamSelling the Dream
Selling the Dreamhuer1278ft
 
Leadership Lessons from the Trenches
Leadership Lessons from the TrenchesLeadership Lessons from the Trenches
Leadership Lessons from the Trencheshuer1278ft
 
The War for Talent
The War for TalentThe War for Talent
The War for Talenthuer1278ft
 
Top 10 lies of Venture Capitalists
Top 10 lies of Venture CapitalistsTop 10 lies of Venture Capitalists
Top 10 lies of Venture Capitalistshuer1278ft
 
The Art of the Pitching
The Art of the PitchingThe Art of the Pitching
The Art of the Pitchinghuer1278ft
 
Top 10 lies of Entrepreneurs
Top 10 lies of EntrepreneursTop 10 lies of Entrepreneurs
Top 10 lies of Entrepreneurshuer1278ft
 
The Art of the Selling
The Art of the SellingThe Art of the Selling
The Art of the Sellinghuer1278ft
 
The Art of the Raising Capital
The Art of the Raising CapitalThe Art of the Raising Capital
The Art of the Raising Capitalhuer1278ft
 
The Art of the Start
The Art of the StartThe Art of the Start
The Art of the Starthuer1278ft
 
The Tyranny of Human Civilization
The Tyranny of Human CivilizationThe Tyranny of Human Civilization
The Tyranny of Human Civilizationhuer1278ft
 

Más de huer1278ft (15)

Grids are Good (right?)
Grids are Good (right?)Grids are Good (right?)
Grids are Good (right?)
 
Funny & Humorous Signs
Funny & Humorous SignsFunny & Humorous Signs
Funny & Humorous Signs
 
How to drive your competition crazy
How to drive your competition crazyHow to drive your competition crazy
How to drive your competition crazy
 
iClosed
iClosediClosed
iClosed
 
Rules for Revolutionaries
Rules for RevolutionariesRules for Revolutionaries
Rules for Revolutionaries
 
Selling the Dream
Selling the DreamSelling the Dream
Selling the Dream
 
Leadership Lessons from the Trenches
Leadership Lessons from the TrenchesLeadership Lessons from the Trenches
Leadership Lessons from the Trenches
 
The War for Talent
The War for TalentThe War for Talent
The War for Talent
 
Top 10 lies of Venture Capitalists
Top 10 lies of Venture CapitalistsTop 10 lies of Venture Capitalists
Top 10 lies of Venture Capitalists
 
The Art of the Pitching
The Art of the PitchingThe Art of the Pitching
The Art of the Pitching
 
Top 10 lies of Entrepreneurs
Top 10 lies of EntrepreneursTop 10 lies of Entrepreneurs
Top 10 lies of Entrepreneurs
 
The Art of the Selling
The Art of the SellingThe Art of the Selling
The Art of the Selling
 
The Art of the Raising Capital
The Art of the Raising CapitalThe Art of the Raising Capital
The Art of the Raising Capital
 
The Art of the Start
The Art of the StartThe Art of the Start
The Art of the Start
 
The Tyranny of Human Civilization
The Tyranny of Human CivilizationThe Tyranny of Human Civilization
The Tyranny of Human Civilization
 

Último

Annual General Meeting Presentation Slides
Annual General Meeting Presentation SlidesAnnual General Meeting Presentation Slides
Annual General Meeting Presentation SlidesKeppelCorporation
 
8447779800, Low rate Call girls in Uttam Nagar Delhi NCR
8447779800, Low rate Call girls in Uttam Nagar Delhi NCR8447779800, Low rate Call girls in Uttam Nagar Delhi NCR
8447779800, Low rate Call girls in Uttam Nagar Delhi NCRashishs7044
 
PSCC - Capability Statement Presentation
PSCC - Capability Statement PresentationPSCC - Capability Statement Presentation
PSCC - Capability Statement PresentationAnamaria Contreras
 
Market Sizes Sample Report - 2024 Edition
Market Sizes Sample Report - 2024 EditionMarket Sizes Sample Report - 2024 Edition
Market Sizes Sample Report - 2024 EditionMintel Group
 
Ms Motilal Padampat Sugar Mills vs. State of Uttar Pradesh & Ors. - A Milesto...
Ms Motilal Padampat Sugar Mills vs. State of Uttar Pradesh & Ors. - A Milesto...Ms Motilal Padampat Sugar Mills vs. State of Uttar Pradesh & Ors. - A Milesto...
Ms Motilal Padampat Sugar Mills vs. State of Uttar Pradesh & Ors. - A Milesto...ShrutiBose4
 
Case study on tata clothing brand zudio in detail
Case study on tata clothing brand zudio in detailCase study on tata clothing brand zudio in detail
Case study on tata clothing brand zudio in detailAriel592675
 
8447779800, Low rate Call girls in Shivaji Enclave Delhi NCR
8447779800, Low rate Call girls in Shivaji Enclave Delhi NCR8447779800, Low rate Call girls in Shivaji Enclave Delhi NCR
8447779800, Low rate Call girls in Shivaji Enclave Delhi NCRashishs7044
 
Flow Your Strategy at Flight Levels Day 2024
Flow Your Strategy at Flight Levels Day 2024Flow Your Strategy at Flight Levels Day 2024
Flow Your Strategy at Flight Levels Day 2024Kirill Klimov
 
Global Scenario On Sustainable and Resilient Coconut Industry by Dr. Jelfina...
Global Scenario On Sustainable  and Resilient Coconut Industry by Dr. Jelfina...Global Scenario On Sustainable  and Resilient Coconut Industry by Dr. Jelfina...
Global Scenario On Sustainable and Resilient Coconut Industry by Dr. Jelfina...ictsugar
 
Youth Involvement in an Innovative Coconut Value Chain by Mwalimu Menza
Youth Involvement in an Innovative Coconut Value Chain by Mwalimu MenzaYouth Involvement in an Innovative Coconut Value Chain by Mwalimu Menza
Youth Involvement in an Innovative Coconut Value Chain by Mwalimu Menzaictsugar
 
FULL ENJOY Call girls in Paharganj Delhi | 8377087607
FULL ENJOY Call girls in Paharganj Delhi | 8377087607FULL ENJOY Call girls in Paharganj Delhi | 8377087607
FULL ENJOY Call girls in Paharganj Delhi | 8377087607dollysharma2066
 
(Best) ENJOY Call Girls in Faridabad Ex | 8377087607
(Best) ENJOY Call Girls in Faridabad Ex | 8377087607(Best) ENJOY Call Girls in Faridabad Ex | 8377087607
(Best) ENJOY Call Girls in Faridabad Ex | 8377087607dollysharma2066
 
Innovation Conference 5th March 2024.pdf
Innovation Conference 5th March 2024.pdfInnovation Conference 5th March 2024.pdf
Innovation Conference 5th March 2024.pdfrichard876048
 
Contemporary Economic Issues Facing the Filipino Entrepreneur (1).pptx
Contemporary Economic Issues Facing the Filipino Entrepreneur (1).pptxContemporary Economic Issues Facing the Filipino Entrepreneur (1).pptx
Contemporary Economic Issues Facing the Filipino Entrepreneur (1).pptxMarkAnthonyAurellano
 
Call Girls in DELHI Cantt, ( Call Me )-8377877756-Female Escort- In Delhi / Ncr
Call Girls in DELHI Cantt, ( Call Me )-8377877756-Female Escort- In Delhi / NcrCall Girls in DELHI Cantt, ( Call Me )-8377877756-Female Escort- In Delhi / Ncr
Call Girls in DELHI Cantt, ( Call Me )-8377877756-Female Escort- In Delhi / Ncrdollysharma2066
 
Kenya Coconut Production Presentation by Dr. Lalith Perera
Kenya Coconut Production Presentation by Dr. Lalith PereraKenya Coconut Production Presentation by Dr. Lalith Perera
Kenya Coconut Production Presentation by Dr. Lalith Pereraictsugar
 
Kenya’s Coconut Value Chain by Gatsby Africa
Kenya’s Coconut Value Chain by Gatsby AfricaKenya’s Coconut Value Chain by Gatsby Africa
Kenya’s Coconut Value Chain by Gatsby Africaictsugar
 
Buy gmail accounts.pdf Buy Old Gmail Accounts
Buy gmail accounts.pdf Buy Old Gmail AccountsBuy gmail accounts.pdf Buy Old Gmail Accounts
Buy gmail accounts.pdf Buy Old Gmail AccountsBuy Verified Accounts
 
Digital Transformation in the PLM domain - distrib.pdf
Digital Transformation in the PLM domain - distrib.pdfDigital Transformation in the PLM domain - distrib.pdf
Digital Transformation in the PLM domain - distrib.pdfJos Voskuil
 
Memorándum de Entendimiento (MoU) entre Codelco y SQM
Memorándum de Entendimiento (MoU) entre Codelco y SQMMemorándum de Entendimiento (MoU) entre Codelco y SQM
Memorándum de Entendimiento (MoU) entre Codelco y SQMVoces Mineras
 

Último (20)

Annual General Meeting Presentation Slides
Annual General Meeting Presentation SlidesAnnual General Meeting Presentation Slides
Annual General Meeting Presentation Slides
 
8447779800, Low rate Call girls in Uttam Nagar Delhi NCR
8447779800, Low rate Call girls in Uttam Nagar Delhi NCR8447779800, Low rate Call girls in Uttam Nagar Delhi NCR
8447779800, Low rate Call girls in Uttam Nagar Delhi NCR
 
PSCC - Capability Statement Presentation
PSCC - Capability Statement PresentationPSCC - Capability Statement Presentation
PSCC - Capability Statement Presentation
 
Market Sizes Sample Report - 2024 Edition
Market Sizes Sample Report - 2024 EditionMarket Sizes Sample Report - 2024 Edition
Market Sizes Sample Report - 2024 Edition
 
Ms Motilal Padampat Sugar Mills vs. State of Uttar Pradesh & Ors. - A Milesto...
Ms Motilal Padampat Sugar Mills vs. State of Uttar Pradesh & Ors. - A Milesto...Ms Motilal Padampat Sugar Mills vs. State of Uttar Pradesh & Ors. - A Milesto...
Ms Motilal Padampat Sugar Mills vs. State of Uttar Pradesh & Ors. - A Milesto...
 
Case study on tata clothing brand zudio in detail
Case study on tata clothing brand zudio in detailCase study on tata clothing brand zudio in detail
Case study on tata clothing brand zudio in detail
 
8447779800, Low rate Call girls in Shivaji Enclave Delhi NCR
8447779800, Low rate Call girls in Shivaji Enclave Delhi NCR8447779800, Low rate Call girls in Shivaji Enclave Delhi NCR
8447779800, Low rate Call girls in Shivaji Enclave Delhi NCR
 
Flow Your Strategy at Flight Levels Day 2024
Flow Your Strategy at Flight Levels Day 2024Flow Your Strategy at Flight Levels Day 2024
Flow Your Strategy at Flight Levels Day 2024
 
Global Scenario On Sustainable and Resilient Coconut Industry by Dr. Jelfina...
Global Scenario On Sustainable  and Resilient Coconut Industry by Dr. Jelfina...Global Scenario On Sustainable  and Resilient Coconut Industry by Dr. Jelfina...
Global Scenario On Sustainable and Resilient Coconut Industry by Dr. Jelfina...
 
Youth Involvement in an Innovative Coconut Value Chain by Mwalimu Menza
Youth Involvement in an Innovative Coconut Value Chain by Mwalimu MenzaYouth Involvement in an Innovative Coconut Value Chain by Mwalimu Menza
Youth Involvement in an Innovative Coconut Value Chain by Mwalimu Menza
 
FULL ENJOY Call girls in Paharganj Delhi | 8377087607
FULL ENJOY Call girls in Paharganj Delhi | 8377087607FULL ENJOY Call girls in Paharganj Delhi | 8377087607
FULL ENJOY Call girls in Paharganj Delhi | 8377087607
 
(Best) ENJOY Call Girls in Faridabad Ex | 8377087607
(Best) ENJOY Call Girls in Faridabad Ex | 8377087607(Best) ENJOY Call Girls in Faridabad Ex | 8377087607
(Best) ENJOY Call Girls in Faridabad Ex | 8377087607
 
Innovation Conference 5th March 2024.pdf
Innovation Conference 5th March 2024.pdfInnovation Conference 5th March 2024.pdf
Innovation Conference 5th March 2024.pdf
 
Contemporary Economic Issues Facing the Filipino Entrepreneur (1).pptx
Contemporary Economic Issues Facing the Filipino Entrepreneur (1).pptxContemporary Economic Issues Facing the Filipino Entrepreneur (1).pptx
Contemporary Economic Issues Facing the Filipino Entrepreneur (1).pptx
 
Call Girls in DELHI Cantt, ( Call Me )-8377877756-Female Escort- In Delhi / Ncr
Call Girls in DELHI Cantt, ( Call Me )-8377877756-Female Escort- In Delhi / NcrCall Girls in DELHI Cantt, ( Call Me )-8377877756-Female Escort- In Delhi / Ncr
Call Girls in DELHI Cantt, ( Call Me )-8377877756-Female Escort- In Delhi / Ncr
 
Kenya Coconut Production Presentation by Dr. Lalith Perera
Kenya Coconut Production Presentation by Dr. Lalith PereraKenya Coconut Production Presentation by Dr. Lalith Perera
Kenya Coconut Production Presentation by Dr. Lalith Perera
 
Kenya’s Coconut Value Chain by Gatsby Africa
Kenya’s Coconut Value Chain by Gatsby AfricaKenya’s Coconut Value Chain by Gatsby Africa
Kenya’s Coconut Value Chain by Gatsby Africa
 
Buy gmail accounts.pdf Buy Old Gmail Accounts
Buy gmail accounts.pdf Buy Old Gmail AccountsBuy gmail accounts.pdf Buy Old Gmail Accounts
Buy gmail accounts.pdf Buy Old Gmail Accounts
 
Digital Transformation in the PLM domain - distrib.pdf
Digital Transformation in the PLM domain - distrib.pdfDigital Transformation in the PLM domain - distrib.pdf
Digital Transformation in the PLM domain - distrib.pdf
 
Memorándum de Entendimiento (MoU) entre Codelco y SQM
Memorándum de Entendimiento (MoU) entre Codelco y SQMMemorándum de Entendimiento (MoU) entre Codelco y SQM
Memorándum de Entendimiento (MoU) entre Codelco y SQM
 

Learning to love absolute CSS positioning...

  • 1.
  • 2. The Question “ Trying to move toward absolute positioning versus floats for layout.... I am trying to figure out if [you] have to always use a height on the wrapper div. If I have text columns that have no specific ” height it seems everything breaks at that point. Shane Perran, graphicalwonder.com ethan marcottESXSW2006www.vertua.com
  • 3.
  • 4. Absolute Positioning It’s all about the x and the y (axes, that is) ❖ Treating parts of your document as distinct ❖ “layers” Use CSS to precisely place them upon a ❖ coordinate grid Cake, yes? Let’s look at an example. ethan marcottESXSW2006www.vertua.com
  • 5. A new “positioning context” div.photo { <div class="photo"> position: relative; <p>Here’s a caption. Yay.</p> } <img src="photo.jpg" alt="" /> </div> p.caption { position: absolute; bottom: 9px; } ethan marcottESXSW2006www.vertua.com
  • 7.
  • 9. position: position: margin-left: [x]; absolute; absolute; margin-right: [y]; width: [x]; width: [y]
  • 10.
  • 11.
  • 12.
  • 13.
  • 14. Remember <img align="left">? ethan marcottESXSW2006www.vertua.com
  • 15. The basics img { float: left; } ethan marcottESXSW2006www.vertua.com
  • 16. The basics img { float: right; } ethan marcottESXSW2006www.vertua.com
  • 17. Reflow, floats, and you img { float: left; } ethan marcottESXSW2006www.vertua.com
  • 18. Restoring order to the flow p.clear { clear: left; } ethan marcottESXSW2006www.vertua.com
  • 19.
  • 20. Okay, great. Kitty pictures. So? Floats can provide us with a more flexible ❖ layout model Clearing allows the components of our ❖ designs to become “context aware” Let’s view a simple example. ❖ ethan marcottESXSW2006www.vertua.com
  • 21. Marrying floats and positioning ethan marcottESXSW2006www.vertua.com
  • 22. The marvelous markup <div class="person"> <div class="image"> <img src="photo.jpg" alt="" /> </div> <dl> <dt><a href="#">Durstan who?</a></dt> <dd> <ul>...</ul> </dd> </dl> </div> ethan marcottESXSW2006www.vertua.com
  • 23. Getting our 2-column structure ethan marcottESXSW2006www.vertua.com
  • 24. Getting our 2-column structure .person { clear: left; } .person .image { float: left; } ethan marcottESXSW2006www.vertua.com
  • 25. One minor addition <div class="person"> <div class="image"> <img src="photo.jpg" alt="" /> </div> <dl> <dt><a href="#">Durstan who?</a></dt> <dd> <ul>...</ul> </dd> </dl> </div> ethan marcottESXSW2006www.vertua.com
  • 26. One minor addition <div class="person"> <div class="image"> <img src="photo.jpg" alt="" /> </div> <dl> <dt><a href="#"><i></i>Durstan who?</a></dt> <dd> <ul>...</ul> </dd> </dl> </div> ethan marcottESXSW2006www.vertua.com
  • 27. Layering the link .person { position: relative; } position: relative; ethan marcottESXSW2006www.vertua.com
  • 28. Layering the link .person { position: relative; } .person dt i { <i></i> display: block; height: 160px; width: 160px; position: absolute; left: 0; top: 0; } ethan marcottESXSW2006www.vertua.com
  • 29.
  • 30. Ethan Marcotte vertua.com