Loading...

Mind Health

It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using ‘Content here, content here’, making it look like readable English.

One of the hottest debates over the last few years is the choice of CSS units for sizing elements. Should you stick to PX, go for EM, or embrace the flexibility of REM? Understanding the subtle differences of each unit is crucial in building responsive, accessible, and user-friendly websites.

In this post, we’ll delve into the merits and limitations of PX, EM and REM in CSS, shedding light on best practices for their use and what we recommend using.

H2 Pixels

Pixels, often seen as “px”, represent the underlying unit of measurement in CSS, directly correlating to the pixel count on a screen. This correlation offers web designers precise control over the layout and appearance of web elements so that they appear exactly as designed on devices with a specific resolution.

Despite how precise pixels are, their rigidity poses challenges for responsive and adaptive web design. As websites are viewed on so many types of devices today, from high-resolution monitors to compact mobile screens, the fixed nature of pixels can hinder the seamless breakdown of a website layout across different viewport sizes.

Also, the reliance on pixels as a unit of measurement has notable limitations with user accessibility. Individuals with visual impairments, for example, frequently adjust browser settings to increase text size for better readability. Dimensions that use pixels won’t account for these adjustments, potentially leading to a poor user experience. Elements sized in pixels may not scale properly, and that will prevent those users who rely on modified text sizes from having a comfortable browsing experience. This accessibility challenge highlights the importance of considering alternative units that offer greater flexibility.

H2 Accessibility

Acknowledging the strengths and limitations of pixels encourages a more inclusive and adaptable design strategy, prioritising both aesthetic integrity and user-centric adaptability.

Treating end users with respect involves avoiding the use of pixel-based font sizes, element sizes, and spacing. It’s important to note that most web browsers allow users to adjust their default font size to a size other than 16px. Therefore, all font sizes should scale based on the user’s chosen font size, such as 20px. Unfortunately, when a website sets font sizes explicitly in pixels, headings remain fixed, regardless of the user’s preference. While this might appeal to a web design agency like ours, which is design led, it neglects the needs of the user, which should always be the primary consideration when building websites.

Users with visual impairments may need to increase text size for readability. If a website’s font size is set in pixels, users who increase their default browser font size may not see the expected adjustments, making the content hard or impossible to read.

H3 User Experience

Different users have different preferences and requirements. Some may find smaller fonts more comfortable to read, while others may prefer larger text. Allowing the text to scale according to the user’s settings ensures a better and more personalized user experience.

Image courtesy of Jasmin Chew via Pexels

H3 Alternative Units for Better Scalability

We’ll cover alternative units in more detail below, but ditching Pixels for other units will create better scalability for your users:

EM and REM: These are relative units. EM is relative to the font size of its direct or nearest parent, while REM is relative to the root html element. This makes it easier to adjust site-wide font sizes by changing the root element’s font size.We’ll cover alternative units in more detail below, but ditching Pixels for other units will create better scalability for your users:

Viewport units (VW/VH): These units are relative to the viewport size. They can be used to make font sizes responsive without media queries, though they should be used judiciously as too much dependency on viewport size can lead to extreme sizes on very small or large screens.

Percentage (%): Similarly to em and rem, percentage is a relative unit. Setting font sizes in percentages allows the size to scale based on a parent element’s font size.

H4 Implementing a Respectful Design

When developing or designing a website, it’s essential to:

  • Test the site with different font sizes and screen resolutions.
  • Use relative units instead of absolute units for font sizes, spacing, and layout dimensions.
  • Incorporate accessibility features and test them with screen readers and other accessibility tools.
  • Always keep the end-user in mind, acknowledging that a diverse audience with different needs and preferences will use a website.

Adopting these practices ensures not only a more accessible and user-friendly website but also demonstrates respect for the diversity of users on the internet, promoting a more inclusive web experience.

H2 What About Media Queries?

Acknowledging the strengths and limitations of pixels encourages a more inclusive and adaptable design strategy, prioritising both aesthetic integrity and user-centric adaptability.

Treating end users with respect involves avoiding the use of pixel-based font sizes, element sizes, and spacing. It’s important to note that most web browsers allow users to adjust their default font size to a size other than 16px. Therefore, all font sizes should scale based on the user’s chosen font size, such as 20px. Unfortunately, when a website sets font sizes explicitly in pixels, headings remain fixed, regardless of the user’s preference. While this might appeal to a web design agency like ours, which is design led, it neglects the needs of the user, which should always be the primary consideration when building websites.

Users with visual impairments may need to increase text size for readability. If a website’s font size is set in pixels, users who increase their default browser font size may not see the expected adjustments, making the content hard or impossible to read.

Download Free Guide: How to Get QPR Certified

Learn how this certification can boost your remote mental health career opportunities.

Subscription Form

Join 400k job seekers getting weekly alerts... arow