Can I convert % to pixels?

Hello all,
I want to make my pixel table match the percent table that is on top if it.
Is there a method to convert a 95% table to pixels?

Well, the 95% will be the percent of the parent it’s not exactly going to be like-for-like. Seems a peculiar request because; it’s kind of turned upon its head trying to get fixed pixels to match a flexible percentage.

No more than there is a method to convert cubic metres to radians per second. :slight_smile:

In other words: in a very special case (when you know the pixel width of the containing block) you can, but not in the general case.

If the containing block is 1,000 pixels, then a 95% table is 950 pixels.

That’s very true! Why didn’t I think of that? Thanks!

Of course most of the time you will not know any of the sizes in pixels and so wouldn’t be able to do that calculation.

Unless you know the viewport size (of the browsable window) the simple answer is no. Though you could always set minimum and maximum sizes using min/max-width if you’re trying to use a fluid style of layout (rather than a liquid layout). I’m surprised you would think such a conversion would be possible though… didn’t you take maths at school? Percentages are based on a base set of values (dynamic) where as fixed measurements remain constant. :slight_smile:

Why don’t you set the second table to be 95% as well, and get around it that way?