Feel free to borrow any code you like on this site for modification and use on your site. For support implementing just leave a comment for Cd&. You will also find Cd& providing answers and solutions on codingforums, Experts-Exchange, Digital Point, and other progressive Q/A sites where support is available. If there is a snippet you need for your web site, send a request to Cd&, and it might end up being made available on the site.

If you use code from coboldinosaur.com a link would be appreciated.

If you have code on your site that might help other developers, you could add a Borrow button and join the movement to make good open source code easily accessible to all developers.

Confused by various units in the same page? Pixels, points, percentage and ems are all in common use. There is also the stupid stuff that does not belong on a web page (cm, mm, in, pc, ch). The 3Ps and ems are all appropriate to use, but when they get mixed together it can be a challenge to visualize how the page is going to look at various resolutions; so below we have a little conversion table to help.

CSS Unit Conversion Table
(Based on a 12pt default font size)

Pixels

Points

Ems

Percent

8

6

0.5

50

9

7

0.55

55

10

7.5

0.625

62.5

11

8

0.7

70

12

9.6

0.75

75

13

10

0.8

80

14

10.5

0.875

87.5

15

11

0.95

95

16

12

1

100

17

13

1.05

105

18

13.5

1.125

112.5

19

14

1.2

120

20

14.5

1.25

125

21

15

1.3

130

22

16

1.4

140

23

17

1.45

145

24

18

1.5

150

26

20

1.6

160

32

24

2

200

38

29

2.35

235

48

29

3

300

Before you decide to use them all on a page, let's take a look at some best practices. These are my best practices. Some shops mandate where the unit types are to be used, and there are several approaches that are valid. The one thing that is backward is to have no consistent way to assign units of measure.

Where is it appropriate to use each:

px: Elements that must have fixed dimension and/or position; anything that will be modified in scripting.

pt: Avoid except where specific typography is required. Never use for positioning.

em: Handy for control of input widths or pages with a mix of font families. Caution: a lot of different fonts on a page is a sign of poor design in most cases.

Percentage: BEST way to do font size; a must in responsive flex design. Difficult to manage for positioning or in scripting where px is almost always a better choice.

I intentionally left out the new units vw and vh. These relate to the viewport whereas the other units relate to the page dimensions and there is no conversion possible. A vh is equal to 1/100 of the height of the viewport and a vw is equal to 1/100 of the width of the viewport. These newer units are very relevant for responsive presentation and as the browser support increases they will probably be used widely by progressive developers.

If you want to consider the stupid options (some have little or no support), the complete specifications for unit values in CSS3 can be found here.

Keep it simple. If you are doing a whole page with all fixed values and absolute positioning, you are not doing layout; you are drawing an image of a page. REALLY BAD DESIGN. It will shatter and crumble like glass as soon as you try to bend it or re-shape it.