Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 在侧边栏中居中显示图像_Html_Css_Sidebar - Fatal编程技术网

Html 在侧边栏中居中显示图像

Html 在侧边栏中居中显示图像,html,css,sidebar,Html,Css,Sidebar,在这里尝试最佳实践,我对编码是新手。我有两张图片在右边的边栏里。侧边栏看起来不错(涂成红色,这样我就可以看到发生了什么),但我无法将这两个图像集中在一列中。我的css有什么问题 html: 您需要在图像上显示:块,以便边距:0自动工作: .sponsor_button img { display: block; margin-left: auto; margin-right: auto; } 或者您可以在容器上尝试text align:center: .right_b

在这里尝试最佳实践,我对编码是新手。我有两张图片在右边的边栏里。侧边栏看起来不错(涂成红色,这样我就可以看到发生了什么),但我无法将这两个图像集中在一列中。我的css有什么问题

html:


您需要
在图像上显示:块
,以便
边距:0自动
工作:

.sponsor_button img {
    display: block;
    margin-left: auto;
    margin-right: auto;
}
或者您可以在容器上尝试
text align:center

.right_bar {
    text-align: center;
}

您需要在图像上显示
display:block
,以便
margin:0 auto
工作:

.sponsor_button img {
    display: block;
    margin-left: auto;
    margin-right: auto;
}
或者您可以在容器上尝试
text align:center

.right_bar {
    text-align: center;
}

您需要在图像上显示
display:block
,以便
margin:0 auto
工作:

.sponsor_button img {
    display: block;
    margin-left: auto;
    margin-right: auto;
}
或者您可以在容器上尝试
text align:center

.right_bar {
    text-align: center;
}

您需要在图像上显示
display:block
,以便
margin:0 auto
工作:

.sponsor_button img {
    display: block;
    margin-left: auto;
    margin-right: auto;
}
或者您可以在容器上尝试
text align:center

.right_bar {
    text-align: center;
}

使用
display:inline
将其置于同一列中

。右\u栏{
位置:绝对位置;
右:0;
宽度:20%;
背景色:红色;
}
.赞助商按钮img{
显示:内联;
左边距:自动;
右边距:自动;

}
使用
display:inline
将其置于同一列中

。右\u栏{
位置:绝对位置;
右:0;
宽度:20%;
背景色:红色;
}
.赞助商按钮img{
显示:内联;
左边距:自动;
右边距:自动;

}
使用
display:inline
将其置于同一列中

。右\u栏{
位置:绝对位置;
右:0;
宽度:20%;
背景色:红色;
}
.赞助商按钮img{
显示:内联;
左边距:自动;
右边距:自动;

}
使用
display:inline
将其置于同一列中

。右\u栏{
位置:绝对位置;
右:0;
宽度:20%;
背景色:红色;
}
.赞助商按钮img{
显示:内联;
左边距:自动;
右边距:自动;
}