-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using em instead of px #4
Comments
I wouldn't remove px in favor of em, but keep them both. Like .gt300px and .gt300em and possibly .gt300pct (percent). |
@davebakker would be even better, of course! ;-) |
The width could be calculated like this:
|
+1 for addition of ems. |
EMS, like percentages are relative. What would these EMS be relative to? |
@kumailht Relative to the targeted element? (In case of em's) |
The only reason to use responsive elements is so your elements can adapt to its parent. I don't see how EMs or percentages could even work. Maybe I'm missing something here but I am having a hard time visualizing a real world use case. |
When the parent element is assigned a percentage width (as opposed to a px or em width), we may not know what it's actual width will be. If we already use ems for our standard media queries, being able to use ems for the "element media query" would be a more natural fit. Plus the parent's ems value takes into account the user's browser's text-zoom setting. I haven't used "element media queries" before, so I haven't followed this through and tested, but as far as I can think using ems would be practical in the same way that using them for standard media queries would be. |
+1 with @DavidOliver |
Start using So define a base font size on the body as 16px or whatever, then all |
@josephspens To quote @simurai 's great Sizing (Web) components post:
Considering we're talking here about responsive elements, using units that let us change elements individualy seems the way to go. |
@nhoizey I'm not sure I follow... by changing the root font-size everything on the site will scale regardless of using Let's say you want to scale the entire site x2, with What finer control do you want? If you want to only scale the component, change the component's root font-size from 1rem to 1.2rem, an so on. |
I think we misunderstood each other, what I was advocating for was setting a component's root font-size using For example:
|
@josephspens OK, I know understand… ;-) I thought you wanted to put You just have to chose very carefully the elements on which you use However, when using |
@nhoizey Ah, I see what you mean! rem is unavailable to legacy IE... so can we agree |
@josephspens I agree for most projects, yes. Some may still require components that scale depending on their parents, but I think it's not the most frequent use. |
This is a great project, we indeed need elements based Responsive Design, but it would IMHO be better with em units.
Here's why: http://blog.cloudfour.com/the-ems-have-it-proportional-media-queries-ftw/
The text was updated successfully, but these errors were encountered: