Why you should not use pixels(px) in CSS

Did somebody ever let you know to code like this?

one thing{
   width: 100px;
   top: 100px;

I can let you know straight on, until utterly needed, don’t code like that.

In a hypothetical scenario, I may be a person with a cellphone that doesn’t have a width of 100px, guess what occurs then? The hypothetical person get’s an unsightly wanting facet scrolling bar. Even worse, the person may not get among the content material!

A suggestion

A greater method is to make use of view top(vh). Which principally shows content material primarily based on the display screen measurement.

Right here is one other model of the code written beforehand.

one thing{
   width: 30vw;
   top: 30vh;

Now for a person with a tool of a top of 300px, the person could be proven an object of 100px.

Add a Comment

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