How to use CSS3 to match horizontal and vertical screens
This article mainly introduces a simple method to use CSS3 to match horizontal and vertical screens. It mainly uses the newly added @media in CSS3. Friends who need it can refer to it.
Written in the same post In one CSS
1 2 3 4 5 6 |
|
Written separately in 2 CSSs
Vertical screen
1 |
|
Horizontal screen
1 |
|
Application Place
(1) Mobile phone WEB page element content is generally defined by percentages so that it can be displayed normally on devices with different resolutions. However, However, the screen resolution width and height of mobile devices are still very different. When the same page is turned over, the width of the element defined by the percentage may become very large, which will lose the beauty of the page. In this way, if orientation matching is used Depending on the flipped state of the screen, you can write different css to control the page style.
(2) For mobile WEB pages with background images, you can match the screen status according to the orientation and set different backgrounds.
(3) A slightly technical point: Some WEB pages with absolutely positioned elements position an element to the bottom of the page. When the screen is in portrait mode, it may be because the total page length is less than the screen height ( But greater than the screen width), it is correct to position the absolutely positioned element to the bottom. However, when the screen is flipped to landscape, because the page content height is greater than the screen height (that is, the screen width before flipping), the absolutely positioned element will Covering the page content will cause problems on the page. In this case, you can use orientation to match the screen status and adjust the css code.
About matching the horizontal and vertical screen status, you can also judge it through JS. Onorientationchange in JS is an event of window, and you can match the horizontal and vertical screen by listening to the event.
The above is the entire content of this article. I hope it will be helpful to everyone's study. For more related content, please pay attention to the PHP Chinese website!
Related recommendations:
CSS3 and jQuery implement the Hover effect that follows the mouse direction
##CSS table-layout attribute usage
The above is the detailed content of How to use CSS3 to match horizontal and vertical screens. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



How to achieve wave effect with pure CSS3? This article will introduce to you how to use SVG and CSS animation to create wave effects. I hope it will be helpful to you!

Xiaomi Mi 14 Ultra is a relatively new model on the market. I believe that many consumers who want to change their mobile phones are more concerned about this phone. In addition to the conventional parameter configuration, the appearance design of this phone is also quite good. Of course, some people will also want to know how to use Xiaomi Mi 14Ultra horizontally? , the editor of this site will introduce the relevant content to you in detail below. Come and take a look together! How to use Xiaomi Mi 14Ultra in landscape orientation? Open the phone settings: First, find and open the settings icon on the home screen of Xiaomi 14, which is usually a gear-shaped icon. Enter display settings: In the settings menu, find and click the "Display" option to enter the display settings page. Turn on automatic screen rotation: In the display settings page, go to

Xiaomi Mi 14 is a brand new model with very good performance. Many consumers have been paying attention to it before it was released. It has not disappointed everyone since its official launch. Xiaomi Mi 14 has many user-friendly functions and is very popular. It’s practical, but there are some steps that everyone doesn’t know how to operate. For example, how to set the vertical screen lock on Xiaomi Mi 14? How to set vertical screen lock on Xiaomi Mi 14? Find the Settings app on your home screen or in the app list and open it. Scroll down in the "Settings" interface to find and click the "Display" option. Step 2: In the "Display" interface, scroll down and find the "Auto-rotate screen" option and make sure it is turned off. After turning off "Auto-rotate screen", your Xiaomi Mi 14 will be locked in portrait mode. no matter how you

This article will show you how to use CSS to easily realize various weird-shaped buttons that appear frequently. I hope it will be helpful to you!

Two methods: 1. Using the display attribute, just add the "display:none;" style to the element. 2. Use the position and top attributes to set the absolute positioning of the element to hide the element. Just add the "position:absolute;top:-9999px;" style to the element.

Honor Magic6 is a newly released flagship model. This phone has very comprehensive functions and features. When using the phone, everyone will set the screen display mode in advance. Both vertical and horizontal screens can be set. So Honor How to set up horizontal screen on Magic6? Let’s take a look below! How to set up horizontal screen on Honor Magic 6? Method 1: Pull down from the top of the phone screen, and then click the [Auto-rotate] icon to turn it gray to turn off rotation and lock the vertical screen. If it turns blue, it turns on auto-rotate. Method 2: Open [Settings] on the Honor mobile phone desktop, continue to click to turn on [Display], and finally click to turn off the switch on the right side of [Auto-rotate]. The method of setting up the horizontal screen on the Honor Magic 6 phone is very simple.

1. Pull down from the upper corner of the screen, pull out the status bar, click [Orientation Lock], it turns gray, and turn the phone sideways to turn it into landscape mode. 2. Or open the phone settings and click Display. 3. Turn off the automatic rotation switch.

In CSS, you can use the border-image attribute to achieve a lace border. The border-image attribute can use images to create borders, that is, add a background image to the border. You only need to specify the background image as a lace style; the syntax "border-image: url (image path) offsets the image border width inward. Whether outset is repeated;".
