无法获得正确的样式,我在这里缺少什么概念

  • 本文关键字:在这里 样式 html css
  • 更新时间 :
  • 英文 :


这是最终产品,我试图忽略背景色,因为浏览器中的背景色是黑色的。

在此处输入图像描述

这是我的审判。

在此处输入图像描述

这是我的HTML和CSS,请让我知道我缺少什么概念,我应该做什么,这样这个绿色容器就不会到处都是。此外,如果我删除inputwrapper,我会非常接近,但还不够接近。

这是我的HTML文件和CSS文件。

style.css

.container {
width: 100px;
min-height: 200px;
display: block;
border-radius: 12px;
padding-top: 20px;
background-color: green;
padding-left: 50%;
padding-right: 50%;
}
.inputWrapper label {
font-weight: bold;
margin-bottom: 10px;
align-items: flex-end;
justify-content: space-between;
}
/* .inputWrapper {
border: 5px solid darkblue;
width: 300px;
display:block;

} */

index.html文件是

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>Practice</title>
</head>
<body>

<div class="container">
<div class="inputWrapper">
<label for="username">Username</label>
<input type="text" name="username" id="username">
</div>
<div class="inputWrapper">
<label for="age">Age (Years)</label>
<input type="text" name="age" id="age">
</div>
<div>
<button type="submit">Add User</button> 
</div>
</div>
</div>

</body>
</html>
.container {
width:300px;
display:block;
border-radius: 12px;
padding:20px;
background-color: green;
margin:auto;
}

在css 中使用此

最新更新