Home >Web Front-end >HTML Tutorial >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:561286browse

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="https://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="https://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="https://m.php.cn/article.html" class="bBlack"><i>See more</i><b></b></a></em><div class="clear"></div></div><ins class="adsbygoogle" style="display:block" data-ad-format="fluid" data-ad-layout-key="-6t+ed+2i-1n-4w" data-ad-client="ca-pub-5902227090019525" data-ad-slot="8966999616"></ins><script> (adsbygoogle = window.adsbygoogle || []).push({}); </script><ul class="nphpXgwzList"><li><b></b><a href="https://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="https://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="https://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="https://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="https://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><ins class="adsbygoogle" style="display:block" data-ad-format="autorelaxed" data-ad-client="ca-pub-5902227090019525" data-ad-slot="5027754603"></ins><script> (adsbygoogle = window.adsbygoogle || []).push({}); </script><footer><div class="footer"><div class="footertop"><img src="/static/imghwm/logo.png" alt=""><p>Public welfare online PHP training,Help PHP learners grow quickly!</p></div><div class="footermid"><a href="https://m.php.cn/about/us.html">About us</a><a href="https://m.php.cn/about/disclaimer.html">Disclaimer</a><a href="https://m.php.cn/update/article_0_1.html">Sitemap</a></div><div class="footerbottom"><p> © php.cn All rights reserved </p></div></div></footer><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><!-- Matomo --><script> var _paq = window._paq = window._paq || []; /* tracker methods like "setCustomDimension" should be called before "trackPageView" */ _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); (function() { var u="https://tongji.php.cn/"; _paq.push(['setTrackerUrl', u+'matomo.php']); _paq.push(['setSiteId', '9']); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s); })(); </script><!-- End Matomo Code --></html>