页脚居中(圆形)Div
Center (Circle) Div in Footer
我的页脚中有一个圆圈 Div,我想将其置于页脚中心。
最后将连续出现 3 个圆圈。
我的 CSS:
.circle {
height: 50px;
width: 50px;
background-color: rgba(0, 0, 0, 0.90);
border-radius: 50%;
text-align: center;
font-size: 30px;
}
footer {
text-align: center;
position: fixed;
bottom: 0;
width: 100%;
background-color: green;
}
您可以使用 display:flex
和 align-items
& justify-content
来垂直和水平对齐它。
body, html {
padding: 0;
margin: 0;
}
footer {
width: 100%;
background-color: #dedede;
border-radius: 5px;
padding: 10px;
display: flex;
align-items: center;
justify-content: center;
}
.circle {
border-radius: 50%;
width: 40px;
height: 40px;
background-color: black;
}
<footer>
<div class="circle"></div>
</footer>
我的页脚中有一个圆圈 Div,我想将其置于页脚中心。
最后将连续出现 3 个圆圈。
.circle {
height: 50px;
width: 50px;
background-color: rgba(0, 0, 0, 0.90);
border-radius: 50%;
text-align: center;
font-size: 30px;
}
footer {
text-align: center;
position: fixed;
bottom: 0;
width: 100%;
background-color: green;
}
您可以使用 display:flex
和 align-items
& justify-content
来垂直和水平对齐它。
body, html {
padding: 0;
margin: 0;
}
footer {
width: 100%;
background-color: #dedede;
border-radius: 5px;
padding: 10px;
display: flex;
align-items: center;
justify-content: center;
}
.circle {
border-radius: 50%;
width: 40px;
height: 40px;
background-color: black;
}
<footer>
<div class="circle"></div>
</footer>