提问者:小点点

按钮文本不能正确对齐


我目前正在克隆一个站点,在“输入电子邮件”输入中,文本不会对齐,并粘在输入的底部,我更希望它在中间的左边。我该怎么解决这个?感谢任何帮助<3

null

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&display=swap");
:root {
  --primary-text: #111111;
  --secondary-text: #91908f;
  --background: #fffefc;
  --btn-primary: #e16259;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--b);
  font-family: "Inter", sans-serif;
}


/* NAV */

header img {
  float: left;
  max-width: 100%;
  height: 50px;
  margin: 15px 60px;
}

header nav {
  float: right;
  margin-top: 30px;
  padding-right: 20px;
}

header nav a,
header nav .vertical-line {
  padding-right: 15px;
  text-decoration: none;
  color: #111111;
  font-weight: 500;
}

header nav a:hover {
  text-decoration: underline;
}


/* Hero Section */

.hero {
  padding-top: 120px;
}

.hero-img {
  display: flex;
  justify-content: center;
  max-width: 100%;
  height: 200px;
}

h1 {
  font-size: 70px;
  text-align: center;
  padding-top: 15px;
}

h4 {
  text-align: center;
  font-weight: 200;
  font-size: 20px;
  color: #91908f;
}

form {
  display: flex;
  justify-content: center;
}

input {
  text-align: left;
  width: 280px;
  margin-top: 30px;
  padding-top: 18px;
  border: 1px solid #91908f;
  border-radius: 4px;
  margin-right: 10px;
}

input::placeholder {
  margin-bottom: 20px;
}

form button {
  width: 80px;
  padding: 0px;
  text-align: center;
  margin-top: 30px;
  color: #fffefc;
}

form label {
  margin-top: 5px;
  padding-left: 20px;
}

form .btn-primary {
  display: inline-block;
  background-color: #e16259;
  border: 1px solid #af4d46;
  text-align: center;
  border-radius: 6px;
  font-weight: 400;
}
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Notion</title>
  <link rel="stylesheet" href="css/style.css">
  <link rel="shortcut icon" href="favicon.ico">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" integrity="sha512-iBBXm8fW90+nuLcSKlbmrPcLa0OT92xO1BIsZ+ywDWZCvqsWgccV3gFoRBv0z+8dLJgyAHIhR35VZc2oM/gI1w==" crossorigin="anonymous" />

</head>

<body>
  <header>
    <a href="https://www.notion.so"><img src="img/logo.png" alt="Notion Logo"></a>
    <nav>
      <a href="#">Product</a>
      <a href="#">Download</a>
      <a href="#">Resources</a>
      <a href="#">Pricing</a>
      <a href="#">Careers</a>
      <span class="vertical-line">|</span>
      <a href="#">Sign Up</a>
      <a href="#">Log In</a>
    </nav>
  </header>

  <div class="hero">
    <div class="hero-img">
      <img src="img/hero.webp" alt="Illustration of 3 people using laptop computers on seperate desks with different expressions">
    </div>

    <h1>All-in-one workspace</h1>
    <h4>One tool for your whole team. Write, plan, and get organized.</h4>

    <form action="">
      <input type="text" placeholder="Email">
      <button class='btn-primary' type="submit">Sign Up</button>
    </form>
    <p>For teams & individuals - web, mobile, Mac, Windows</p>
  </div>
</body>

</html>

null


共1个答案

匿名用户

您可以删除输入的填充,并使用高度和行高进行调整

null

.ip {
   height: 30px;
   line-height: 30px;
   padding: 2px 8px;
}
<input type="text" class="ip" />