Tool guide for PX conversion into REM

Source: Internet
Author: User

Now there are tools to do the conversion we can not need to calculate the various units, cut the image directly with PX, and then after the page cut, the style is thrown into the tool for conversion, in seconds can be the style of all PX units into REM.

First step: Add the root element to the page to calculate the JS code
(Function (doc, win) {  var docel = doc.documentelement,    resizeevt = ' orientationchange ' in window? ' Orientationchange ': ' Resize ',    recalc = function () {      var clientwidth = docel.clientwidth;      if (!clientwidth) return;      docEl.style.fontSize = * (clientwidth/320) + ' px ';    };  if (!doc.addeventlistener) return;  Win.addeventlistener (Resizeevt, Recalc, false);  Doc.addeventlistener (' domcontentloaded ', Recalc, False);}) (document, window);

  

Step two: Drop the CSS file you have written into the tool for conversion.

Here to explain why the various properties of the border is not processed, because border in the use of REM units under the support of the special poor, you may write 2rem or 3rem is useless by default will become 1px, so when using the border attribute is often not recommended to handle border.

Tool Address: Http://520ued.com/tools/rem

Tool guide for PX conversion into REM

Related Article

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.