Home  >  Article  >  Web Front-end  >  Detailed explanation of the application of meta tags in mobile platform development_HTML/Xhtml_Web page production

Detailed explanation of the application of meta tags in mobile platform development_HTML/Xhtml_Web page production

WBOY
WBOYOriginal
2016-05-16 16:37:561222browse

Everyone is very familiar with the meta tag in web layouts on desktop platforms. It is always located inside the head element. Friends who do SEO must have a special feeling for meta. Today we will talk about meta on mobile platforms. Tags, what are the magical effects of meta tags on mobile platforms?

1. Meta viewport

Speaking of mobile platform meta tags, we have to talk about viewport. So what is viewport?
Viewport is the visual area. For desktop browsers, viewport refers to the area used to view web pages after removing all toolbars, status bars, scroll bars, etc.
. For traditional WEB pages, it is normal for the width of 980 to be displayed on the iPhone, and it also fills the screen. But for webapps, it may be a bit of a problem. On iPhones, our webapps usually have a width of 100cm in portrait mode. 320, what effect will our 320 page display on the iPhone? Some people may think that the iPhone is not 320mm wide, it should fill the screen, right? What is the reality? Let’s take a look at how the following layout appears on the iPhone

Copy the code
The code is as follows:





Meta Viewport</title> ;<br /><style type="text/css"><br>div,body{<br>padding:0;<br>margin:0;<br>}<br>body{<br>padding -top:100px;<br>color:#fff;<br>}<br>div{<br>width:320px;<br>height:100px;<br>margin:0 auto;<br>background:# 000;<br>text-align:center;<br>font:30px/100px Arial;<br>}<br></style><br></head><br><body><br><div><br>AppUE<br></div><br></body><br></html><br> </div> <p>So we must change the viewport. We have the following attribute values ​​​​that can be set: </p> <p>width: width of the viewport (range from 200 to 10,000, default is 980 pixels) <br>height: height of the viewport (range from 223 to 10,000) <br>initial-scale: initial scaling (range from > ;0 to 10)<br>minimum-scale: The minimum ratio that the user is allowed to zoom to<br>maximum-scale: The maximum ratio that the user is allowed to zoom to<br>user-scalable: Whether the user can manually zoom</p> <p>For these attributes, we can set one or more of them, and you do not need to set them all at the same time. iPhone will automatically calculate other attribute values ​​​​based on the attributes you set, instead of directly using the default values. </p> <p>If you set initial-scale=1, then width and height will automatically be 320*356 in portrait mode (not 320*480 because the address bar etc. all occupy space), and 480*208 in landscape mode. Similarly, if you only set width, initial-scale and height will be automatically calculated. For example, if you set width=320, the initial-scale is 1 when the screen is in portrait mode, and becomes 1.5 when the screen is in landscape orientation. So how do these settings let Safari know? In fact, it is very simple, just a meta, in the form: </p> <p><br></p> <div class="msgheader"> <div class="right"><span style="CURSOR: pointer" onclick="copycode(getid('phpcode21'));"><u>Copy code</u></span></div>The code is as follows:</div> <div class="msgborder" id="phpcode21"> <br><meta name=”viewport” content =”width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;” /><br> </div> <p>Okay, we can lay out our page in full screen, no longer need to worry about the page being displayed very small! </p> <p>2. Meta format-detection<br><br></p> <div class="msgheader"> <div class="right"><span style="CURSOR: pointer" onclick="copycode(getid('phpcode22'));"><u>Copy code</u></span></div>The code is as follows:</div> <div class="msgborder" id="phpcode22"> <br><meta name=”format-detection” content=”telephone=no” /><br> </div> <p>You clearly wrote a string of numbers without adding a link style, but the iPhone will automatically add a link style to your text, and clicking on the number will automatically dial the number! How to remove this dial-up link? At this time, our meta should show off its magic power again. The code is as follows: </p> <p>telephone=no disables converting numbers into dial-up links! <br>telephone=yes enables the conversion of numbers into dial-up links. To enable the conversion function, there is no need to write this meta. It is enabled by default! </p> <p>3. Meta’s apple-mobile-web-app-capable<br><br></p> <div class="msgheader"> <div class="right"><span style="CURSOR: pointer" onclick="copycode(getid('phpcode23'));"><u>Copy the code</u></span></div>The code is as follows:</div> <div class="msgborder" id="phpcode23"> <br><meta name=”apple-mobile-web-app-capable” content=”yes” /><br> </div> <p>The function of this meta is to delete the default Apple toolbar and menu bar. content has two values ​​"yes" and "no". When we need to display the toolbar and menu bar, there is no need to add this line of meta. The default is to display it. </p> <p>4. Meta of apple-mobile-web-app-status-bar-style<br><br></p> <div class="msgheader"> <div class="right"><span style="CURSOR: pointer" onclick="copycode(getid('phpcode24'));"><u>Copy code</u></span></div>code As follows:</div> <div class="msgborder" id="phpcode24"> <br><meta name=”apple-mobile-web-app-status-bar-style” content=”default” /><br><meta name=”apple- mobile-web-app-status-bar-style” content=”black” /><br><meta name=”apple-mobile-web-app-status-bar-style” content=”black-translucent” /><br> </div> <br> is used to control the status bar display style<br><br><div class="msgheader"> <div class="right"><span style="CURSOR: pointer" onclick="copycode(getid('phpcode25'));"><u>Copy code</u></span></div>The code is as follows :</div> <div class="msgborder" id="phpcode25"> <br>status-bar-style:black<br>status-bar-style:black-translucent<br> </div></div><div class="nphpQianMsg"><div class="clear"></div></div><div class="nphpQianSheng"><span>Statement:</span><div>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</div></div></div><div class="nphpSytBox"><span>Previous article:<a class="dBlack" title="Detailed steps for embedding Baidu maps into web pages and customizing maps using Baidu Map API_HTML/Xhtml_Web page production" href="http://m.php.cn/faq/11219.html">Detailed steps for embedding Baidu maps into web pages and customizing maps using Baidu Map API_HTML/Xhtml_Web page production</a></span><span>Next article:<a class="dBlack" title="Detailed steps for embedding Baidu maps into web pages and customizing maps using Baidu Map API_HTML/Xhtml_Web page production" href="http://m.php.cn/faq/11224.html">Detailed steps for embedding Baidu maps into web pages and customizing maps using Baidu Map API_HTML/Xhtml_Web page production</a></span></div><div class="nphpSytBox2"><div class="nphpZbktTitle"><h2>Related articles</h2><em><a href="http://m.php.cn/article.html" class="bBlack"><i>See more</i><b></b></a></em><div class="clear"></div></div><ul class="nphpXgwzList"><li><b></b><a href="http://m.php.cn/faq/348757.html" title="Summary of Html knowledge" class="aBlack">Summary of Html knowledge</a><div class="clear"></div></li><li><b></b><a href="http://m.php.cn/faq/348804.html" title="How to learn HTML quickly" class="aBlack">How to learn HTML quickly</a><div class="clear"></div></li><li><b></b><a href="http://m.php.cn/faq/348873.html" title="The difference between html xhtml xml" class="aBlack">The difference between html xhtml xml</a><div class="clear"></div></li><li><b></b><a href="http://m.php.cn/faq/348884.html" title="The difference between src and href attributes" class="aBlack">The difference between src and href attributes</a><div class="clear"></div></li><li><b></b><a href="http://m.php.cn/faq/348902.html" title="About HTML5 and CSS replacement use" class="aBlack">About HTML5 and CSS replacement use</a><div class="clear"></div></li></ul></div></div><div class="nphpFoot"><div class="nphpFootBg"><ul class="nphpFootMenu"><li><a href="http://m.php.cn/"><b class="icon1"></b><p>Home</p></a></li><li><a href="http://m.php.cn/course.html"><b class="icon2"></b><p>Course</p></a></li><li><a href="http://m.php.cn/wenda.html"><b class="icon4"></b><p>Q&A</p></a></li><li><a href="http://m.php.cn/login"><b class="icon5"></b><p>My</p></a></li><div class="clear"></div></ul></div></div><div class="nphpYouBox" style="display: none;"><div class="nphpYouBg"><div class="nphpYouTitle"><span onclick="$('.nphpYouBox').hide()"></span><a href="http://m.php.cn/"></a><div class="clear"></div></div><ul class="nphpYouList"><li><a href="http://m.php.cn/"><b class="icon1"></b><span>Home</span><div class="clear"></div></a></li><li><a href="http://m.php.cn/course.html"><b class="icon2"></b><span>Course</span><div class="clear"></div></a></li><li><a href="http://m.php.cn/article.html"><b class="icon3"></b><span>Article</span><div class="clear"></div></a></li><li><a href="http://m.php.cn/wenda.html"><b class="icon4"></b><span>Q&A</span><div class="clear"></div></a></li><li><a href="http://m.php.cn/dic.html"><b class="icon6"></b><span>Dictionary</span><div class="clear"></div></a></li><li><a href="http://m.php.cn/course/type/99.html"><b class="icon7"></b><span>Manual</span><div class="clear"></div></a></li><li><a href="http://m.php.cn/xiazai/"><b class="icon8"></b><span>Download</span><div class="clear"></div></a></li><li><a href="http://m.php.cn/faq/zt" title="Topic"><b class="icon12"></b><span>Topic</span><div class="clear"></div></a></li><div class="clear"></div></ul></div></div><div class="nphpDing" style="display: none;"><div class="nphpDinglogo"><a href="http://m.php.cn/"></a></div><div class="nphpNavIn1"><div class="swiper-container nphpNavSwiper1"><div class="swiper-wrapper"><div class="swiper-slide"><a href="http://m.php.cn/" >Home</a></div><div class="swiper-slide"><a href="http://m.php.cn/article.html" class="hover">Article</a></div><div class="swiper-slide"><a href="http://m.php.cn/wenda.html" >Q&A</a></div><div class="swiper-slide"><a href="http://m.php.cn/course.html" >Course</a></div><div class="swiper-slide"><a href="http://m.php.cn/faq/zt" >Topic</a></div><div class="swiper-slide"><a href="http://m.php.cn/xiazai" >Download</a></div><div class="swiper-slide"><a href="http://m.php.cn/game" >Game</a></div><div class="swiper-slide"><a href="http://m.php.cn/dic.html" >Dictionary</a></div><div class="clear"></div></div></div><div class="langadivs" ><a href="javascript:;" class="bg4 bglanguage"></a><div class="langadiv" ><a onclick="javascript:setlang('zh-cn');" class="language course-right-orders chooselan " href="javascript:;"><span>简体中文</span><span>(ZH-CN)</span></a><a onclick="javascript:;" class="language course-right-orders chooselan chooselanguage" href="javascript:;"><span>English</span><span>(EN)</span></a><a onclick="javascript:setlang('zh-tw');" class="language course-right-orders chooselan " href="javascript:;"><span>繁体中文</span><span>(ZH-TW)</span></a><a onclick="javascript:setlang('ja');" class="language course-right-orders chooselan " href="javascript:;"><span>日本語</span><span>(JA)</span></a><a onclick="javascript:setlang('ko');" class="language course-right-orders chooselan " href="javascript:;"><span>한국어</span><span>(KO)</span></a><a onclick="javascript:setlang('ms');" class="language course-right-orders chooselan " href="javascript:;"><span>Melayu</span><span>(MS)</span></a><a onclick="javascript:setlang('fr');" class="language course-right-orders chooselan " href="javascript:;"><span>Français</span><span>(FR)</span></a><a onclick="javascript:setlang('de');" class="language course-right-orders chooselan " href="javascript:;"><span>Deutsch</span><span>(DE)</span></a></div></div><script> var swiper = new Swiper('.nphpNavSwiper1', { slidesPerView : 'auto', observer: true,//修改swiper自己或子元素时,自动初始化swiper observeParents: true,//修改swiper的父元素时,自动初始化swiper }); </script></div></div><!--顶部导航 end--><script>isLogin = 0;</script><script type="text/javascript" src="/static/layui/layui.js"></script><script type="text/javascript" src="/static/js/global.js?4.9.47"></script></div><script src="https://vdse.bdstatic.com//search-video.v1.min.js"></script><link rel='stylesheet' id='_main-css' href='/static/css/viewer.min.css' type='text/css' media='all'/><script type='text/javascript' src='/static/js/viewer.min.js?1'></script><script type='text/javascript' src='/static/js/jquery-viewer.min.js'></script><script>jQuery.fn.wait = function (func, times, interval) { var _times = times || -1, //100次 _interval = interval || 20, //20毫秒每次 _self = this, _selector = this.selector, //选择器 _iIntervalID; //定时器id if( this.length ){ //如果已经获取到了,就直接执行函数 func && func.call(this); } else { _iIntervalID = setInterval(function() { if(!_times) { //是0就退出 clearInterval(_iIntervalID); } _times <= 0 || _times--; //如果是正数就 -- _self = $(_selector); //再次选择 if( _self.length ) { //判断是否取到 func && func.call(_self); clearInterval(_iIntervalID); } }, _interval); } return this; } $("table.syntaxhighlighter").wait(function() { $('table.syntaxhighlighter').append("<p class='cnblogs_code_footer'><span class='cnblogs_code_footer_icon'></span></p>"); }); $(document).on("click", ".cnblogs_code_footer",function(){ $(this).parents('table.syntaxhighlighter').css('display','inline-table');$(this).hide(); }); $('.nphpQianCont').viewer({navbar:true,title:false,toolbar:false,movable:false,viewed:function(){$('img').click(function(){$('.viewer-close').trigger('click');});}}); </script></body></html>