Mobile Web page Font size three

Source: Internet
Author: User

<ScriptType="Text/javascript" >(function(Doc, Win) {var docel = doc.documentelement, resizeevt =' Orientationchange 'InchWindow?' Orientationchange ': ' resize ', Recalc = function  () {var clientwidth = docel.clientwidth; if (!clientwidth) return; docEl.style.fontSize = 64 * (clientwidth/640) +  ' px ';}; if (!doc.addeventlistener) return; Win.addeventlistener (RESIZEEVT, Recalc , false); Doc.addeventlistener ( ' domcontentloaded ', Recalc, false);}) (document, window); </SCRIPT>         

Among them, docEl.style.fontSize = 64 * (clientWidth / 640) + ‘px‘ 64 is html set in font-size , 640 is psd the image width, also said if PSD the design 750px, then this side is 75px . You can try it, the last html font size that comes into effect is the same as the font size on the http://m.taobao.com html .
PS: The first person to answer the question, use your code.

Mobile Web page Font size three

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.