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