Html 居中对齐div文本对齐不起作用
我希望圆在768网格的中心对齐 HTML 试试这个 试试这个 由于我们知道圆圈的宽度,我们可以使圆圈的容器Html 居中对齐div文本对齐不起作用,html,css,alignment,Html,Css,Alignment,我希望圆在768网格的中心对齐 HTML 试试这个 试试这个 由于我们知道圆圈的宽度,我们可以使圆圈的容器(.Icon\u Wrapper)具有其宽度,并通过边距:auto将其与页面中心对齐 由于我们知道圆圈的宽度,我们可以使圆圈的容器(.Icon\u Wrapper)具有其宽度,并通过边距:auto将其与页面中心对齐 试试这个: .Circle{ margin:auto; height:170px; width:170px; border-radius:17
(.Icon\u Wrapper)
具有其宽度,并通过边距:auto将其与页面中心对齐
由于我们知道圆圈的宽度,我们可以使圆圈的容器(.Icon\u Wrapper)
具有其宽度,并通过边距:auto将其与页面中心对齐
试试这个:
.Circle{
margin:auto;
height:170px;
width:170px;
border-radius:170px;
background:#949393;
text-align:center;
}
.Circle .CircleWrapper {
display: table-cell;
height: 170px;
padding: 0;
vertical-align: middle;
}
在行动中看到它-尝试以下方法:
.Circle{
margin:auto;
height:170px;
width:170px;
border-radius:170px;
background:#949393;
text-align:center;
}
.Circle .CircleWrapper {
display: table-cell;
height: 170px;
padding: 0;
vertical-align: middle;
}
查看操作-但圆圈在哪里?您是否检查了小提琴中的小提琴请减小输出屏幕尺寸但圆圈在哪里?您是否检查了小提琴中的小提琴请减小输出屏幕尺寸您是否可以解释为什么为自动加边距自动加边距是为了从两侧提供相等的边距。圆圈中的文本不是中间对齐+1表示答案@AlexThomas yep,这就是为什么它没有被接受为答案宽度:170px;保证金:自动;答案的最简单解决方案是什么?卡瓦内什的答案被接受为答案。你能解释为什么给automargin auto的边距是为了给两边提供相等的边距。圆圈中的文本不是中间对齐的+1表示答案@AlexThomas yep这就是为什么它没有被接受为答案宽度:170px;保证金:自动;最简单的答案是什么?卡瓦内什的答案被接受为答案。你能解释一下为什么会给保证金吗auto@user3127499使用边距:auto
,可以将左右边距设置为auto,使元素在容器内水平居中。边距是否仅在给定宽度时自动工作,并且可以解释什么是保证金:自动和保证金:10px自动和保证金:自动;差别is@AlexThomas塔克斯bro@AlexThomas谢谢你向他解释我的工作有点忙:)你能解释一下为什么要给保证金吗auto@user3127499使用margin:auto
,可以将左右边距设置为auto,使元素在容器内水平居中。边距是否仅在宽度你能解释一下margin:auto和margin:10px auto和margin:auto是什么意思吗;差别is@AlexThomas塔克斯bro@AlexThomas谢谢你向他解释我的工作有点忙:)检查你的小提琴它仍然与左边对齐检查你的小提琴它仍然与左边对齐
.Circle{
margin:10px auto;
height:170px;
width:170px;
border-radius:170px;
background:#949393;
display:block;
vertical-align:middle;
text-align:center;
}
.Icon_Wrapper {
text-align: left;
height: 100%;
width: 170px;
margin: auto;
}
.Circle{
margin:auto;
height:170px;
width:170px;
border-radius:170px;
background:#949393;
text-align:center;
}
.Circle .CircleWrapper {
display: table-cell;
height: 170px;
padding: 0;
vertical-align: middle;
}