-
Notifications
You must be signed in to change notification settings - Fork 11
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
replace center
with more general one
#12
Comments
Great idea! Could you detail for all the cases what would be the resulting code? |
yeah, sure. It's tedious to list resulting code for all 16 possible combinations of /* [horizontal] == left */
position: absolute;
left: 0;
/* [horizontal] == center */
position: absolute;
left: 50%;
transform: translateX(-50%);
/* [horizontal] == right */
position: absolute;
right: 0;
/* [horizontal] == fill */
position: absolute;
left: 0;
right: 0;
/* [vertical] == top */
position: absolute;
top: 0;
/* [vertical] == center */
position: absolute;
top: 50%;
transform: translateY(-50%);
/* [vertical] == bottom */
position: absolute;
bottom: 0;
/* [vertical] == fill */
position: absolute;
top: 0;
bottom: 0; Also, I'd like to add /* [horizontal] == outer-left */
position: absolute;
right: 100%;
/* [horizontal] == outer-right */
position: absolute;
left: 100%;
/* [vertical] == outer-top */
position: absolute;
bottom: 100%;
/* [vertical] == outer-bottom */
position: absolute;
top: 100%; The only problem with To be honest, I don't think that |
Sometimes it's need to center block only vertically or horizontally. Maybe it's worth to replace
center
with more generalalign( [vertical], [horizontal] )
.vertical
argument can be one oftop
,center
,bottom
andhorizontal
argument can be one ofleft
,center
,right
:Also It may be useful to have
fill
values for both arguments:All this behaviour can be implemented with
flexbox
method tooThe text was updated successfully, but these errors were encountered: