The first summary of mobile problems.

Source: Internet
Author: User

The first day of contact with the mobile front end, the whole person is ignorant. Not only from the Web front-end to the mobile front-end thinking transformation, there are some HTML page structure of the modular, CSS style of the order of writing and readability, about the layout of thinking and so on. Now one months into the job, to summarize, and continue to optimize the future.

1) The writing order of CSS Styles

1. Position attributes (position, top, right, z-index, display, float, etc.)
2. Box model (width, height, padding, border, margin)
3. Text series (font, color, line-height, letter-spacing, text-align, etc.)
4. Background (background, etc.)
5. Other (animation, transition, etc.)

2) Writing specifications for CSS Styles

1. Remove the "0" in front of the decimal point, such as font-size:. 28rem;

2.16 binary color code abbreviation, try not to appear in English, will deviate from the design manuscript. General English is used only for testing.

3. The hyphen CSS Selector naming specification is not recommended for "_" connections, camel naming is recommended, or "-" can be used.

4. Do not use the ID arbitrarily, because the ID is unique in JS. This was known before, but now includes the structure, using class. And the ID is usually just JS code in need, will add.

5. Until then, when you need to change CSS styles with JavaScript, you often use $ (). CSS () concatenating, not only cumbersome, repetitive, but also the code looks messy. The idea now is to add a. Selected class to the CSS, and then use AddClass ('. Selected '), Removeclass ('. Selected '), which is not only straightforward but also reusable.

3) Thinking about the design draft

So far, the most talked about is the following two cases: 1. You can't do everything according to the design, he sometimes has a problem or unreasonable, including sometimes font size, padding, wide and high value. 2. This is the design of the manuscript on the things, can not randomly change.

Then we have to think about whether to follow the design draft. The summary is as follows:

When you get a design diagram, the first is based on the layout of the design diagram. When you complete the structure of the page, it means that you have a rough implementation of each piece of content once. What else does it take to get PS out of a design drawing?

1. Color. 2. Li's row height, picture size. 3. Font size (most of the time follows the design draft, but when the design draft font is obviously too small and the effect on the phone is not good, you need to be bold to modify).

And then there's a little bit of attention.

TIP:

I. Get information from each of his icons, an arrow may represent a drop-down option, and an ellipsis, which usually means that the title does not appear complete, or that the article content value displays 2 lines.

II. The rounded corner of the picture is added to itself or the div wrapped outside the background has no default image.

III. Then there is the problem with the form, the input content is displayed in the right or the middle, the layout is different. In both cases, it is important to note that the input box content cannot overwrite the icon.

Iv. save traffic, sometimes, some simple icons can usually be implemented with CSS.

And now my biggest problem is that some of the dimensions on the design waste too much time, not only the time to think fine, and sometimes calculate, rather than through the code directly to achieve the effect, this is undoubtedly to change. Rather than a few px in the distance, it is better to test the results after completion. Important

4) Epilogue, some side branches of the stub

1. Line-height.

Text line is more than a multiplier, when some fonts are too large, such as the title, if the use of multiples then each line of space will be too large (including due to the specificity of the number), a fixed value will be used at this time.

2. Mobile-side experience issues.

The first is the form input and the keyboard contention, on some models, the keyboard may pop up will completely obscure the input box. Therefore, in general, the input box is designed in the upper part. Of course, if this is the case in the design itself, you cannot say that it does not solve the problem. The first kind of opportunistic approach, if there is a submit button below, set the Margin-bottom value of the button a bit larger. If you are in a situation where there is nothing to do, then you can only use JS to trigger a popup window.

Second, on the Web front-end presumably: hover use a lot, then mobile: Active to user feedback, usually used on Li/button. At this point, Li inside the Select, input will need to set the background transparent, to avoid uneven background. : There is a problem with active on iOS, and the workaround is to bind the element to a Touch series event.

3. Border-left, Border-right, in the form of Li, so not only will not reduce the width of Li, and can play the role of text offset.

4. Prefix issues. Because there are some properties that need to be compatible with older versions, prefixes need to be added. Recommended writing Order Here

{    -webkit-transform: translate ( -50%,-50%);     -moz-transform:translate ( -50%,-50%);     Transform:translate ( -50%,-50%);}

This is just a few of the problems that have been encountered so far, and there may be many problems that have not been taken into account. Work hard in the future to do not make the same mistakes, timely summary, and hope that their better.

     

    

    

The first summary of mobile problems.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.