【发布时间】:2021-10-19 09:39:21
【问题描述】:
我正在尝试构建一个表单。我想为此添加背景颜色,但该颜色正在页面中显示。
我尝试了清除、阻止和一切。当我检查时,它显示背景颜色有效,但它没有显示页面上的颜色。
这是 HTML 代码:
<?php //include 'session.php'; ?>
<html>
<head>
<title>User Edit Form</title>
<link href="css/style.css" rel='stylesheet' type='text/css' />
</head>
<body class="UserEdit">
<div class=" container">
<div class="edit_form">
<div class="form_start">
<h1>This Form Page for UserEdit Page</h1>
</div>
</div>
<div class="clearfix"> </div>
</div>
</body>
</html>
在这里,我只想为 .edit_form div 添加背景颜色。但它不起作用。
这是 CSS:
.edit_form {
margin: auto;
width: 50%;
background: red;
}
.form_start {
position: fixed;
top: 4em;
background: rgb(0 0 0 / 0%);
box-sizing: border-box;
box-shadow: 0 15px 25px rgb(0 0 0 / 60%);
border-radius: 10px;
}
我添加了屏幕截图以便更好地理解。 Image of problem with inspect
【问题讨论】:
-
.form_start position:fixed 会导致您的问题。
标签: html css forms background-color