Posted By

localhorst on 03/15/08


layout fluid

Versions (?)

Who likes this?

2 people have marked this snippet as a favorite


Equidistant Objects with CSS

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

  1. <!--PASS: First on the left, float the rest right in equal size boxes
  3. 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:
  5. floatytechnqiue.png
  6. -->
  8. HTML:
  10. <img src="images/shape-red.png">
  11. <div id="movers-row">
  12. <div><img src="images/shape-green.png"></div>
  13. <div><img src="images/shape-yellow.png"></div>
  14. <div><img src="images/shape-blue.png"></div>
  15. </div>
  17. CSS:
  19. #movers-row {
  20. margin: -120px 0 0 120px;
  21. }
  22. #movers-row div {
  23. width: 33.3%;
  24. float: left;
  25. }
  26. #movers-row div img {
  27. float: right;
  28. }

Report this snippet  


RSS Icon Subscribe to comments
Posted By: Jacky888 on July 18, 2018

z836bl root bestandroidtoroot

You need to login to post a comment.