如何调整 html/css 中输入的大小

问题描述 投票:0回答:1
html css forms
1个回答
0
投票

由于您没有在其中提到 CSS 代码,我不明白 CSS 代码或 HTML 中的错误在哪里,这里是 HTML 和 CSS:
要调整输入字段的更改高度和宽度,

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>jayprakash</title>
  <style>
    .container {
      width: 300px; /* Adjust the width of the container as needed */
      margin: 0 auto; /* Center the container horizontally */
    }
    input[type="text"],
    input[type="password"] {
      width: 100%; /* Set the width of input fields to 100% of the container */
      height: 40px; /* Adjust the height of input fields as needed */
      font-size: 16px; /* Adjust the font size of input fields as needed */
      margin-bottom: 10px; /* Add some space between input fields */
      padding: 5px 10px; /* Add padding to input fields for better appearance */
      box-sizing: border-box; /* Include padding and border in the width and height of input fields */
    }
  </style>
</head>
<body>

<div class="container">
  <form action="#" method="post">
    <input type="text" name="username" placeholder="Username" required>
    <br>
    <input type="password" name="password" placeholder="Password" required>
  </form>
</div>

</body>
</html>
  1. 调整容器的高度和宽度
  2. 然后调整输入字段。
© www.soinside.com 2019 - 2024. All rights reserved.