从文本框中选择下一个选择标记

时间:2017-12-17 19:53:51

标签: html css

我有这个电子邮件注册表。我想询问如何移动&#34;所需电子邮件地址&#34;旁边的<select>标记。领域。 我想我必须对css代码进行修改。 这是特定字段的html和CSS(代码段)代码:

(这是因为STACKOVERFLOW需要更多详细信息,因此需要更加详细信息)

&#13;
&#13;
body {
  background: #384047;
  font-family: sans-serif;
  font-size: 10px;
}

form {
  background: #fff;
  padding: 4em 4em 2em;
  max-width: 400px;
  margin: 50px auto 0;
  box-shadow: 0 0 1em #222;
  border-radius: 2px;
}

form h2 {
  margin: 0 0 50px 0;
  padding: 10px;
  text-align: center;
  font-size: 30px;
  color: #666666;
  border-bottom: solid 1px #e5e5e5;
}

form p {
  margin: 0 0 3em 0;
  position: relative;
}

form input[id="Email"] {
  display: block;
  box-sizing: border-box;
  width: 60%;
  outline: none;
  margin: 0;
}

form input {
  display: block;
  box-sizing: border-box;
  width: 100%;
  outline: none;
  margin: 0;
}

form input[type="text"],
form input[type="password"] {
  background: #fff;
  border: 1px solid #dbdbdb;
  font-size: 1.6em;
  padding: .8em .5em;
  border-radius: 2px;
}

form input[type="text"]:focus,
form input[type="password"]:focus {
  background: #fff;
}

form span {
  display: block;
  background: #F9A5A5;
  padding: 2px 5px;
  color: #100;
}

form input[type="submit"] {
  background: rgba(148, 186, 101, 0.7);
  box-shadow: 0 3px 0 0 rgba(123, 163, 73, 0.7);
  border-radius: 2px;
  border: none;
  color: #fff;
  cursor: pointer;
  display: block;
  font-size: 2em;
  line-height: 1.6em;
  margin: 2em 0 0;
  outline: none;
  padding: .8em 0;
  text-shadow: 0 1px #68B25B;
}

form input[type="submit"]:hover {
  background: #94af65;
  text-shadow: 0 1px 3px rgba(70, 93, 41, 0.7);
}

form label {
  position: absolute;
  left: 8px;
  top: 12px;
  color: #999;
  font-size: 16px;
  display: inline-block;
  padding: 4px 10px;
  font-weight: 400;
  background-color: rgba(255, 255, 255, 0);
  -moz-transition: color 0.3s, top 0.3s, background-color 0.8s;
  -o-transition: color 0.3s, top 0.3s, background-color 0.8s;
  -webkit-transition: color 0.3s, top 0.3s, background-color 0.8s;
  transition: color 0.3s, top 0.3s, background-color 0.8s;
}

form label.floatLabel {
  top: -11px;
  background-color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
}

form select {
  background: #fff;
  border: 1px solid #dbdbdb;
  font-size: 1.6em;
  padding: .8em .5em;
  border-radius: 2px;
  display: block;
}
&#13;
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>Mailbox Registration</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<form action="register.php" method="post">
<h2>Create a Mailbox</h2>
<p>
<label for="Name" class="floatLabel">First Name</label>
<input id="fname" name="First_Name__1" type="text" required>
</p>
<p>
<label for="Name" class="floatLabel">Last Name</label>
<input id="lname" name="Last_Name__2" type="text" required>
</p>
<p>
<label for="Mailbox__3" class="floatLabel">Desired Email Address</label>
<input id="Email" name="Mailbox__3" type="text" required>
<select name="domain">
<option value="@limesky.ga" selected>@limesky.ga
<option value="@ircocs.ga">@ircocs.ga
</select>
</p>
<p>
<label for="password" class="floatLabel">Password</label>
<input id="password" name="Password__4" type="password" required>     
</p>
<p>
<label for="confirm_password" class="floatLabel">Confirm Password</label>
<input id="confirm_password" name="confirm_password" 
type="password" required>      
</p>
<p>
<input type="Submit" value="Create My Account" id="Submit" name="Submit">
</p>
</form>
<script> src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3 /jquery.min.js' </script>
</body>
</html>
&#13;
&#13;
&#13;

enter image description here

2 个答案:

答案 0 :(得分:1)

这样做:

<强> CSS:

body {
 background: #384047;
 font-family: sans-serif;
 font-size: 10px;
}

.domain {
  margin-left: 253px;
  margin-top: -50px;
}

<强> HTML:

 <p>
  <label for="Mailbox__3" class="floatLabel">Desired Email Address</label>
  <input id="Email" name="Mailbox__3" type="text" required><select class="domain" name="domain">
          <option value="@limesky.ga" selected>@limesky.ga
          <option value="@ircocs.ga">@ircocs.ga
          </select>
 </p>

答案 1 :(得分:-1)

在所需的电子邮件地址输入框后添加<br/>标记。

<input id="Email" name="Mailbox__3" type="text" required></br><select name="domain">
            <option value="@limesky.ga" selected>@limesky.ga
            <option value="@ircocs.ga">@ircocs.ga
            </select>