When dealing with mobile pages, we sometimes need to make the banner image into a square with the same width as the screen to obtain the best experience, such as Flipbord’s mobile page: So how should we use pure CSS to make an adaptive banner? What about the size of the square? Solution 1: CSS3 vw unit CSS3 adds a new set of length units vw, vh, vmin, vmax relative to the percentage of the visible area. where vw is the unit relative to the percentage of the viewport width, 1vw = 1% viewport width, vh is the unit relative to the percentage of the viewport height, 1vh = 1% viewport height; vmin is the smaller one relative to the current viewport width and height. Percentage unit, similarly vmax is the percentage unit that is larger than the current viewport width and height. The browser compatibility of this unit is as follows: Using the vw unit, we can easily make adaptive squares:
&a##1. Detailed introduction about mobile pages
#Introduction: When dealing with mobile pages, we sometimes It may be necessary to make the banner image into a square with the same width as the screen to obtain the best experience, such as Flipbord's mobile page: So how to use pure CSS to create a square that can adapt to the size? Solution 1: CSS3 vw unit CSS3 adds a new set of length units vw, vh, vmin, vmax relative to the percentage of the visible area. where vw is the unit relative to the percentage of the viewport width, 1vw = 1% viewport width...
2.
Recommended 10 articles about vw units
Introduction: When dealing with mobile pages, we sometimes need to make the banner image into a square with the same width as the screen to obtain the best experience, such as Flipbord’s mobile page: Then How to use pure CSS to create a square that can adapt to its size? Solution 1: CSS3 vw unit CSS3 adds a new set of length units vw, vh, vmin, vmax relative to the percentage of the visible area. where vw is the unit relative to the percentage of the viewport width, 1vw = 1% viewport width...3.
Detailed introduction to the height attribute
Introduction: CSS height refers to the corresponding p height set through CSS styles. The CSS height attribute is the word height, and the width width can be set to Calculate the height as a percentage, set the height as a pixel value, set the height in relative length units, and so on. This attribute is supported by all major browsers. The following will summarize the use of the height attribute. 1. Use CSS to solve the highly adaptive problem. I am very resistant to using js to solve the highly adaptive problem, because it is not easy to maintain and not natural enough. However, it is not easy to use pure CSS, such as the example I will talk about below. Requirements: 1. ...
4.
Summary of how to use the height attribute height in css
Introduction: CSS height refers to the corresponding p height set through CSS styles. The CSS height attribute is the word height. The width width can be set to calculate the height as a percentage, set the height as a pixel value, Set height in relative length units and so on. This attribute is supported by all major browsers. The following is a summary of how to use the height attribute. 1. Use CSS to solve highly adaptive problems. I am very resistant to using js to solve highly adaptive problems, because it is difficult to maintain and not natural enough. However, using pure CSS is not easy, such as the example I will talk about below.
5.
Summary of how to use the width attribute width in css
Introduction: CSS width refers to setting the corresponding div width through CSS style. The CSS width attribute is the word width. The width width can be set to calculate the width as a percentage, set the width as a pixel value, or set the width as a relative length unit. etc. This attribute is supported by all major browsers.
6.
Summary of the three common length units in css (px em rem)
#Introduction: The following is a summary of the common html units in web pages, and an introduction to length units in css+div layout. Personally, I think that the disadvantage of using px as the font unit and not being able to use the browser font scaling function under IE is no longer that important. Because the new versions of IE7 and IE8 already support the zoom function of the entire web page, including Firefox, which zooms the entire web page by default instead of scaling CSS fonts. Is there any significance in not simply scaling the font size? 7. css margin margin properties and usage summary ##Introduction: The white space surrounding the border of an element is the margin. Setting margins creates additional "white space" outside the element. The simplest way to set margins is to use the margin property. The margin property accepts any length unit, which can be pixels, inches, millimeters or ems, percentage values or even negative values. This article will talk about the margin property and how to use it in detail. 8. Detailed explanation of the use of CSS margin attributes ##Introduction: The simplest way to set margins is to use the margin attribute. The margin property accepts any length unit, which can be pixels, inches, millimeters, or ems. margin can be set to auto. A more common approach is to set a length value for the margins. The following declaration sets 1/4-inch margin on all sides of the h1 element: 9. Details of length units in CSS Introduction: The following editor will bring you an old cliché about the length unit in CSS. The editor thinks it is quite good, so I will share it with you now and give it as a reference. Let’s follow the editor and take a look 10. php uses mb_substr() to solve the problem of Chinese string interception and garbled characters Introduction: PHP comes with several string interception functions, among which substr and mb_substr are commonly used. When the former processes Chinese, GBK is 2 length units and UTF is 3 length units. After the latter specifies encoding, one Chinese character is 1 length unit.
The above is the detailed content of 10 recommended articles about length units. For more information, please follow other related articles on the PHP Chinese website!