我试着实现一些CSS来将我的表单向上或向下移动,我仍然不能让它移动,我似乎不知道为什么,我尝试使用填充和页边距,我仍然无法让它工作,css确实出现在页面上,但是没有任何东西会移动,它们都只会附着在屏幕顶部的导航栏上。附件是页面和CSS的html。
Css
.main2{
top:40px;
margin-left:70px;
width: 90%;
height:75%;
background-color: #36454F;
position:fixed;
padding-top: 100%;
padding-bottom: 1%;
}
.contact-form {
float:right;
background-color:white;
margin-right:10px;
width: 30%;
margin-top:28px;
}
以下是html代码
<!DOCTYPE html>
{% extends 'parasites_app/base.html' %}
{% load static %}
{% block content_block %}
<link rel="stylesheet" type="text/css" href="{% static 'css/Contact.css' %}" xmlns="http://www.w3.org/1999/html"/>
<div class="main" >
<div class="main2">
<form id="user_form" class="contact-form" method="POST" action='/Contact/' enctype="multipart/form-data">
<div class="contact-container">
<h2>Contact Us</h2>
{% csrf_token %}
Email<input type="text" name="Email" value="" size="30" />
<br />
Question<input type="text" name="Quesstion" value="" size="50" />
<br />
<!-- Submit button-->
<div>
<button type="submit" class="submit-button">Send Request</button>
</div>
</div>
</form>
</div>
</div>
{% endblock %}
发布于 2022-02-01 07:16:18
将您的联系人表格设置为“绝对”。然后,您可以使用上/右/下/左将其放置在固定容器中的任何位置。
https://stackoverflow.com/questions/70942803
复制