【发布时间】:2020-11-05 07:38:00
【问题描述】:
我的 html 网站遇到问题。
我想在灰色框内添加我的脸
这是我的html代码:
<head>
<title>App</title>
<link rel="stylesheet" href="main.css">
</head>
<body>
<div class="profilePic"><img src="profilePic.png"></div>
<div class="sideBar"></div>
</body>
</html>
这是我的 CSS 代码:
@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@200&display=swap');
*{
padding:0px;
margin:0px;
}
.sideBar{
width:345px;
height:647px;
background-color:#e4e3e3;
}
.profilePic img{
position:relative;
width:100px;
height:100px;
border-radius: 100%;
}
如果这是一个简单的解决方案,请告诉我。
【问题讨论】:
-
你应该把带有 ProfilePic 类的整个 div 放在带有 Sidebar 类的 div 中:
-
让我试试
标签: html css layout css-position