How does using 'em' help me in css?

This question already has an answer here:

  • Why em instead of px? 15 answers

I've heard that using 'em' for font size is recommended. I've tried it, but I really don't see any advantage of it. Actually, all of my co-workers were confused.

I've read few articles over the internet about %, em, and px. All of them suggested em, but I really don't understand it. Yes, I can change all the font size at once by using that it?

I've tried several smartphones and all of them displayed 'px' without a problem...

Someone please guide me!


-------------Problems Reply------------

The font unit em allows you to display font size ( as well as other element's size , e.g. images ) based on browser's configuration.

You can still use px as font unit, but 14px browser on mobile is different than 14px on desktop browser.

Category:font size Views:0 Time:2011-10-12
Tags: font size

Related post

  • Setting a div's height in HTML with CSS 2008-08-07

    I am a CSS newbie trying to layout a table-like page with two columns. I want the rightmost column to dock to the right of the page, and this column should have a distinct background color. The content in the right side is almost always going to be s

  • How to set up a CSS switcher 2008-08-07

    I'm working on a website which will switch to a new style on a set date. The site's built in semantic HTML and CSS, so the change should just require a CSS reference change. I'm working with a designer who will need to be able to see how it's looking

  • Is there a business reason for striving for pure CSS layout? 2008-08-07

    It seems like every time I try to create a pure CSS layout it takes me much longer than if I'd use a table or two. Getting three columns to be equal lengths with different amounts of data seems to require particular fancy hacks, especially when deali

  • What is the best way to create rounded corners using CSS? 2008-08-10

    What is the best way to create rounded corners using CSS? --------------Solutions------------- Since CSS3 was introduced, the best way to add rounded corners using CSS is by using the border-radius property. You can read the spec on the property, or

  • How important is W3C XHTML/CSS validation when finalizing work? 2008-08-11

    Even though I always strive for complete validation these days, I often wonder if it's a waste of time. If the code runs and it looks the same in all browsers (I use to verify) then do I need to take it any further or am I just being

  • IE7 HTML/CSS margin-bottom bug 2008-08-18

    Here is the scenario: I have a table with a margin-bottom of 19px. Below that I have a form that contains some fieldsets. One of them is floated right. The problem is that the margin-bottom is not getting the full 19px in IE7. I've gone through all o

  • Tool for generating CSS skeleton? 2008-08-19

    My HTML is all marked up, ready to make it rain CSS. The problem is that I have to go back and find out what all my id and class names are so I can get started. What I need is a tool that parses my HTML and spits out a stylesheet with all the possibl

  • Best way to fix CSS/JS drop-down in IE7 when page includes Google Map 2008-08-21

    I have a page using <ul> lists for navigation (Javascript changes the styling to display or not on mouseover). This is working fine for me except in IE6 and IE7 when I have a Google Map on the page. In this case the drop-down simply does not wo

  • What's the best way to go from a Photoshop mockup to semantic HTML and CSS? 2008-08-21

    I generally use a manual process: Look at the page, figure out the semantic elements, and build the HTML Slice up the images I think I'll need Start writing CSS Tweak and repeat different steps as necessary Got a better approach, or a tool? ---------

  • ASP.NET gzip compression corrupting CSS 2008-08-22

    I have an ASP.NET webforms application (3.5 SP1) that I'm working on, and attempting to enable gzip fpr HTML and CSS that comes down the pipe. I'm using this implementation (and tried a few others that hook into Application_BeginRequest), and it seem

  • 100% Min Height CSS layout 2008-08-24

    What's the best way to make an element of 100% minimum height across a wide range of browsers ? In particular if you have a layout with a header and footer of fixed height how do you make the middle content part fill 100% of the space in between with

  • Abstraction away from CSS 2008-08-24

    Let me make something quite clear. I. Hate. CSS. It is a never-ending nightmare. Every minor layout change feels like a hack. Solutions to problems seem to often involve jiggering numbers around like some chef trying to work out exactly how much nutm

  • Is there a library for rendering basic flow diagrams in Javascript/CSS? 2008-08-26

    On a web page I want to dynamically render very basic flow diagrams, i.e. a few boxes joined by lines. Ideally the user could then click on one of these boxes (DIVs?) and be taken to a different page. Resorting to Flash seems like an overkill. Is any

  • Avoiding repeated constants in CSS 2008-08-27

    Are there any useful techniques for reducing the repetition of constants in a CSS file? (For example, a bunch of different selectors which should all apply the same colour, or the same font size)? --------------Solutions------------- Elements can bel

  • Browsers' default CSS stylesheets 2008-08-28

    Are there any lists of default CSS stylesheets for different browsers? (browser stylesheets in tabular form) I want to know the default font of text areas across all browsers for future reference. --------------Solutions------------- Not tabular, but

  • IE CSS Bug - How do I maintain a position:absolute when dynamic javascript content on the page changes 2008-08-29

    I have a page where there is a column and a content div, somewhat like this: <div id="container"> <div id="content">blahblahblah</div> <div id="column"> </div> </div> With some styling I have an image that is split

  • How to make user controls know about css classes in ASP.NET 2008-08-29

    Since there are no header sections for user controls in, user controls have no way of knowing about stylesheet files. So css classes in the user controls are not recognized by visual studio and produces warnings. How can I make a user control

  • What is a good online resource for css 'design patterns'? 2008-08-30

    Can anyone out there recommend a good online resource for CSS 'design patterns'? I know design patterns in a software context usually refer to OO based design patterns, but I mean design patterns in the broader sense of the term: i.e. common, clean s

  • On a two-column page, how can I grow the left div to the same height of the right div using CSS or Javascript? 2008-08-30

    I'm trying to make a two-column page using a div-based layout (no tables please!). Problem is, I can't grow the left div to match the height of the right one. My right div typically has a lot of content. Here's a paired down example of my template to

  • IE 6 CSS Hover non Anchor Tag 2008-08-31

    What is the simplest and most elegant way to simulate the hover pseudo-class for non-Anchor tags in IE6? I am specifically trying to change the cursor in this instance to that of a pointer. --------------Solutions------------- I would say that the si

Copyright (C), All Rights Reserved.

processed in 0.278 (s). 11 q(s)