I'm trying to position an element by percentage but it didn't work out for me, it worked only when I used pixels.
Here is my code:
var x=document.getElementById("fir")
x.style.position = "absolute";
x.style.left = 10%
x.style.top = 10%
If I assigned to x.style.left any number followed by nothing it works fine but if I put percentage after the number like it's shown in the code above it doesn't work. Any ideas on how can I use the percentage to position this element?