1

.container {
  margin-top: 25px;
}

.login {
  background-color: #e67624;
  border-radius: 5px;
  width: 470px;
  float: left;
}

.login h2 {
  margin-left: 20px;
}

.login input:first-of-type {
  margin-left: 20px;
}

.login input {
  padding: 5px;
  margin-right: 12px;
}

.login [type=submit] {
  background-color: #444444;
  border: none;
  color: #a0a0a0;
  width: 90px;
}

.subscripe {
  margin-top: 25px;
  background-color: #01d4f3;
  border-radius: 5px;
  width: 500px;
}

.subscripe h2 {
  margin-left: 20px;
}

.subscripe [type=text] {
  margin-left: 20px;
}
<div class="container">

  <form class="login">
    <h2>Member login</h2>
    <input type="text" name="name" placeholder="User name">
    <input type="password" name="password" placeholder="Password">
    <input type="submit" name="submit" value="Log me in.">
  </form>


  <form class="subscripe">
    <h2>Subscribe to our weekly newsletter</h2>
    <input type="text" name="email" placeholder="email address">
    <input type="submit" name="submit" value="Subscribe">
  </form>

</div>

Должно быть 2 формы на одному уровне. Ширина указана, но форму переносит почему-то вниз. Что тут не так?

1 ответ 1

1

я правильно понял, так?

.container {
  margin-top: 25px;
}

.login {
  background-color: #e67624;
  border-radius: 5px;
  width: 50%;
  float: left;
  display: inline-block;
}

.login h2 {
  margin-left: 20px;
}

.login input:first-of-type {
  margin-left: 20px;
}

.login input {
  display: block;
  margin-left: 20px;
  padding: 5px;
  margin-right: 12px;
  margin-bottom: 5px;
}

.login [type=submit] {
  background-color: #444444;
  border: none;
  color: #a0a0a0;
  width: 90px;
  margin-left: 20px;
}

.subscripe {
  float: left;
  display: inline-block;
  background-color: #01d4f3;
  border-radius: 5px;
  width: 45%;
}

.subscripe h2 {
  margin-left: 20px;
}

.subscripe [type=text] {
  margin-left: 20px;
}
<div class="container">
  <form class="login">
    <h2>Member login</h2>
    <input type="text" name="name" placeholder="User name">
    <input type="password" name="password" placeholder="Password">
    <input type="submit" name="submit" value="Log me in.">
  </form>
  <form class="subscripe">
    <h2>Subscribe to our weekly newsletter</h2>
    <input type="text" name="email" placeholder="email address">
    <input type="submit" name="submit" value="Subscribe">
  </form>
</div>

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.