表单滚动到页面横幅的顶部

时间:2020-03-18 15:29:29

标签: html forms css-position

希望您能为我提供帮助-我正在创建一个脱机申请表,并已对以下内容进行了调整以适合我的需要,这就是我在w3schools.com上找到的内容。

我设法将其重新放置在页面上,但是,我在页面顶部有一个横幅,当您滚动表单时,它会滚动到横幅顶部而不是后面。

横幅是图像。

<img src='Filelocation\teal banner.PNG'style='position:fixed;top:0px;left:0px;width:100%;height:15%;z-index:-1;'>

您能建议一个解决方法吗?

下面的表单代码

<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {font-family: Arial, Helvetica, sans-serif;}
* {box-sizing: border-box;}

input[type=text], select, textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
  margin-top: 6px;
  margin-bottom: 16px;
  resize: vertical;
}

input[type=submit] {
  background-color: #4CAF50;
  color: white;
  padding: 12px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

input[type=submit]:hover {
  background-color: #45a049;
}

.container {
  border-radius: 5px;
  background-color: #f2f2f2;
  padding: 20px;
}
</style>
</head>
<body>

<h3>Contact Form</h3>

<div class="container">
  <form action="/action_page.php">
    <label for="fname">First Name</label>
    <input type="text" id="fname" name="firstname" placeholder="Your name..">

    <label for="lname">Last Name</label>
    <input type="text" id="lname" name="lastname" placeholder="Your last name..">

    <label for="country">Country</label>
    <select id="country" name="country">
      <option value="australia">Australia</option>
      <option value="canada">Canada</option>
      <option value="usa">USA</option>
    </select>

    <label for="subject">Subject</label>
    <textarea id="subject" name="subject" placeholder="Write something.." style="height:200px"></textarea>

    <input type="submit" value="Submit">
  </form>
</div>

</body>```

0 个答案:

没有答案
相关问题