Since the last couple of things I’d like to see in CSS got thoroughly shot down I figured I’d throw out another. One thing that bothers me to no end is that % is always a percentage of the width, even if you are dealing with the height. It would be nice to be able to specify by placing h for height to the right of the %
%w would be permitted for clarity, but merely an alias to % by itself. Thoughts?
It’s essentially already here - a bit buggy, but here. It’s vw, vh, vmin and vmax. While the linked article talks about typography, it works on all elements (I recently used it on a background image to give me a responsive sizing logo)
vw = % of the viewport width
vh = % of the viewport height
vmin = % of whatever is smaller between the viewport height and the viewport width
vmax = % of whatever is larger between the viewport height and the viewport width.
Granted it’s limited because it’s based on the viewport and not the container it’s in, but it is there. You just have to think a different way.
As Ryan points out, that’s not really what I’m asking for. Percentages are far more likely to be accorded to the current element, or parent (depending on context) than the viewport. What you suggest is so useless that well planned em unit use would be far more effective.
Understandable. It’s technically been removed off of the official version of the draft, but those things change so often.
I actually did read through the ENTIRE CSS3/4 specification and highlighted the coolest features I found. If you are curious about some of the cool things coming up (some already sorta here like flexbox) then read this.