Fixit – Measures

Avoiding pixel and absolute measures allows the browser to adapt content to fit the display, though there are exceptions to this rule (see below). This test checks for the use of absolulte and pixel measures where relative measures would be more appropriate

Using relative measures

You should try to use relative measures where possible. You can achieve this using measures such as em, ex, bolder, larger and thick.

e.g. Specify font size:

Correct: font-size: 1.5em;

Incorrect: font-size: 12px;



It is not always desirable to use relative measures. For instance, images may be tailored to fit particular displays. In this case it makes more sense to specify the dimension in pixels.

The intrinsic size of images must be specified as attributes of the img element and not as CSS properties!

There are also other situations where pixel measures might be more appropriate: margins, borders and padding are all examples of when you might want to use pixel measures instead.


Passing the test

This test checks your CSS properties as follows:

Any property which is not a padding, border or margin property, and which is not specified as a percentage, or using units em or ex will cause the test to fail.

You should therefore only use pixel measures where the property is not one of those mentioned above.



This test is based on a W3C mobileOK best practice. See for more details.

Leave a Reply

Exclusive tips, how-tos, news and comment

Receive monthly updates on the world of mobile dev.

Other Products

Market leading device intelligence for the web, app and MNO ecosystems
DeviceAtlas - Device Intelligence

Real-time identification of fraudulent and misrepresented traffic
DeviceAssure - Device Verification

A free tool for developers, designers and marketers to test website performance
mobiReady - Evaluate your websites’ mobile readiness

© 2024 DeviceAtlas Limited. All rights reserved.

This is a website of DeviceAtlas Limited, a private company limited by shares, incorporated and registered in the Republic of Ireland with registered number 398040 and registered office at 6th Floor, 2 Grand Canal Square, Dublin 2, Ireland