Ems are the size of the width of one m at the pixel size you use
Rem stands for relative em and scales.
You also don't realise the the technical name for the difference in pixels across devices and software is technically called the aspect ratio which you spent a long time arguing over with somebody else something which is very well know and even has a backronym.
The fact you didn't mention aspect ratio but said "(r)em" [is basically just pixel] is proved wrong by your own argument.
I do not have time to start a wars I am offering a way of increasing the readability of a unit of measurement people often badly eyeball. I agree there are very few use cases for pixels, but having a 10px variable in your root or body depending on style is extremely useaful
Edit apology you were just part of the two people who didn't really know what they were on about talking about the variation of pixels across devices I agree. There is a reason text is used in pixels I'll leave the evidence I haven't had my morning coffee up there for context. Please don't take offence
Aspect ratio can be the ratio between the width and height of a pixel, and that is not what I was talking about. How can you just throw the words "aspect ratio" into the conversation, imply it's what I'm talking about, only to explain yourself after I have stated I wasn't? Acting as if I should know, nay, being a complete know-it-all smug, implying I am mistaking at every chance.
I know what rem means, I know the difference between a hardware pixel and a software one. Their difference which I would call the pixel ratio, not a generic aspect ratio.
Like, especially this quote here:
The fact you didn't mention aspect ratio but said "(r)em" [is basically just pixel] is proved wrong by your own argument.
Because rem and em are relative I can't be assed to argue can't we all just hug it out and agree that so long as you test apps/pages across a variety of devices then you are probably doing things right if things look right.
I could get into an argument about critical css and payloads, but what is the point. I am a firm believer that there isn't a correct way to program, but there are bad habits. That said when you reach a level of understanding that you can create a responsive site in whatever medium you choose to use (I hate tailwind and bootstrap, and react but as an SEO I need to be a jack of all trades and a padawan of one. I also have to tip my hat to anybody involved in any of those projejcts -specially tailwind because if you are going to use css/js in html and then purging and a lightweight platform is better than npm i *).
Back on topic - does my point translate - knowing what ten pixels is means you can then use base ten to relatively scale things. I am sure that there are people out there who think this is a pointless piece of bloat that should be purged and killed with fire but I think it is great for readability.
I am a peaceful being, please don't let me be misunderstood.
I have never in my life used a CSS framework and never will. That stuff is made for people that cannot write CSS themselves and bloat, like jQuery is nowadays.
I find it funny that you send something as condescending as "apology you were just part of the two people who didn't really know what they were on about talking about" only to later say you're a peaceful being that doesn't want to be misunderstood.
Back to the topic. All you do is replace 24px with 2.4rem, 10px with 1rem and 1px with 0.1rem. It's not like I am asking you to clarify the purpose of the trick (again, all you do is complicate things), I am merely chiming in that that particular trick has NOTHING to do with avoiding CSS pixels, which is what this entire post is about...
So I do not even expect you to argue with me. Hell, everyone here EXPECTS each other to be hostile, it seems. I'm just trying to clarify that most people here think about relative units the wrong way.
Someone here mentioned using centimeters, for example; CSS pixels.
Then comes you, with rems; also just CSS pixels. OP is talking about avoiding CSS pixels. That, or fixed dimensions in general.
Is it so weird that I chime in?
Is it necessary for you to imply I don't know a detail at every turn?
Shouldn't you be asking questions back rather than imply?
Have you EVER had a nice discussion based on nothing but a back and forth of "you don't know this", "you don't understand me", without ever giving TANGIBLE arguments?
Yeah, me neither.
So grow up and talk like an adult, or just like that other guy here, make it about "attitude", one of which I believe YOURS isn't right.
ah yes I do - you have a permanent base ten route applicable to anything but wit easy scaling multiplications for fonts in EMs. If you were to read the edit I apologized a minute after I posted but my god you are continuing your foolish behaviors and time wasting. Further to this how the hell do you expect something to scale without a change in size of it's parent element. 'tis the definition of scaling squire.
Build a website which doesn't boil down to pixels, I dare ya, I double dare you
I am very sorry if you consider any part of my behavior "hostile". I don't believe this post is created for a hostile intention. I am not trying to avoid pixels, I am merely trying to state that using the px tool in css is not nessesarily the best option.
Didn't I say I did NOT expect you to explain it to me, because I don't care about the usefulness of your trick and I have never said that.
Let me explain one last time:
This post, I assume is about avoiding px because it is unknown what real-life scale comes from it.
You say you use rem
OP says "em is also an alternative to using pixels"
I say "Which is just the same as using pixels"
Look at my first response to you, I explicitly ask whether we are talking about using alternatives to pixels.
Look at my second, I clarify things and end with a question to clarify a quote (which is still gibberish when I look at it).
IDK man. I feel like you're not actually reading everything I say carefully.
I would like cooperation, and that require you to answer questions, directly, also.
I am always open to discussion, I am sorry If I did not read your posts carefully. I do admit, I am new to CSS, and em is an alternative to pixels. I do not deny that I might be wrong, but I think you can agree with me that using pixels isn't very mobile friendly.
I see you have a point, and I am relatively new to CSS, and trust me, writing a fake article with fake informations will not get me anything.
If you do, please come back some day explaining the pros and cons of every CSS measurement!
Nothing you said has been wrong, it's just that this post only goes "There are pixels, and then there are viewport units. Maybe use viewport units more often?"
This only leaves us with ambiguity. People could end up avoiding px at all costs, because of the lack of context that has been given.
Your example of a 100px by 100px box to a 30vw x 30vh box, changes next to everything:
The element goes from being a ratio of 1:1 to one of ?:?
The element shrinks and grows vertically when scrolling on mobile, because of vh
The first is of static size, the other is completely fluid
So,
Yes! You can and should mention using viewport units! They are amazing!
No! Nothing you in particular said is wrong!
But foregoing the explanation as to why you should do something, leaves the post impractical.
Think of a use-case, make up a good example, and post again. You'll see that when you actually explain things a bit in depth, people will be way more appreciative as a whole.
Why - you say you use pure CSS. I'll presume a preprocessor don't see any reason not to use scss,less or stylus -anyway theme migration static, generatiin the right way
nah i'm trying to get him to block me because I have already conceded. It's funny isn't it getting his knickers in such a twist because he thinks he is cleverer than everybody else however hasn't actually made a point related to your article or the comments
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I haven't spoken with 1 word about aspect ratios, but sure.
"Using em as an alternative to pixels" is using pixels under the hood.
ems are not an ALTERNATIVE to pixels, but something totally different.We are talking about avoiding fixed measurements and using viewport/percentage based stuff, right??
Ems are the size of the width of one m at the pixel size you use
Rem stands for relative em and scales.
You also don't realise the the technical name for the difference in pixels across devices and software is technically called the aspect ratio which you spent a long time arguing over with somebody else something which is very well know and even has a backronym.
The fact you didn't mention aspect ratio but said "(r)em" [is basically just pixel] is proved wrong by your own argument.
I do not have time to start a wars I am offering a way of increasing the readability of a unit of measurement people often badly eyeball. I agree there are very few use cases for pixels, but having a 10px variable in your root or body depending on style is extremely useaful
Edit apology you were just part of the two people who didn't really know what they were on about talking about the variation of pixels across devices I agree. There is a reason text is used in pixels I'll leave the evidence I haven't had my morning coffee up there for context. Please don't take offence
You imply I don't know a lot.
How come?
Aspect ratio can be the ratio between the width and height of a pixel, and that is not what I was talking about. How can you just throw the words "aspect ratio" into the conversation, imply it's what I'm talking about, only to explain yourself after I have stated I wasn't? Acting as if I should know, nay, being a complete know-it-all smug, implying I am mistaking at every chance.
I know what rem means, I know the difference between a hardware pixel and a software one. Their difference which I would call the pixel ratio, not a generic aspect ratio.
Like, especially this quote here:
The fact you didn't mention aspect ratio but said "(r)em" [is basically just pixel] is proved wrong by your own argument.
What do you even mean?
Because rem and em are relative I can't be assed to argue can't we all just hug it out and agree that so long as you test apps/pages across a variety of devices then you are probably doing things right if things look right.
I could get into an argument about critical css and payloads, but what is the point. I am a firm believer that there isn't a correct way to program, but there are bad habits. That said when you reach a level of understanding that you can create a responsive site in whatever medium you choose to use (I hate tailwind and bootstrap, and react but as an SEO I need to be a jack of all trades and a padawan of one. I also have to tip my hat to anybody involved in any of those projejcts -specially tailwind because if you are going to use css/js in html and then purging and a lightweight platform is better than npm i *).
Back on topic - does my point translate - knowing what ten pixels is means you can then use base ten to relatively scale things. I am sure that there are people out there who think this is a pointless piece of bloat that should be purged and killed with fire but I think it is great for readability.
I am a peaceful being, please don't let me be misunderstood.
I have never in my life used a CSS framework and never will. That stuff is made for people that cannot write CSS themselves and bloat, like jQuery is nowadays.
I find it funny that you send something as condescending as "apology you were just part of the two people who didn't really know what they were on about talking about" only to later say you're a peaceful being that doesn't want to be misunderstood.
Back to the topic. All you do is replace
24pxwith2.4rem,10pxwith1remand1pxwith0.1rem. It's not like I am asking you to clarify the purpose of the trick (again, all you do is complicate things), I am merely chiming in that that particular trick has NOTHING to do with avoiding CSS pixels, which is what this entire post is about...So I do not even expect you to argue with me. Hell, everyone here EXPECTS each other to be hostile, it seems. I'm just trying to clarify that most people here think about relative units the wrong way.
Someone here mentioned using centimeters, for example; CSS pixels.
Then comes you, with rems; also just CSS pixels.
OP is talking about avoiding CSS pixels. That, or fixed dimensions in general.
Is it so weird that I chime in?
Is it necessary for you to imply I don't know a detail at every turn?
Shouldn't you be asking questions back rather than imply?
Have you EVER had a nice discussion based on nothing but a back and forth of "you don't know this", "you don't understand me", without ever giving TANGIBLE arguments?
Yeah, me neither.
So grow up and talk like an adult, or just like that other guy here, make it about "attitude", one of which I believe YOURS isn't right.
Get me?
Do you?
ah yes I do - you have a permanent base ten route applicable to anything but wit easy scaling multiplications for fonts in EMs. If you were to read the edit I apologized a minute after I posted but my god you are continuing your foolish behaviors and time wasting. Further to this how the hell do you expect something to scale without a change in size of it's parent element. 'tis the definition of scaling squire.
Build a website which doesn't boil down to pixels, I dare ya, I double dare you
Get me?
Do you?
HAHAHA
I don't get it...
Neither do I bud
I am very sorry if you consider any part of my behavior "hostile". I don't believe this post is created for a hostile intention. I am not trying to avoid pixels, I am merely trying to state that using the px tool in css is not nessesarily the best option.
Didn't I say I did NOT expect you to explain it to me, because I don't care about the usefulness of your trick and I have never said that.
Let me explain one last time:
pxbecause it is unknown what real-life scale comes from it.remLook at my first response to you, I explicitly ask whether we are talking about using alternatives to pixels.
Look at my second, I clarify things and end with a question to clarify a quote (which is still gibberish when I look at it).
IDK man. I feel like you're not actually reading everything I say carefully.
I would like cooperation, and that require you to answer questions, directly, also.
I am always open to discussion, I am sorry If I did not read your posts carefully. I do admit, I am new to CSS, and em is an alternative to pixels. I do not deny that I might be wrong, but I think you can agree with me that using pixels isn't very mobile friendly.
I see you have a point, and I am relatively new to CSS, and trust me, writing a fake article with fake informations will not get me anything.
don't worry buddy the feeling is mutual
Blogger and Programmer, I was talking to optimisedu...
This is all getting way too cumbersome, lol
Let's just put it to rest
getting? I conceded 2 days ago LMAO
Gust Van De Wal, I'll delete this post tommorow ASAP.
If you do, please come back some day explaining the pros and cons of every CSS measurement!
Nothing you said has been wrong, it's just that this post only goes "There are pixels, and then there are viewport units. Maybe use viewport units more often?"
This only leaves us with ambiguity. People could end up avoiding
pxat all costs, because of the lack of context that has been given.Your example of a 100px by 100px box to a 30vw x 30vh box, changes next to everything:
So,
Yes! You can and should mention using viewport units! They are amazing!
No! Nothing you in particular said is wrong!
But foregoing the explanation as to why you should do something, leaves the post impractical.
Think of a use-case, make up a good example, and post again. You'll see that when you actually explain things a bit in depth, people will be way more appreciative as a whole.
Why - you say you use pure CSS. I'll presume a preprocessor don't see any reason not to use scss,less or stylus -anyway theme migration static, generatiin the right way
Good Point
Yeah.
nah i'm trying to get him to block me because I have already conceded. It's funny isn't it getting his knickers in such a twist because he thinks he is cleverer than everybody else however hasn't actually made a point related to your article or the comments