今天做一个页面时,一个p的width设置成70%,屏幕宽度是1366px,所以这个p宽度是956px左右,这没什么问题。但是当做自适应缩小屏幕时,p的宽度并不是屏幕的70%,这是怎么回事。
巴扎黑2017-04-17 13:32:18
I solved it myself. If Google Chrome does not add the meta name="viewport" tag to set it, there will be problems with the scaling ratio, but Firefox has no effect.
天蓬老师2017-04-17 13:32:18
The width percentage unit is calculated relative to the width of its parent element. When the parent element of this p is Body, it should be 70% of the browser window width
高洛峰2017-04-17 13:32:18
The screen has shrunk, and the 70% you set will be based on your current width * 70%, instead of the previous 956px