我是HTML和CSS的新手。我试图将图像居中放置在容器的顶部中心,然后在其下方添加文本。 我不确定在这里哪里出错了
body {
margin: 0;
}
h1, h2 {
font-family: 'Amatica SC', cursive;
font-weight: 700;
text-align: center;
}
p {
font-family: 'Open Sans Condensed', sans-serif;
}
.header {
background-color: skyblue;
height: 100px;
text-align: center;
color: #4f889f;
padding: 1px;
}
.container div {
padding: 1%;
box-sizing: border-box;
min-height: 500px;
}
#container .left-col img {
min-width: 70px;
min-height: 70px;
max-width: 250%;
max-height: 250%;
top: -50%;
left: -50%;
bottom: -50%;
right: -50%;
position: absolute;
}
.left-col, .right-col {
background-color: #f4f4f4;
width: 25%;
float: left;
}
<body>
<div class="header">
<h1>The 3 Column Layout</h1>
</div>
<div class="container">
<div class="left-col">
<img src="Cyber.jpg" width="200" height=150"/>
</div>
</div>
</body>