When using px for width and height, wouldn't it be pointless to use percent for the gradient also?

When using px for width and height, wouldn’t it be pointless to use percent for the gradient also?

It’s not going to increase in size so, wouldn’t it make sense to keep the gradient at px and not change it to percentage cause there’s not going to be a difference?

And you shouldn’t be combining them both right?

Either use % or px, don’t use both?

I’m not going to change px to percent if it doesn’t make sense to given that I’m using px for width and height.

If you have a fixed width element, and you want a gradient with fixed dimensions to fit inside it, then yes - using pixels is fine.

The advantage of using percentages is that it will scale up and down for a fluid sized element. These days, when accomodating mobile phones and other devices is an important consideration, there are many places where you would not want to be using fixed dimensions.

2 Likes

If you have a fixed pixel width that is not going to change then use pixels to divide it up and not percentage if you want to avoid rounding errors.

2 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.