6 even spaced elements across the page using calc() for sizing


/ Published in: CSS

The CSS calc() function can be used anywhere a length, frequency, angle, time, number, or integer is required. It can be used to apply values for width/height; font-size; margins; padding; borders; shadows; border radius; text-indent;top/right/bottom/left(for position); and any place that a number is required.


Copy this code and paste it in your HTML
  1. .formbox {
  2. width: calc(100% / 6 - 1px); /* 1px slack is required as workaround for IE sizing bug */
  3. float:left;
  4. text-align:center;
  5. }

URL: http://coboldinosaur.com/pages/css-calc-function.html

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.