简体   繁体   English

如何在html中调整表格和图像的位置?

[英]How to adjust placing of forms and image within a section in html?

My following code shows that both form and img tags are enclosed with in the same section tag. 我的以下代码显示,form和img标签都包含在同一section标签中。

码

But form is displayed above the img. 但是表格显示在img 上方 As shown in the figure 如图所示

网页图片

I want it to be displayed on the background img. 我希望它显示背景img上。 How can I do it? 我该怎么做?

Form elements are Block level meaning they will take up the entire width of the viewport. 表单元素是块级的,这意味着它们将占据视口的整个宽度。 If you want it to float ontop of your image, either set the image as a background-image of the section, or even better, absolutely position the form over the top: 如果您希望它漂浮在图像的顶部,则可以将图像设置为该部分的背景图像,或者甚至更好,将表单绝对定位在顶部:

section {
  position: relative;
}
form {
  position: absolute;
  top: 0;
  width; 100%;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM