-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
Sometimes it's need to center block only vertically or horizontally. Maybe it's worth to replace center
with more general align( [vertical], [horizontal] )
. vertical
argument can be one of top
, center
, bottom
and horizontal
argument can be one of left
, center
, right
:
/* before */
.centered {
@util align(center, center);
}
.aligned {
@util align(bottom, right);
}
/* after */
.centered {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.aligned {
position: absolute;
bottom: 0;
right: 0;
}
Also It may be useful to have fill
values for both arguments:
/* before */
.fill-horizontally {
@util align(center, fill);
}
/* after */
.fill-horizontally {
position: absolute;
top: 50%;
left: 0;
rigth: 0;
transform: translateY(-50%);
}
All this behaviour can be implemented with flexbox
method too
Metadata
Metadata
Assignees
Labels
No labels