Instead of having:
right:0px;
left:0px;
top:0px;
bottom:0px;
Can I have something like this?
sides:0px;
The outline-offset property adds space between the outline and the edge or border of an element. The space between an element and its outline is transparent. Outlines differ from borders in three ways: An outline is a line drawn around elements, outside the border edge.
The outline-offset CSS property sets the amount of space between an outline and the edge or border of an element.
By default, the offset value is applied to all record types with a current offset value of zero.
No, there does not exist a shorthand sides
property for setting the offsets. You have to set them all separately.
There are shorthands for other kinds of properties that involve the sides of a box, e.g. margin
, padding
and border
, but not for the positional offsets top
, right
, bottom
and left
.
If you're using a preprocessor such as LESS or Sass, then yes, you can. If you're using vanilla CSS, then no, not yet.
.sides (@length) {
top: @length;
bottom: @length;
left: @length;
right: @length;
}
div {
.sides(0px);
}
@mixin sides($length) {
top: $length;
bottom: $length;
left: $length;
right: $length;
}
div {
@include sides(0px);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With