-
Notifications
You must be signed in to change notification settings - Fork 716
Shorthand: Writing multiple properties in one line with the same value #6353
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Consider using variables: .box {
--value:50px;
width : var(--value) ;
height : var(--value) ;
padding : var(--value) ;
margin : var(--value) ;
} The file doesn't become smaller, but it becomes clear that you are deliberately setting the properties to the same value, and then if you want to change it into e.g. |
Also with variables, I should still repeat
It does. For the first example, I saved 27 characters. Now imagine the impact on the whole project. |
I mean the file doesn't become smaller when using variables (unless the values are very long). Anyways, if you worry about big files because they take more time to download, consider using compression like gzip in the HTTP. That should have a much bigger impact than your proposal, since I don't think it happens much frequently that you want to assign the same value to several properties. |
There’s #820 which would get you this: .box {
size: 50px;
padding: 50px;
margin: 50px;
} It’s rare that padding and margin or the dimensions have the same value, so there is absolutely no need or value in making it any shorter to write than this. |
@Crissov .box {
display: flex;
size: 50px;
`justify-content align-items text-align` : center;
`overflow visibility` : hidden;
`border-radius padding` : 5px;
} |
I was thinking about it afresh, It might not worth wasting time on this kind of feature. |
Though CSS is cascading, properties come after each other and it is the most common expected situation:
Original:
But what could happen if it was possible to make it more simple like this:
Shorthand:
That idea can change and make things simpler and the result will be smaller file size and more readability for CSS codes, Im curious if it will be possible natively without any preprocessor?
The text was updated successfully, but these errors were encountered: