【发布时间】:2019-11-17 07:57:10
【问题描述】:
我使用 margin-left 属性定位了表单,但它添加了一个水平滚动条,在页面右侧创建了额外的空白区域。以下是我在上面使用的 CSS。
.form {
width:100%;
margin-left:35%;
box-sizing: border-box;
}
如何去掉右边的空白?
编辑:
<!DOCTYPE html>
<html>
<head>
<title>Forms</title>
<script type="text/javascript" src="../js/script.js"></script>
<link rel="stylesheet" type="text/css" href="../css/forms.css">
</head>
<body id="formbody">
<h3 class="formheader">create a new account</h3>
<form action="#" target="_self" class="form">
<input type="text" name="firstname" class="input text" placeholder="firstname">
<input type="text" name="lastname" class="input text" placeholder="lastname">
<div class="genderholder">
<h4 class="genderheader">Gender</h4>
<label class="genderlabel">male <input type="radio" name="gender" class="input radio"></label>
<label class="genderlabel">female <input type="radio" name="gender" class="input radio"></label>
<label class="genderlabel">others <input type="radio" name="gender" class="input radio"></label>
</div>
<select class="input country">
<option>Select a Country</option>
</select>
<div class="holder">
<h4 class="dobheader">Date of birth</h4>
<select id="day" class="input day">
<option>Day</option>
</select>
<select class="input month">
<option>Month</option>
</select>
<select class="input year">
<option>Year</option>
</select>
</div>
<input type="email" name="email" class="input email" placeholder="email">
<input type="submit" name="signup" value="sign up" class="input submit">
</form>
</body>
</html>
【问题讨论】:
-
请发布您的html代码
-
@SaiManoj 添加了 html 代码。
-
我已经发布了答案。看看吧
-
可能有一些内部形式推动了额外的空间。你能提供所有其他类/css的小提琴或钢笔吗?