Prevent that a fixed element resizes when zooming on touchscreen

前端 未结 3 1656
萌比男神i
萌比男神i 2020-11-27 15:38

On an HTML website, you have a fixed element like this:

Some content

It has this

3条回答
  •  [愿得一人]
    2020-11-27 16:10

    You're missing a width attribute and you can use things like max-width and max-height to help keep the box the size you wanted. However, zooming allows the user to get pretty granular with a page, so there's always going to be a chance they have that issue.

    #fixed { height:150px; width: 200px; max-width: 200px; max-height: 150px; position:fixed; top:0; left:0; z-index:10000; }
    

提交回复
热议问题