下面的内容在近期极有可能是错误的,只是我的一个小记录。如果你想参考的话,也欢迎参考;如果有着严重的错误认识,那你指出来是最好不过了
缘由
- 阿里巴巴面试问到移动端方面严重被虐
- baidu-ife Task 1-11:移动Web页面布局实践
效果图
正文
这是第一次尝试移动端开发,准备也是比较仓促。
相比PC端,移动端的屏幕比较复杂,不过布局也相对来说比较简单。移动端开发应该是可以分为移动端Web App 和 套壳开发。
目前 IFE 任务上只是要求 纯 css 实现简单的布局,我的认知还处在萌芽阶段。
实践
上面给的设计图好像并不是很准确的,为了方便按照设计图开发,首先需要对他进行转化。依照约定俗称的,用 PS 转化成 375px 宽的即可(iPhone6)。
然后为了比较好的响应移动端不同的设备,一般采用rem作为单位。
对 html 标签进行这样的设置
html { /*font-size : 14px;*/ font-size: calc(100vw/26.785); font-family: 'Microsoft YaHei',"Helvetica Neue", Helvetica, STHeiTi, Arial, sans-serif; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%;}
这样后面的 1rem = 14px,针对 PSD , 我们对每个像素除以14 即可转变为 rem,采用 scss 开发可以简化这个过程
@function px2rem($px, $base-font-size: 14px) { @if (unitless($px)) { @warn "Assuming #{$px} to be in pixels, attempting to convert it into pixels for you"; @return px2rem($px + 0px); // That may fail. } @else if (unit($px) == rem) { @return $px; } @return ($px / $base-font-size) * 1rem;}
这样以后使用的时候用 px2rem(40px) 这样的方法即可。
demo
https://github.com/HashCoding/task1-11
参考资料
移动前端开发和 Web 前端开发的区别是什么
使用Flexible实现手淘H5页面的终端适配

The official account web page update cache, this thing is simple and simple, and it is complicated enough to drink a pot of it. You worked hard to update the official account article, but the user still opened the old version. Who can bear the taste? In this article, let’s take a look at the twists and turns behind this and how to solve this problem gracefully. After reading it, you can easily deal with various caching problems, allowing your users to always experience the freshest content. Let’s talk about the basics first. To put it bluntly, in order to improve access speed, the browser or server stores some static resources (such as pictures, CSS, JS) or page content. Next time you access it, you can directly retrieve it from the cache without having to download it again, and it is naturally fast. But this thing is also a double-edged sword. The new version is online,

The article discusses using HTML5 form validation attributes like required, pattern, min, max, and length limits to validate user input directly in the browser.

This article demonstrates efficient PNG border addition to webpages using CSS. It argues that CSS offers superior performance compared to JavaScript or libraries, detailing how to adjust border width, style, and color for subtle or prominent effect

Article discusses best practices for ensuring HTML5 cross-browser compatibility, focusing on feature detection, progressive enhancement, and testing methods.

The article discusses the HTML <datalist> element, which enhances forms by providing autocomplete suggestions, improving user experience and reducing errors.Character count: 159

The article discusses the HTML <progress> element, its purpose, styling, and differences from the <meter> element. The main focus is on using <progress> for task completion and <meter> for stati

This article explains the HTML5 <time> element for semantic date/time representation. It emphasizes the importance of the datetime attribute for machine readability (ISO 8601 format) alongside human-readable text, boosting accessibilit

The article discusses the HTML <meter> element, used for displaying scalar or fractional values within a range, and its common applications in web development. It differentiates <meter> from <progress> and ex


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

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

SublimeText3 Linux new version
SublimeText3 Linux latest version

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

WebStorm Mac version
Useful JavaScript development tools

SublimeText3 English version
Recommended: Win version, supports code prompts!
