/ Published in: CSS
Creating a horizontal row of objects that are equidistant from each other is another one of those things in web design that is much more difficult than it should be. This can be a very useful thing to do, especially in fluid width layouts when you are trying to make the most of whatever horizontal space you have. Here are the goals we are trying to achieve:
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<!--PASS: First on the left, float the rest right in equal size boxes Fortunately the table idea sparked some thought. The first image needs to be left aligned, but all the rest of them could be right-aligned. In fact, if they are, and also inside of boxes that divide the rest of that space evenly, that might just do it. Perhaps this is best explained visually: floatytechnqiue.png --> HTML: <img src="images/shape-red.png"> <div id="movers-row"> <div><img src="images/shape-green.png"></div> <div><img src="images/shape-yellow.png"></div> <div><img src="images/shape-blue.png"></div> </div> CSS: #movers-row { margin: -120px 0 0 120px; } #movers-row div { width: 33.3%; float: left; } #movers-row div img { float: right; }
URL: http://css-tricks.com/equidistant-objects-with-css/