开发者

Resolution-related buttons/elements - howto?

开发者 https://www.devze.com 2023-04-12 13:35 出处:网络
I need to place some graphic elements in a div that is supposed to be seen on various screens with different resolutions (for example, mobile screens). Just for example, some开发者_高级运维thing simil

I need to place some graphic elements in a div that is supposed to be seen on various screens with different resolutions (for example, mobile screens). Just for example, some开发者_高级运维thing similar to the "X" button that closes an overlay window. I might think of several options to implement it:

  1. Have several JPEGs (one for each resolution) and select them in JavaScript
  2. Render the graphics (it is simple) using HTML5 features
  3. Any CSS support probably?
  4. Anything else?

It would be great to have any kind of advice/well-known practice, so I won't reinvent the wheel.


css rule:

img {
  width: 100%;
}

no? And use @media rule:

@media only screen and (min-width: 768px) and (max-width: 991px) {
    div {
      width: 100px;
    }
}
0

精彩评论

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

关注公众号