开发者

HTML/CSS: Making width consistent across multiple resolutions

开发者 https://www.devze.com 2022-12-26 15:47 出处:网络
I have some squares s of size 15px rendered开发者_C百科 on a page. Their absolute size varies based on the screen resolution - so on very large resolutions, these end up looking much smaller than I wa

I have some squares s of size 15px rendered开发者_C百科 on a page. Their absolute size varies based on the screen resolution - so on very large resolutions, these end up looking much smaller than I want them to be.

How do I define the width in CSS to make sure they are more or less proportionate across all the different resolutions?


You can use percentages.

  width:20%

this way the width is a percentage of the screen size regardless of resolution.


Read about CSS Units. You need to use relative unit, such as: em or ex. Percentage is always a good way to go, but sometimes it’s hard to 'bind it' to the font size.

0

精彩评论

暂无评论...
验证码 换一张
取 消