Anyone think this might be useful? Something like this
#selector
{
top,right,bottom,left:0;
}
Instead of having to write each out? Just another stupid idea I had.
Anyone think this might be useful? Something like this
#selector
{
top,right,bottom,left:0;
}
Instead of having to write each out? Just another stupid idea I had.
Could save a few bytes
How is that different from this?
{
margin: 4px; /* assumes all four sides */
}
or
{
margin: 0 4px 12px 0; /* top right bottom left (respectively) */
}
Or has that format fallen out of fashion?
It’s hasn’t. However you can’t do that for top/right/bottom/left in my example.
Perhaps you want something like this too.
#selector
{
border-color, background:#000
}
Ah. That is a better example.
This is why Pre-Processors, like SASS, were developed. I don’t have much experience [yet] with them but is is a DRY approach to CSS.
I don’t hate everything about preprocessors, but I do hate majority of it. I do believe that some specific features of preprocessors should be brought over and made available in native CSS.
However, this is likely to not happen (at least not for a while) which saddens me .
I use these 2 constantly
@mixin mpz() {
margin: 0;
padding: 0;
}
@mixin mza() {
margin: 0 auto;
}
.t1 { @include mpz(); }
.t2 { @include mza(); }
This would never happen, because it would probably be solved by variables first. Which I’ve heard mention that were one of the top things discussed for the next versions of CSS. Though I can’t say where I saw that or if it’s true. But this is probably the #1 reason people start switching to Preprocessors in the first place.
Something like.
$darkColor: #000;
#selector {
border-color: $darkColor;
background: $darkColor;
}
or even better
#selector {
border-color: lighten($darkColor, 10%);
background: $darkColor;
}
Yup, variables are definitely being discussed right now at the W3C. I wrote about it a couple months ago on my website; it’s one of the forefronts currently being discussed. You are correct. I don’t know when anything would actually be put into place though so it may be a year or two. Who knows .
I’d be fine with variables actually. That would make this even more diverse!
Got curious and googled it:
Not elegant, but they look functional.
Yeah it’s a while before they will ever be usable though. FF has supported them for a few versions now but support is literally non existent for every other major browser. It’ll be a couple years before all the browsers even have it implemented and is in long enough for all users to be on a browser upgraded enough to be of use in websites.
Oh well. Either way, it’s neat that it’s finally being put into use.
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.