Jump to content

Questions about CSS


Gallen88

Recommended Posts

I'm learning everything about CSS that i can but i do have a couple of things and concepts that i don't quite understand. EM and EX measurement - What does this stand for and how is it different from PX? Does it make a difference which one i use?Absolute Sizes- I don't fully understand or grasp this concept as far as its positioningInherit- when you use this in the declaration block, what does the selector inhert?That's all the questions that i can think of for now. Thanks in advance

Link to comment
Share on other sites

em and ex are relative font sizes. They vary depending on the size of the parent font. For most browsers, a default em value is 16px (at first), I don't know the value of ex because I haven't looked much into it; it's supposed to be the width of the letter X in the current font.In this example, each <div> will have larger text in it:

<div style="font-size: 1.2em">  Text  <div style="font-size: 1.2em">    Text    <div style="font-size: 1.2em">    Text    </div>  </div></div>

Absolute just means that the value of the element will always be the same independently of whatever the ancestor elements had.Inherit is just the default value: It means that it will use whatever absolute size the parent element had.

Link to comment
Share on other sites

Ingolme wrote faster than I did, but there's no harm in getting it said a different way. :)em and ex sizes refer to the size of the current font (specifically, the size of the "m" and "x" characters). If the font-size is big, ems and exes are big. We call these relative or proportional sizes, since they change with the context. A px, in contrast, is always the same size.Pixels are an absolute measurement. An element with a 10px margin-left is always 10px away from the element to its left, no matter how big the window is or how big the font is. I tend to use pixels most of the time.inherit is not a selector; it's a value that certain properties can take. It means that an element should inherit the property- value from its parent element (the element that surrounds/encloses it). This is useful, for example, if you want every element contained by a div to have the same font-size. You could give all those elements the same font-size value in pixels, but if you ever changed your mind, you'd have to update every rule. If you use inherit, you only have to update the rule for the parent element, and all the other elements will automatically be updated. I personally don't use inherit very often.

Link to comment
Share on other sites

I have a couple of books im using and the one that i am currently using has me using EM as the width of the sidebar.
That just means that if the user changes his/her font or zooms in/out on your page, the sidebar will adjust its width accordingly. This is useful from a readability/accessibility standpoint.
Link to comment
Share on other sites

This slideshow has a great explanation of inheritance, what inherits, what does not and whyhttp://www.maxdesign.com.au/articles/css-inheritance/relevant to font sizing and good to understand, line heighthttp://www.maxdesign.com.au/articles/css-line-height/Below is some more stuff from the same people which may not be as directly related but a good source to bookmark, it is usually very thorough and clearrelative font sizeshttp://www.maxdesign.com.au/articles/relative/more good stuff to choose fromhttp://www.maxdesign.com.au/articles/some more general stuff by the same people at a different sitehttp://www.maxdesign.com.au/css/

I'm learning everything about CSS that i can but i do have a couple of things and concepts that i don't quite understand. EM and EX measurement - What does this stand for and how is it different from PX? Does it make a difference which one i use?Absolute Sizes- I don't fully understand or grasp this concept as far as its positioningInherit- when you use this in the declaration block, what does the selector inhert?That's all the questions that i can think of for now. Thanks in advance
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...