前端PC页面,移动端页面问题笔记~~

 1 <!DOCTYPE html>
 2 <html>
 3 <head>
 4 <meta charset="gbk"/>
 5 <meta name="robots" content="all"/>
 6 <meta name="author" content="Tencent-TGideas"/>
 7 <meta name="Copyright" content="Tencent"/>
 8 <meta name="Description" content="" />
 9 <meta name="Keywords" content="" />
10 <title>{当前专题名称}-官方网站-腾讯游戏</title>
11 <!-- 设计:cp | 重构:cp | 创建:----/--/--  -->
12 <style>
13     /* reset */
14     body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td{margin:0;padding:0}
15     table{border-collapse:collapse;border-spacing:0}
16     address,caption,cite,code,dfn,em,strong,th,var{font-weight:normal;font-style:normal}
17     ol,ul{list-style:none}
18     caption,th{text-align:left}
19     h1,h2,h3,h4,h5,h6{font-weight:normal;font-size:100%}
20     q:before,q:after{content:‘‘}
21     fieldset,img,abbr,acronym{border:0}
22     a{text-decoration:none}
23     body{padding-top:42px;font:14px/1.5 ‘\5FAE\8F6F\96C5\9ED1‘,‘\u9ed1\u4f53‘,tahoma,sans-serif;overflow-x:hidden;}
24
25     /* footer */
26     #footer_ied{text-align:center;font-size:12px;line-height:19px;color:#8f8f8f;background:#000000;}
27     .wrap_ied{margin:0 auto;padding:30px;width:940px}
28     .wrap_ied a{color:#8f8f8f}
29     #footer_ied .e{font-size:10px;-webkit-text-size-adjust:none;}
30     .hide{display:none;}
31 </style>
32 </head>
33 <body>
34
3
44 </body>
45 </html>

其中CSS样式重置;加上描述,关键字等SEO 优化;其中的内容可以自己编辑

PC端就简单完成了;

接着 给出个移动端的

<!DOCTYPE html>
<html>
<head>
<meta charset="gbk">
<link href="http://ossweb-img.qq.com/images/ttxd/m/web201605/logo.png" rel="apple-touch-icon">
<link href="http://ossweb-img.qq.com/images/ttxd/m/web201605/logo.png" rel="apple-touch-icon-precomposed">
<meta name="applicable-device" content="mobile">

<meta name="robots" content="all">
<meta name="format-detection" content="telephone=no">
<meta name="author" content="Tencent-TGideas">
<meta name="Copyright" content="Tencent">
<meta name="applicable-device" content="mobile"> 

<meta name="Description" content="《天天炫斗》是腾讯第一实时PK动作手游,具有炫酷的格斗画面和超爽快的打击手感。游戏角色个性迥异、技能华丽酷炫,无限连击的全屏大招,给人带来动作游戏巅峰体验。游戏中有实时PK、公会争霸、组队闯关、语音聊天等多种好友互动玩法,还可变身成为BOSS、机甲击溃敌人。新版本将更新角色觉醒系统,焕然一新的主角和更加强大的技能带来全新体验!" />
<meta name="Keywords" content="天天炫斗,天天炫斗官网,天天炫斗下载,天天炫斗攻略,天天炫斗iOS版,天天炫斗安卓版,腾讯天天炫斗,格斗手游" />
<title>{当前专题名称}-官方网站-腾讯游戏</title>
<script>
function adaptVP(a){function c(){var c,d;return b.uWidth=a.uWidth?a.uWidth:640,b.dWidth=a.dWidth?a.dWidth:window.screen.width||window.screen.availWidth,b.ratio=window.devicePixelRatio?window.devicePixelRatio:1,b.userAgent=navigator.userAgent,b.bConsole=a.bConsole?a.bConsole:!1,a.mode?(b.mode=a.mode,void 0):(c=b.userAgent.match(/Android/i),c&&(b.mode="android-2.2",d=b.userAgent.match(/Android\s(\d+.\d+)/i),d&&(d=parseFloat(d[1])),2.2==d||2.3==d?b.mode="android-2.2":4.4>d?b.mode="android-dpi":d>=4.4&&(b.mode=b.dWidth>b.uWidth?"android-dpi":"android-scale")),void 0)}function d(){var e,f,g,h,c="",d=!1;switch(b.mode){case"apple":f=(window.screen.availWidth*b.ratio/b.uWidth)/b.ratio;c="width="+b.uWidth+",initial-scale="+f+",minimum-scale="+f+",maximum-scale="+f+",user-scalable=no";break;case"android-2.2":a.dWidth||(b.dWidth=2==b.ratio?720:1.5==b.ratio?480:1==b.ratio?320:.75==b.ratio?240:480),e=window.screen.width||window.screen.availWidth,320==e?b.dWidth=b.ratio*e:640>e&&(b.dWidth=e),b.mode="android-dpi",d=!0;case"android-dpi":f=160*b.uWidth/b.dWidth*b.ratio,c="target-densitydpi="+f+", width="+b.uWidth+", user-scalable=no",d&&(b.mode="android-2.2");break;case"android-scale":c="width="+b.uWidth+", user-scalable=no"}g=document.querySelector("meta[name=‘viewport‘]")||document.createElement("meta"),g.name="viewport",g.content=c,h=document.getElementsByTagName("head"),h.length>0&&h[0].appendChild(g)}function e(){var a="";for(key in b)a+=key+": "+b[key]+"; ";alert(a)}if(a){var b={uWidth:0,dWidth:0,ratio:1,mode:"apple",userAgent:null,bConsole:!1};c(),d(),b.bConsole&&e()}};adaptVP({uWidth:640});
</script>
<!-- 设计:cp | 重构:cp | 创建:----/--/--  -->
<style>
    /*reset*/
    ::-webkit-input-placeholder{color:#999;}
    input[type="text"],input[type="password"],select{-webkit-appearance:none;appearance:none;outline:none;-webkit-tap-highlight-color:rgba(0,0,0,0);border-radius:0;font-family:‘\5FAE\8F6F\96C5\9ED1‘;}
    body,ul,ol,p,h1,h2,h3,h4{margin:0;padding:0;}
    img{border:0;display:block;}
    a,button,input{-webkit-tap-highlight-color:rgba(255,0,0,0);}
    ol,ul{list-style:none;}
    html{-webkit-text-size-adjust:none;font-size:16px;}
    body,html{-webkit-tap-highlight-color:transparent;-webkit-user-select:none;width:100%;height:100%;}
    .c:after{content:‘\20‘;display:block;height:0;line-height:0;visibility:hidden;clear:both;}
    .hide{display:none;height:0;font-size:0;line-height:0;visibility:hidden;overflow:hidden;}
    a{text-decoration:none;}
    a:focus{outline:none}
</style>
</head>
<body>
    <h1 class="hide">{专题名称}</h1>
    <!--#include virtual="/m/web201605/inc/header.inc" --> 

    <div class="stage"></div>

    <script src="http://pingjs.qq.com/ping_tcss_ied.js"></script>
    <script>
    //统计
    if(typeof(pgvMain) == ‘function‘)pgvMain();
    </script>
</body>
</html>

其中下面这段代码会根据手机的系统,尺寸等动态添加meta 标签

   <script>
        function adaptVP(a){function c(){var c,d;return b.uWidth=a.uWidth?a.uWidth:640,b.dWidth=a.dWidth?a.dWidth:window.screen.width||window.screen.availWidth,b.ratio=window.devicePixelRatio?window.devicePixelRatio:1,b.userAgent=navigator.userAgent,b.bConsole=a.bConsole?a.bConsole:!1,a.mode?(b.mode=a.mode,void 0):(c=b.userAgent.match(/Android/i),c&&(b.mode="android-2.2",d=b.userAgent.match(/Android\s(\d+.\d+)/i),d&&(d=parseFloat(d[1])),2.2==d||2.3==d?b.mode="android-2.2":4.4>d?b.mode="android-dpi":d>=4.4&&(b.mode=b.dWidth>b.uWidth?"android-dpi":"android-scale")),void 0)}function d(){var e,f,g,h,c="",d=!1;switch(b.mode){case"apple":f=(window.screen.availWidth*b.ratio/b.uWidth)/b.ratio;c="width="+b.uWidth+",initial-scale="+f+",minimum-scale="+f+",maximum-scale="+f+",user-scalable=no";break;case"android-2.2":a.dWidth||(b.dWidth=2==b.ratio?720:1.5==b.ratio?480:1==b.ratio?320:.75==b.ratio?240:480),e=window.screen.width||window.screen.availWidth,320==e?b.dWidth=b.ratio*e:640>e&&(b.dWidth=e),b.mode="android-dpi",d=!0;case"android-dpi":f=160*b.uWidth/b.dWidth*b.ratio,c="target-densitydpi="+f+", width="+b.uWidth+", user-scalable=no",d&&(b.mode="android-2.2");break;case"android-scale":c="width="+b.uWidth+", user-scalable=no"}g=document.querySelector("meta[name=‘viewport‘]")||document.createElement("meta"),g.name="viewport",g.content=c,h=document.getElementsByTagName("head"),h.length>0&&h[0].appendChild(g)}function e(){var a="";for(key in b)a+=key+": "+b[key]+"; ";alert(a)}if(a){var b={uWidth:0,dWidth:0,ratio:1,mode:"apple",userAgent:null,bConsole:!1};c(),d(),b.bConsole&&e()}};adaptVP({uWidth:640});
    </script>

类似

1 <meta name="viewport" content="width=640,initial-scale=0.5859375,minimum-scale=0.5859375,maximum-scale=0.5859375,user-scalable=no">

然后你就可以根据640的设计稿按照px像素布局

时间: 2024-08-04 08:51:47

前端PC页面,移动端页面问题笔记~~的相关文章

移动端页面开发流程

移动端页面布局 一.移动端app分类 1.Native App原生app手机应用程序 使用原生的语言开发的手机应用,Android系统用的是java,ios系统用的是object-C 2.Hybrid App 混合型app手机应用程序 混合使用原生的程序和html5页面开发的手机应用 3.Web App 基于Web的app手机应用程序 完全使用html5页面加前端js框架开发的手机应用 二.Viewport视口 视口是移动设备上用来显示网页的区域,一般会比移动设备可视区域大,宽度可能是980px

移动端页面布局

移动端页面布局 一.移动端app分类 1.Native App原生app手机应用程序 使用原生的语言开发的手机应用,Android系统用的是java,ios系统用的是object-C 2.Hybrid App 混合型app手机应用程序 混合使用原生的程序和html5页面开发的手机应用 3.Web App 基于Web的app手机应用程序 完全使用html5页面加前端js框架开发的手机应用 二.Viewport视口 视口是移动设备上用来显示网页的区域,一般会比移动设备可视区域大,宽度可能是980px

6.0 移动端页面布局

移动端app分类 1.Native App 原生app手机应用程序使用原生的语言开发的手机应用,Android系统用的是java,iOS系统用的是object-C 2.Hybrid App 混合型app手机应用程序混合使用原生的程序和html5页面开发的手机应用 3.Web App 基于Web的app手机应用程序完全使用html5页面加前端js框架开发的手机应用 Viewport 视口 视口是移动设备上用来显示网页的区域,一般会比移动设备可视区域大,宽度可能是980px或者1024px,目的是为

移动前端系列——移动端页面坑与排坑技巧

移动前端系列——移动端页面坑与排坑技巧 In 网页重构 on 2014-12-08 20:21:19 by lyushine 对于前端开发者来说移动端存在更多的挑战,移动端页面开发过程中会碰到各种各样千奇百怪的问题(我们俗称BUG或坑),那么今天我为大家分享移动端页面开发过程中的一些坑和排坑技巧. 移动端页面在不同设备.不同操作系统 .不同运行环境下都可能造成各种各样的没有碰到过的的坑,相比曾经的IE6坑多了.下面先介绍一下4类具体常见的坑: 1.外观 A.页面高度渲染错误 在各移动端浏览器中经

PC端页面开发基础-问题总结(一)

本人在做前端开发相关工作时,遇到过也解决过很多技术性问题.今天起,就从PC端页面开发开始,理一理新手们可能会遇到的那些坑. 本文非教学文章,仅供有前端开发基础的同学同僚们一起讨论与总结,本人将从零开始持续更新,欢迎大家的批评指正. 高度塌陷问题: 父元素的高度会被子元素撑开,当子元素都设置了浮动时,由于子元素半脱离文档流,父元素失去子元素的高度,便会产生高度塌陷 hack1:父元素overflow:hidden; hack2:子元素下方加一个空div,并设置height:0;clear:both

聊聊PC端页面适配

目也pc端有适配的需求:目前我们pc项目的设计稿尺寸是宽度1920,高度最小是1080. 适配目标: 1.在不同分辨率的电脑上,网页可以正常显示 2.放大或者缩小屏幕,网页可以正常显示 对于宽度的适配 对于宽度适配: 首先设置html,body{width:100%;overflow-x:hidden;} 然后我们可以把页面分解为背景层(一般宽度都会大于1200px)和内容层(一般宽度都会小于1200px),对于背景层,我们一般都要求完全铺开,主要有以下几种情况: 1.背景色为纯色:我们可以直接

让PC端页面在手机端显示缩小版的解决方法

做页面的时候我们做好pC端页面时,因编辑那边需求,在手机端页面也应该是缩小版,不能乱的.在网上找了各种解决方案,经实验,这种是可以的: 在head里边加上这两句meta <meta name="apple-mobile-web-app-capable" content="yes">  <meta name="apple-mobile-web-app-status-bar-style" content="white&qu

移动端页面开发及传统PC端网页开发的异同

   2017年12月份在公司做过一次技术分享,转眼间过去六个月了.... 今天在感叹完时间的飞逝之后,拿过来在这里分享一下吧,话题是:移动端页面开发及传统PC端网页开发的异同,这个ppt是搜集网上众路资源(包括视频课程)加上自己的理解总结的.如若有误,欢迎指正哦- 原文地址:https://www.cnblogs.com/catherLee/p/9118406.html

pc端页面在移动端显示问题

1.pc端页面在移动端显示,默认视口宽度是980px(也就是body宽度是980px),可通过meta标签设置为需要的尺寸,比如页面中元素最大宽度是1220px,则如下所示 <meta name="viewport" content="width=1220"> 2.如果不想让页面有水平滚动条又有元素需要固定在屏幕底部,则可以按以下方法操作 1)给html页面设置视口宽度 2)判断是否为移动设备,对pc和移动设备分别设置样式,如下: $(function(

PC端、移动端页面适配方案

前言 页面自适应PC端.移动端大体上可以分为两种: 1.在同一个页面进行自适应布局,通常使用CSS3 @media 媒体查询器实现 2.两套页面,在后端进行统一适配,根据不同的浏览器UA返回对应的页面 本文记录在java后端进行PC端.移动端页面适配的方案 工程结构 想要实现后端统一适配,首先要规范好工程结构 后端代码,跟之前差不多,响应的viewName路径,直接从业务模块开始,适配工作交给aop:两套页面,对应的业务模块,分别放在两个目录下面 aop适配器 统一的适配工作交由aop环绕切面进