Home Web Front-end CSS Tutorial Summary of content related to mobile h5 development css

Summary of content related to mobile h5 development css

May 28, 2017 am 10:55 AM
Mobile terminal

1. Develop mobile terminal, necessary header configuration
viewport" content="width=device-width,initial-scale= 1, user-scalable=no"> (The values ​​of each attribute are not introduced. During development, Xiaomi (2016 Xiaomi 4) tested user-scalable=no and it did not work. )
2.rem is used to set the font-size of the root node, which is calculated using Js during the development process.
Formula 320/100=Screen size/fontSize value
3. Click to jump, the semantic label is a (dispaly:block;)
In the case of SemanticizationConsidering a Add a span (disply:block) to the tag, and add a container
4 to the span. For user-friendly experience, set the maximum width and minimum width when developing mobile pages. Such as
{
max-width:640px;
min-width:320px;
}
5. Some defaults for mobile development pages Style
Disable a label background
a,button,input,optgroup,select,textare{
// Remove the blue outer border and gray translucency when a,input,button is clicked
-webkit- tap-highlight-color:rgba(0,0,0,0);
}
It is forbidden to long press a,img labelThe menu bar appears
a,img{
// Disable long press to display menu bar
-webkit-touch-callout:none;
}
Smooth scrolling
body{
-webkit- overflow-scrolling:touch;
}

6. For single line interception, please refer to http://www.cnblogs.com/victory820/p/6728904.html

7.calc The use does not consider the compatibility of lower versions (ie11 below and Android 56 below, all Opera), it is recommended to use it for convenience.

8. The use of box-sizing solves the inconsistent display of box models in different browsers. (Commonly used on mobile terminals)
content-box;Default value standard model, width and height do not include bordersInner marginOuter margin
padding-box;width and height include padding and do not include borders and margins
border-box;Weird model width and height include padding and borders, do not include Margins.

9. Horizontal and vertical centering (commonly used on mobile terminals)
Disadvantages: Need to know the width and height of the small container
Format


< ;p class="child">



.parent{
position:relative;
width:100px;
height:100px;
background-color:red;
}
// Note that all four directions are 0
.child{
position:absolute;
margin:auto;
top:0;
right;0;
bottom: 0;
left:0;
width:50px;
height:50px;
background-color:gold;
}
10. Setting of line-height (commonly used on mobile terminals)
normal: Default, automatically allocates reasonable line spacing
number setting number, which will be multiplied by the current font size to set, that is, multiple
length setting Fixed line spacing
% is based on the percentage of the current font size.
inherit inherits from the parent element
Remember the following formula and use it to eliminate bugs
Blank spacing=lineHeight - fontSize
Set the line-height of the parent element to 100% and there will be no white space

11.vertical-alignAdjust icon vertical centering (commonly used on mobile terminals)
baseline: content is aligned with the parent element baseline
sub: element baseline is aligned with the parent element subscript baseline
super: The element baseline is aligned with the superscript baseline of the parent element
top: The top of the element and its descendants are aligned with the top of the entire line
text-top: The top of the element is aligned with the top of the parent element's font
middel: The centerline of the element is aligned with the baseline of the parent element
bottom: The bottom of the element and its descendants are aligned with the bottom of the entire line
text-bottom: The bottom of the element is aligned with the bottom of the parent element's font
percentage: Percentage specifies the offset. The baseline is 0%
length: numerical method, the baseline is 0 (commonly used)

12. Use of flex
When using flex, if the two columns are not evenly distributed, try setting the width to 0
https://csstriggers.com/Check which processes are triggered by css properties

The above is the detailed content of Summary of content related to mobile h5 development css. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to use mobile gesture operations in Vue projects How to use mobile gesture operations in Vue projects Oct 08, 2023 pm 07:33 PM

How to use mobile gesture operations in Vue projects With the popularity of mobile devices, more and more applications need to provide a more friendly interactive experience on the mobile terminal. Gesture operation is one of the common interaction methods on mobile devices, which allows users to complete various operations by touching the screen, such as sliding, zooming, etc. In the Vue project, we can implement mobile gesture operations through third-party libraries. The following will introduce how to use gesture operations in the Vue project and provide specific code examples. First, we need to introduce a special

Solve the problem of multi-touch points on Vue mobile terminal Solve the problem of multi-touch points on Vue mobile terminal Jun 30, 2023 pm 01:06 PM

