Can I convert pixels to %?

convert pixels to % ?

250px = … % ?

The question becomes, “% of what?”

If your element is inside a container of width: 1000px, then width: 250px = width: 25%. Etc. :slight_smile:

To clarify the math you will need to divide the width of your smaller element by the width of the container and then multiply by a 100 to achieve a percentage value.

e.g. in Ralph’s example 250 divided by 1000 = .25 and then multiply by 100 = 25%

If the container was 1200px and your element was 200px then 200/1200 =.1666 x 100 = 16.6%