【发布时间】:2020-10-11 08:35:50
【问题描述】:
这可能是一个非常简单的问题,但不知怎的,我自己解决不了。
我有一个联系表单,我想在右侧显示输入字段的标题,在左侧显示输入,例如:
名称:[输入]
HTML:
<main>
<div class="contact_form">
<div class="container">
<form action="/php/action_page.php" method="POST">
<label for="name" style="display: inline-block; text-align: left;">Vorname:</label>
<input
type="text"
id="name"
name="name"
>
<input
type="email"
id="email"
name="email"
placeholder="Deine E-Mail-Adresse... "
/>
<textarea
id="subject"
name="subject"
placeholder="Deine Nachricht..."
style="height: 200px;"
></textarea>
<input type="submit" value="Submit" />
</form>
</div>
</div>
</main>
CSS:
.contact_form {
grid-row: 2;
grid-column: 1/4;
justify-content: center;
align-items: center;
}
input[type="text"],
select {
width: 100%;
padding: 12px;
border: none;
border-bottom: solid black 2px;
box-shadow: none;
margin-top: 6px;
margin-bottom: 16px;
resize: vertical;
color: black;
background-color: white;
}
textarea{
width: 100%;
padding: 12px;
border: solid black 2px;
box-shadow: none;
box-sizing: border-box;
margin-top: 6px;
margin-bottom: 16px;
resize: vertical;
background-color: white;
}
input[type="email"] {
width: 100%;
padding: 12px;
border: none;
border-bottom: 2px solid black;
box-sizing: border-box;
margin-top: 6px;
margin-bottom: 16px;
resize: vertical;
color: black;
background-color: white;
}
input[type="submit"] {
background-color: black;
color: white;
padding: 12px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}
input[type="submit"]:hover {
background-color: #383838;
}
.container {
border-radius: 5px;
background-color: transparent;
padding: 20px;
}
.container p {
color: white;
font-family: PTS;
font-size: 25px;
}
您可以在以下位置找到联系表格:http://charlyscarface.com/problem/
我尝试将标签和输入字段放在一个 div 中,但它仍然显示为两行。
可能是,我正在监督一些展示声明之类的。
【问题讨论】:
-
您将输入文本宽度设置为 100%。没有其他东西可以放在同一条线上。
-
您正在使用输入宽度为 100% 将其更改为 90% 就可以了
-
我能解决您的疑问吗?如果是,请接受我的回答。