: 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
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.
More posts by @Candy875
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2025 All Rights reserved.