In browsers that better support CSS3, it is necessary to display the same image in different sizes proportionally at different sizes. First of all, we need to unify the units
Units should use em
Set different font size standards according to different widths
Set the background-size size, which is generally the same size as the background image. Unit em.
Set background-position
The following is part of the scss code
Take writing a mobile page as an example and set the text size
Set the size of the background image, the width and height are 486px * 389px. Here, use the custom method of scss to convert to em. Here, the maximum font size of 32 is used as the benchmark.
I wonder if the questioner is asking how to adapt the background image to the entire screen. If so, if you use background-size, you need to consider the compatibility issues under various browsers Fullscreen backgrounds with centered content
Or try using img as a background image
If you need a button that takes up both height and width, you can use a separate image. Write background-size:cover directly like this; pay attention to compatibility.
Generally speaking, sprites use a certain position. For example, your button is also a picture when it is hovered. At this time, just change the position.
It is best for the poster to try it himself.
In browsers that better support CSS3, it is necessary to display the same image in different sizes proportionally at different sizes. First of all, we need to unify the units
The following is part of the scss code
Take writing a mobile page as an example and set the text size
Set background image
When used specifically, the position is also set in em units, and the pte method automatically converts the position to em units.
I wonder if the questioner is asking how to adapt the background image to the entire screen. If so, if you use background-size, you need to consider the compatibility issues under various browsers
Fullscreen backgrounds with centered content
Or try using img as a background image
If you need a button that takes up both height and width, you can use a separate image. Write background-size:cover directly like this; pay attention to compatibility.
Generally speaking, sprites use a certain position. For example, your button is also a picture when it is hovered. At this time, just change the position.