


How to solve the problem of interface misalignment caused by height adjustment in adaptive design?
Cleverly solve the problem of height adjustment in adaptive design
In responsive design, height adjustment often causes interface dislocation problems. Especially when the design draft size (such as 1920x1080 pixels) does not match the browser's actual visual height, how to maintain the integrity of the interface layout is crucial.
For example, when using rem units for layout, the set body
font size is 100px, a div
height is 1rem, and the expected height is 100px. However, the toolbar on the top of the browser will occupy part of the height, resulting in the actual visible height being less than the design draft height, and eventually there will be misalignment.
An improvement is provided below. The existing adaptive code is mainly implemented by adjusting body
's font-size
, and the code is as follows:
export const selfAdapter = () => { //Page initialization, for page sizes that are not 1920*1080 on the screen, designSize = 1920; // Design drawing size let html = document.documentElement; let wW = html.clientWidth; // window width let rem = (wW * 100) / designSize; document.documentElement.style.fontSize = rem "px"; const resize = () => { let designSize = 1920; // Design drawing size let html = document.documentElement; let wW = html.clientWidth; // window width let rem = (wW * 100) / designSize; document.documentElement.style.fontSize = rem "px"; }; window.addEventListener("resize", resize, false); };
This code only calculates the rem
value based on the window width, ignoring the impact of height changes. The key to the improvement is to adjust the basis for calculating rem
value to the window height or the visible height. By monitoring the window height changes, the rem
value is dynamically adjusted, so as to more accurately match the actual visible area height and avoid interface misalignment. Consider using window.innerHeight
to get the visual height of the browser window and use it for the calculation of rem
values.
The above is the detailed content of How to solve the problem of interface misalignment caused by height adjustment in adaptive design?. 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



The readdir function in the Debian system is a system call used to read directory contents and is often used in C programming. This article will explain how to integrate readdir with other tools to enhance its functionality. Method 1: Combining C language program and pipeline First, write a C program to call the readdir function and output the result: #include#include#include#includeintmain(intargc,char*argv[]){DIR*dir;structdirent*entry;if(argc!=2){

This article discusses how to improve Hadoop data processing efficiency on Debian systems. Optimization strategies cover hardware upgrades, operating system parameter adjustments, Hadoop configuration modifications, and the use of efficient algorithms and tools. 1. Hardware resource strengthening ensures that all nodes have consistent hardware configurations, especially paying attention to CPU, memory and network equipment performance. Choosing high-performance hardware components is essential to improve overall processing speed. 2. Operating system tunes file descriptors and network connections: Modify the /etc/security/limits.conf file to increase the upper limit of file descriptors and network connections allowed to be opened at the same time by the system. JVM parameter adjustment: Adjust in hadoop-env.sh file

The steps to install an SSL certificate on the Debian mail server are as follows: 1. Install the OpenSSL toolkit First, make sure that the OpenSSL toolkit is already installed on your system. If not installed, you can use the following command to install: sudoapt-getupdatesudoapt-getinstallopenssl2. Generate private key and certificate request Next, use OpenSSL to generate a 2048-bit RSA private key and a certificate request (CSR): openss

Website performance optimization is inseparable from in-depth analysis of access logs. Nginx log records the detailed information of users visiting the website. Cleverly using this data can effectively improve the speed of the website. This article will introduce several website performance optimization methods based on Nginx logs. 1. User behavior analysis and optimization. By analyzing the Nginx log, we can gain a deep understanding of user behavior and make targeted optimization based on this: High-frequency access IP identification: Find the IP address with the highest access frequency, and optimize the server resource configuration for these IP addresses, such as increasing bandwidth or improving the response speed of specific content. Status code analysis: analyze the frequency of different HTTP status codes (such as 404 errors), find out problems in website navigation or content management, and proceed

Upgrading the Zookeeper version on Debian system can follow the steps below: 1. Backing up the existing configuration and data Before any upgrade, it is strongly recommended to back up the existing Zookeeper configuration files and data directories. sudocp-r/var/lib/zookeeper/var/lib/zookeeper_backupsudocp/etc/zookeeper/conf/zoo.cfg/etc/zookeeper/conf/zookeeper/z

In Debian systems, OpenSSL is an important library for encryption, decryption and certificate management. To prevent a man-in-the-middle attack (MITM), the following measures can be taken: Use HTTPS: Ensure that all network requests use the HTTPS protocol instead of HTTP. HTTPS uses TLS (Transport Layer Security Protocol) to encrypt communication data to ensure that the data is not stolen or tampered during transmission. Verify server certificate: Manually verify the server certificate on the client to ensure it is trustworthy. The server can be manually verified through the delegate method of URLSession

Managing Hadoop logs on Debian, you can follow the following steps and best practices: Log Aggregation Enable log aggregation: Set yarn.log-aggregation-enable to true in the yarn-site.xml file to enable log aggregation. Configure log retention policy: Set yarn.log-aggregation.retain-seconds to define the retention time of the log, such as 172800 seconds (2 days). Specify log storage path: via yarn.n

Apache server is a powerful web server software that acts as a bridge between browsers and website servers. 1. It handles HTTP requests and returns web page content based on requests; 2. Modular design allows extended functions, such as support for SSL encryption and dynamic web pages; 3. Configuration files (such as virtual host configurations) need to be carefully set to avoid security vulnerabilities, and optimize performance parameters, such as thread count and timeout time, in order to build high-performance and secure web applications.
