我想在响应式图片上放置一个表单,我想让表单也响应式并根据图片调整大小
目前图像是响应式的,但我无法将表单粘贴在图像的一个位置并在同一位置调整大小
这可能吗?
最佳答案
以下仅对应于您提供的页面的表单部分。
我已经删除了图像元素并使用资源链接作为表单元素的背景图像。表单字段用 Bootstrap 类包装。
已在表单元素上设置了最小高度,以防止背景图像变形过多。
HTML:
<!--- bootstrap style sheet -->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<!-- form section -->
<section id="contact class" class="container content-section text-center">
<h1 class="brand-heading">Contact</h1>
<div class="container-fluid">
<div class="row">
<!---
under the grid system, one row has can have 12 columns
we'll use 3 columns on each side for spacing,
6 columns for the form.
the form is done the bootstrap way, less the validation.
you need to add in hte missing fields yourself.
--->
<div class="col-md-3"></div>
<div class="col-md-6">
<form id="responsiveForm" action="">
<div class="form-group">
<label for="name">Name:</label>
<input type="text" class="form-control" id="name" name="name"/>
</div>
<div class="form-group">
<label for="email">Email:</label>
<input type="text" class="form-control" id="email" name="email"/>
</div>
<div class="form-group">
<label for="occasion">Occasion:</label>
<input type="text" class="form-control" id="occasion" name="occasion"/>
</div>
<div class="form-group">
<input type="submit" name="submit" class="form-control btn btn-primary" value="go"/>
</div>
</div>
</form>
</div>
<div class="col-md-3"></div>
</div>
</div>
</section>
CSS:
#responsiveForm{
background-image: url("http://s02.justpaste.it/files/justpaste/d233/a9446587/playingcardtemplate_small.png");
background-size: cover;
background-size: 100% 100%;
min-height: 650px;
padding: 80px;
padding-top: 120px;
}
在 Codepen 中查看
编辑:只是对图像的一点思考。如果你想为你的表格使用背景。你应该先做表格,找出那个表格的大小,然后把你的形象塑造成那个比例。
关于html - 响应式图像之上的响应式表单? - Bootstrap ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31294236/