{"id":"css-px-to-rem","version":"1.0.0","description":"Convert px to rem or em with a supplied root or parent font size; returns an exactly rounded relative length.","supported_operations":["convert 24px to rem with 16px root","px to rem","calculate rem from pixels","convert pixels to em with parent font size","pixel value in em","CSS pixels to a relative length"],"unsupported_operations":["resolve inherited font sizes","evaluate calc() or CSS variables","convert viewport or container units"],"semantics":["relative_unit rem requires root_font_size_px; relative_unit em requires parent_font_size_px, and the other context field is rejected.","The exact ratio is px divided by the supplied positive context font size; decimal strings are parsed as rational numbers.","decimals selects 0 through 18 digits after the decimal point; ties round away from zero and trailing zeroes are retained.","CSS font-relative semantics follow CSS Values and Units Level 4 WD 2024-03-12, section 6.1; no browser style resolution is performed."],"limits":{"max_input_bytes":256,"max_decimal_chars":64,"max_decimals":18,"max_items":1,"max_iterations":80,"max_output_bytes":256},"pricing":{"status":"unpriced","charge_usd":null},"input_schema":{"type":"object","additionalProperties":false,"required":["px","relative_unit","decimals"],"properties":{"px":{"type":"string","minLength":1,"maxLength":64,"pattern":"^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$"},"relative_unit":{"type":"string","enum":["rem","em"]},"root_font_size_px":{"type":"string","minLength":1,"maxLength":64,"pattern":"^(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$"},"parent_font_size_px":{"type":"string","minLength":1,"maxLength":64,"pattern":"^(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$"},"decimals":{"type":"integer","minimum":0,"maximum":18}}},"output_schema":{"type":"object","additionalProperties":false,"required":["value","unit","standard_version","data_version"],"properties":{"value":{"type":"string"},"unit":{"type":"string","enum":["rem","em"]},"standard_version":{"const":"CSS Values and Units Level 4 WD 2024-03-12"},"data_version":{"const":"css-absolute-length-ratios-2024-03-12"}}},"examples":[{"input":{"px":"24","relative_unit":"rem","root_font_size_px":"16","decimals":2},"output":{"value":"1.50","unit":"rem","standard_version":"CSS Values and Units Level 4 WD 2024-03-12","data_version":"css-absolute-length-ratios-2024-03-12"}},{"input":{"px":"20","relative_unit":"em","parent_font_size_px":"24","decimals":6},"output":{"value":"0.833333","unit":"em","standard_version":"CSS Values and Units Level 4 WD 2024-03-12","data_version":"css-absolute-length-ratios-2024-03-12"}}],"execute_url":"/v1/tools/css-px-to-rem/versions/1.0.0/execute"}