css 是否可以对用户在contactform中输入的文本字体设置样式

ecbunoof  于 2023-02-01  发布在  其他
关注(0)|答案(1)|浏览(130)

我问这个问题是因为用户在文本区域输入的文本与其他字段不同。字体样式也不同。我如何更改此字段区域的字体样式?首先我想解决这个问题,然后如果样式可以,我想学习如何更改。

.contact-form {
  background-color: white;
}

input,
select,
textarea {
  background-color: #f2f2f2;
  display: block;
  margin: auto;
  font-size: 1em;
  padding: 25px;
  border: none;
  outline: none;
  margin-top: 20px;
  margin-bottom: 16px;
  box-sizing: border-box;
  resize: vertical;
}

input[type=submit] {
  font-family: avenir_nextdemi_bold;
  background-color: #437bff;
  font-size: 1.2em;
  color: white;
  padding: 12px 20px;
  border-radius: 30px;
  width: 15%;
  border: none;
  cursor: pointer;
}

input[type=submit]:hover {
  background-color: #133edb;
}

 ::placeholder {
  font-family: avenir_nextdemi_bold;
}

textarea {
  height: 200px;
}
<form action="/action_page.php">
  <input type="text" id="lname" name="lastname" placeholder="Naam" required>
  <input type="email" id="email" name="email" placeholder="Email adres" required>
  <textarea id="subject" name="subject" placeholder="Vertel ons over je project" required></textarea>
  <input type="submit" value="Submit">
</form>
wlp8pajw

wlp8pajw1#

您需要做的就是添加font-family:无衬线下面是它在代码中的样子:

input,
select,
textarea {
  background-color: #f2f2f2;
  display: block;
  margin: auto;
  font-size: 1em;
  padding: 25px;
  border: none;
  outline: none;
  margin-top: 20px;
  margin-bottom: 16px;
  box-sizing: border-box;
  resize: vertical;
  font-family: sans-serif;
  /* You can change the font if you want but based on what I saw I assumed
  you wanted sans-serif. It would also be helpful for you to specify what you mean
  style text */
}

相关问题