就像标题所说的那样,我怎样才能将元素水平居中?仅使用CSS进行此操作的主要奖励点.
.center {
text-align: center;
align-self: center:
margin: 0 auto;
}
.expander_link {
padding-top: 50px;
padding-bottom: 50px;
margin: 0 auto;
font-size: 100%;
font-weight: bold;
color: hotpink;
text-align: center;
align-self: center;
text-decoration: none;
}
hello
blah blah blah blah blah blah blah blah blah blah
center me horizontally
你应该尝试这样 -
.center {
text-align: center;
/*align-self: center;*/
margin: 0 auto;
}
.expander_link {
padding-top: 50px;
padding-bottom: 50px;
margin: 0 auto;
font-size: 100%;
font-weight: bold;
color: hotpink;
text-align: center;
align-self: center;
text-decoration: none;
display: block;
}
hello
blah blah blah blah blah blah blah blah blah blah
center me horizontally