Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

window.getComputedStyle(element).width does not return the correct size in pixels #1440

Open
jgonte opened this issue May 19, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@jgonte
Copy link

jgonte commented May 19, 2024

Describe the bug
window.getComputedStyle(element).width does not return the correct size in pixels

To Reproduce
Steps to reproduce the behavior:
const e= document.createElement('div');

document.body.appendChild(e);

e.style.width = "10ch";

const width= window.getComputedStyle(e).width;

width equals "10ch"

Expected behavior
It should be the size in pixels, for example "120px"

@jgonte jgonte added the bug Something isn't working label May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant