我要做的是在页面上居中设置标识的白色背景。有人能帮助我吗?
body {
background-image : url(black.jpg);
}
#bg {
background-color: white;
width: 1500px;
height: 1000px;
}
#logos{
margin-right : auto;
margin-left : auto;
}
#logos img{
width: 250px;
height: 100px;
}
<body>
<h1>Hello</h1>
<div id= "bg">
<div id="logos">
<img src="./logos/sb.png">
<img src="./logos/fb.png">
</div>
</div>
</body>
答案 0 :(得分:0)
也许只是这个:
body {
background: #000;
}
h1 {
color:#fff;
}
#logos {
background-color: white;
margin: 50px;
text-align:center;
padding:50px 0;
}
#logos img {
width: 250px;
height: 100px;
}
<body>
<h1>Hello</h1>
<div id="logos">
<img src="https://lorempixel.com/200/100/">
<img src="https://lorempixel.com/200/100/">
</div>
</body>
答案 1 :(得分:0)
这应该有效,希望有所帮助;)
body{
background-image : url(black.jpg);
}
#bg{
background-color: white;
width: 1500px;
height: 1000px;
}
#logos{
margin-right : auto;
margin-left : auto;
text-align:center;
}
#logos img{
width: 250px;
height: 100px;
display:inline-block;
}
<body>
<h1>Hello</h1>
<div id="bg">
<div id="logos">
<img src="./logos/sb.png">
<img src="./logos/fb.png">
</div>
</div>
</body>