Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialGiovanni Dalla Rizza
10,637 Pointsem value when it isn't declared
What's the em's value when it isn't declared in the .body?
1 Answer
Erik Nuber
20,629 PointsAn em is equal to the currently specified point size.
The em unitβs value will be derived from whatever is actually inherited. If no font size is specified anywhere in the document, then the value of a single em unit will be equal to 16px, which is the default.
ex:
.myClass {
font-size: 20px;
width: 1em;
height: 2em;
}
Here the width will be 20px and the height will be 40px.
with nothing declared for a font-size all the way up to the document node
.myClass {
width: 1em;
height: 2em;
}
This would default to 16px and width would be 16px and height 32px.
Ben Schroeder
22,818 PointsBen Schroeder
22,818 PointsThe default is set by the browser/user. It won't always be 16px.
Erik Nuber
20,629 PointsErik Nuber
20,629 Points@ben you can verify this here. 16px is default if the user has not declared anything.
http://www.w3schools.com/css/css_font.asp
Giovanni Dalla Rizza
10,637 PointsGiovanni Dalla Rizza
10,637 Pointsthanks Erik