Sindbad~EG File Manager

Current Path : /home/beeson/public_html/WebMathXpert/Demos/ParseAndDisplayDemo/
Upload File :
Current File : //home/beeson/public_html/WebMathXpert/Demos/ParseAndDisplayDemo/Ascent.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Font Ascent Example</title>
</head>
<body>
    <script>
        // Create a dummy element
        var dummyElement = document.createElement("div");
        dummyElement.innerHTML = "X"; // A character that typically extends above the baseline

        // Apply the font style
        dummyElement.style.font = "inherit";

        // Append the dummy element to the body
        document.body.appendChild(dummyElement);

        // Measure the dimensions
        var ascentInPixels = dummyElement.getBoundingClientRect().height;

        // Convert the ascent to em units
        var ascentInEm = ascentInPixels / parseFloat(getComputedStyle(document.body).fontSize);

        // Remove the dummy element
        document.body.removeChild(dummyElement);

        // Log the results
        console.log("Ascent in pixels:", ascentInPixels);
        console.log("Ascent in em units:", ascentInEm);
    </script>
</body>
</html>

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists