Mobile app version of vmapp.org
Login or Join
Candy875

: Is px a good unit to use in css? When styling a website we have to deal with screen sizes and we normally size elements using px unit. I use bootstrap and there as well we have media queries

@Candy875

Posted in: #Css

When styling a website we have to deal with screen sizes and we normally size elements using px unit. I use bootstrap and there as well we have media queries to control at what screen size we should display or hide elements. One example is this

@media screen and (max-width: 480px) {
.logo {
font-size: 150px;
}
}


Now my doubt is whether px is a good unit to use. Here is my reasoning. Ideally we would like the website to look good on all devices of different sizes from small screen mobile phones to large desktops. The resolutions vary in all these devices and so will the pixel size. Here is my main concern. When we have varying pixel size then it doesn't make a lot of sense to use px as unit since we don't know how much that will scale the elements by. So, I appreciate any help in understanding better how to deal with the px unit when pixel sizes vary across devices.

10% popularity Vote Up Vote Down


Login to follow query

More posts by @Candy875

0 Comments

Sorted by latest first Latest Oldest Best

Back to top | Use Dark Theme