In mobile development, we often encounter the problem of multi-finger touch. When users use multiple fingers to swipe or zoom the screen on a mobile device, how to accurately recognize and respond to these gestures is an important development challenge. In Vue development, we can take some measures to solve the problem of multi-finger touch on the mobile terminal. 1. Use the vue-touch plug-in vue-touch is a gesture plug-in for Vue, which can easily handle multi-finger touch events on the mobile side. We can install vue-to via npm

How to solve the double-click amplification problem on mobile terminals in Vue development How to solve the double-click amplification problem on mobile terminals in Vue development Jun 29, 2023 am 11:06 AM

With the popularity of mobile devices, using Vue for mobile development has become a common choice. However, we often face a problem during mobile development, which is double-clicking to zoom in. This article will focus on this problem and discuss how to solve the specific method of double-click amplification on the mobile terminal in Vue development. The double-click enlargement problem on mobile devices occurs mainly because the mobile device automatically enlarges the zoom ratio of the web page when double-clicking on the touch screen. For general web development, this kind of double-click to enlarge is usually beneficial because it can

A complete guide to implementing mobile responsive layout in Vue (Vant) A complete guide to implementing mobile responsive layout in Vue (Vant) Jun 09, 2023 pm 04:09 PM

A Complete Guide to Implementing Mobile Responsive Layout in Vue (Vant) Mobile responsive layout is a very important part of modern web development. With the popularity of mobile devices, how to quickly respond to the size and resolution of the user's mobile phone screen has become a One of the challenges front-end engineers have to face. The Vue framework comes with responsive layout features, and there are also many third-party libraries to help us implement responsive layout. Among them, Vant component library is a Vue mobile UI library because it is very powerful, easy to use and customized, and is fully compatible with mobile devices.

How to implement mobile map positioning function using Python and Baidu Map API How to implement mobile map positioning function using Python and Baidu Map API Jul 29, 2023 pm 11:33 PM

Method of implementing mobile map positioning function using Python and Baidu Map API. With the development of mobile Internet, map positioning function has become more and more common in mobile applications. Python, as a popular programming language, can also implement mobile map positioning functions by using Baidu Map API. The following will introduce the steps to implement the map positioning function using Python and Baidu Map API, and provide corresponding code examples. Step 1: Apply for Baidu Map API Key Before starting, we first need to apply

How to handle mobile and responsive design in PHP forms How to handle mobile and responsive design in PHP forms Aug 10, 2023 am 11:51 AM

How to deal with mobile and responsive design in PHP forms. With the popularity and frequency of mobile devices increasing, and more and more users using mobile devices to access websites, adapting to mobile has become an important issue. When dealing with PHP forms, we need to consider how to achieve a mobile-friendly interface and responsive design. This article explains how to handle mobile and responsive design in PHP forms and provides code examples. 1. Responsive forms using HTML5 HTML5 provides some new features that can easily implement responsive forms.

Vue development: Optimizing the stuck problem of gesture scaling on the mobile terminal Vue development: Optimizing the stuck problem of gesture scaling on the mobile terminal Jun 30, 2023 pm 04:33 PM

How to solve the stuck problem of mobile gesture zooming pages in Vue development. In recent years, the popularity of mobile applications has made gesture operations an important way of user interaction. In Vue development, implementing the gesture zoom function on the mobile terminal often encounters the problem of page lag. This article will explore how to solve this problem and provide some optimization strategies. Understand the principle of gesture scaling. Before solving the problem, we first need to understand the principle of gesture scaling. Gesture zooming is implemented by listening to touch events. When the user slides the screen with two fingers, the page will follow the sliding movement of the fingers.

How to solve the problem of mobile image rotation in Vue development How to solve the problem of mobile image rotation in Vue development Jun 29, 2023 pm 09:22 PM

With the rapid development of the mobile Internet, more and more websites and applications are beginning to use Vue.js for mobile development. However, during mobile development, we often encounter the problem of image rotation. Image rotation means that when a user takes a photo on a mobile device, due to the change in device orientation, the angle of the photo displayed on the page is inconsistent with the actual shooting angle. To solve the problem of image rotation, you first need to understand the reason why the image is rotated. When a user takes a photo on a mobile device, the device automatically adds some metadata to the photo.

See all articles