Hot Koehls
  • Email
  • Feedburner
  • Linkedin
  • Twitter
  • Home
  • About
  • Archives
  • Contact
  • Software
    • S3imple Backup
    • Twitter Feed Archiver
    • FileTime
    • Flickr API Demo
Search
Home» For everyone » And a Dim Bulb Brightens…

And a Dim Bulb Brightens…

Posted by Frank - March 28, 2008 - For everyone, For techies
3

Though developer by trade, I think I can talk CSS fairly intelligently with any hardcore designer. But the one thing that always eluded me a bit was the “em” sizing element. I could never find a definitive description of just how the hell they actually worked.

Today I put that one to bed, thanks a straightforward article on A List Apart…

Working from a default of 16px, the following styles should give the desired text sizes:

.bodytext p {
      font-size:0.875em; /* 16x.875=14 */

}.sidenote {
      font-size:0.75em; /* 16x0.75=12 */

}

If you want to work with em’s, your sizes are all relative to 16 pixels. Simply multiply the size by 16 to get the actual display size.

Be sure to convey your “Well, duh!” reactions in the comments.

Update: When it rains it pours. Playing with my newfound logic, I’ve also learned that you can adjust what an em is relative to based on different font-size definitions in nested page elements. Take this simple example…

<div style="font-size:0.5em" />
  <div style="font-size:1.5em" />
    What size is this?
  </div>
</div>

The text in between the two div tags will actually work out to be 0.75em (0.5 x 1.5 = 0.75), which is equal to a pixel size of 12 (see quote above). Now I gotta learn to play carefully with these things…

css

3 comments on “And a Dim Bulb Brightens…”

  1. Matthew Apsokardu says:
    March 31, 2008 at 2:28 pm

    Hey, nice blue focus boxes you got there.

  2. BMorse says:
    March 31, 2008 at 2:47 pm

    “Though designer by trade…”
    I think you meant to say “developer”. Other than that great post.

  3. Frank says:
    April 11, 2008 at 11:46 am

    Alright, fixed the typo. I definitely don’t want to be associated with *you* people. ;-)

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Categories

  • For entrepreneurs
  • For everyone
  • For techies

Latest Tweets

  • The word traps planners plan themselves into | Life. Then strategy http://t.co/iANAdASb
    May 8, 2012 - 2:43 pm
  • Random network security tip for those about to appear on TV - Boing Boing http://t.co/tC1lXFQ4
    May 8, 2012 - 1:42 pm
  • A Picture http://t.co/H846Uy69
    April 27, 2012 - 12:25 pm
  • The Broken "Buy-One, Give-One" Model: 3 Ways to Save Toms Shoes | Co.Exist: World changing ideas and innovation http://t.co/RI0sVMW6
    April 10, 2012 - 12:23 pm

Recent Comments

  • whiz on What 255 characters looks like
  • Andrew on Find the second (or third, or fourth) occurence in a string
  • IanArcher on Get number of message parts in an email using PHP
  • Usama on Remove parent directories from tar archives
  • Frank on It’s dangerous to go alone

Recent Posts

  • It’s dangerous to go alone
  • Create Self-Signed Wildcard SSL Certificate
  • What comes after the yottabyte?
  • Write code like they do in Hollywood
  • Brian Rolle machine gun celebration
(c) 2012 Frank Koehl. All Rights Reserved.
  • Contact Us
  • Sitemap