移动端HTML5如何开发?跟PC端有什么区别?
回复内容:
谢邀。
这问题很大,我就说个方向,有很多资料你可以自己去查。
考虑如下问题:
1. 移动端不需要 300ms 的单击确认,所以不要监听 click 事件
2. 移动端网络一般较慢,如何减小页面体积及请求数,利用好缓存?
3. 移动端需要点击的元素及其间隔不能太小,考虑手指的面积?
4. 横屏和竖屏下的表现?
5. 不同浏览器间的兼容性(太多了,如 position:fixed)?
6. Retina 屏图片会不会模糊?
7. 输入状态键盘会不会挡住输入内容?
8. 在浏览器上点击后退的行为?
9. 某些浏览器(如 Safari)的隐私模式下 cookie 和 localStorage 的替代方案?
……
请务必了解媒体查询
触摸友好
楼上Vkki说的对,但对于一个还没入门的人来说太深了
—————
在我看先选一个合适的框架很重要,能让人快速上手,bootstrap可以但就我的经验看某些情况下的性能表现像吔了屎一样,有些情况下跟jquery的插件混用还tm不兼容
个人推荐mui,别看成miui
跟hbuilder一家公司出的,js和css都比较完善
前几个月给一家网站做app,跨平台表现不错,很适合移动端h5开发
缺点是性能性能性能,两个webview叠上去就有点卡了,持续关注中
我还很业余……写一些常见的吧:
1 采取更小的js库。比如说jQuery1.x -> jQuery2.x/zepto
2 记得用meta-viewport标签调节视口
3 触摸事件的处理。推荐一个库,hammer
4 小心安卓机……有些时候他们会出一些类似于“一个事件只能绑定一个回调”之类的奇怪bug……
5 尽情使用websocket吧,主流机型好像是都支持的。
6 调试很麻烦,详见这个:怎么在移动端调试web前端? - 计算机网络
7 position:fixed不要随便用
8 flexbox很棒,你不一定非得用Bootstrap之类的库
9 做小游戏为什么不优先考虑canvas呢
没有什么本质区别,大概有几点:
屏幕尺寸小且规格繁多,需要提高视口利用率,一般不采用固定布局,而采用流式或响应式布局。
触摸、设备运动等事件的应用场合大大增多。
浏览器一般较为先进,可以使用更多先进技术。
考虑到设备性能、网络流量问题,需要更加严格控制代码质量和页面加载时间。
相关文章:
H5 Code: Best Practices for Web DevelopersApr 16, 2025 am 12:14 AMBest practices for H5 code include: 1. Use correct DOCTYPE declarations and character encoding; 2. Use semantic tags; 3. Reduce HTTP requests; 4. Use asynchronous loading; 5. Optimize images. These practices can improve the efficiency, maintainability and user experience of web pages.
H5: The Evolution of Web Standards and TechnologiesApr 15, 2025 am 12:12 AMWeb standards and technologies have evolved from HTML4, CSS2 and simple JavaScript to date and have undergone significant developments. 1) HTML5 introduces APIs such as Canvas and WebStorage, which enhances the complexity and interactivity of web applications. 2) CSS3 adds animation and transition functions to make the page more effective. 3) JavaScript improves development efficiency and code readability through modern syntax of Node.js and ES6, such as arrow functions and classes. These changes have promoted the development of performance optimization and best practices of web applications.
Is H5 a Shorthand for HTML5? Exploring the DetailsApr 14, 2025 am 12:05 AMH5 is not just the abbreviation of HTML5, it represents a wider modern web development technology ecosystem: 1. H5 includes HTML5, CSS3, JavaScript and related APIs and technologies; 2. It provides a richer, interactive and smooth user experience, and can run seamlessly on multiple devices; 3. Using the H5 technology stack, you can create responsive web pages and complex interactive functions.
H5 and HTML5: Commonly Used Terms in Web DevelopmentApr 13, 2025 am 12:01 AMH5 and HTML5 refer to the same thing, namely HTML5. HTML5 is the fifth version of HTML, bringing new features such as semantic tags, multimedia support, canvas and graphics, offline storage and local storage, improving the expressiveness and interactivity of web pages.
What Does H5 Refer To? Exploring the ContextApr 12, 2025 am 12:03 AMH5referstoHTML5,apivotaltechnologyinwebdevelopment.1)HTML5introducesnewelementsandAPIsforrich,dynamicwebapplications.2)Itsupportsmultimediawithoutplugins,enhancinguserexperienceacrossdevices.3)SemanticelementsimprovecontentstructureandSEO.4)H5'srespo
H5: Tools, Frameworks, and Best PracticesApr 11, 2025 am 12:11 AMThe tools and frameworks that need to be mastered in H5 development include Vue.js, React and Webpack. 1.Vue.js is suitable for building user interfaces and supports component development. 2.React optimizes page rendering through virtual DOM, suitable for complex applications. 3.Webpack is used for module packaging and optimize resource loading.
The Legacy of HTML5: Understanding H5 in the PresentApr 10, 2025 am 09:28 AMHTML5hassignificantlytransformedwebdevelopmentbyintroducingsemanticelements,enhancingmultimediasupport,andimprovingperformance.1)ItmadewebsitesmoreaccessibleandSEO-friendlywithsemanticelementslike,,and.2)HTML5introducednativeandtags,eliminatingthenee
H5 Code: Accessibility and Semantic HTMLApr 09, 2025 am 12:05 AMH5 improves web page accessibility and SEO effects through semantic elements and ARIA attributes. 1. Use, etc. to organize the content structure and improve SEO. 2. ARIA attributes such as aria-label enhance accessibility, and assistive technology users can use web pages smoothly.


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

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

WebStorm Mac version
Useful JavaScript development tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft







