简体   繁体   English

在 REACT 中更改占位符的字体大小

[英]Change font size of placeholder in REACT

I am using reacts form.control, I want to reduce the size of the placeholder content:我正在使用 reacts form.control,我想减小占位符内容的大小:

<Form>
  <Form.Group controlId="formBasicEmail">
    <Form.Label>Email address</Form.Label>
    <Form.Control type="email" placeholder="Enter email" />
    <Form.Text className="text-muted">
      We'll never share your email with anyone else.
    </Form.Text>
  </Form.Group>

  <Form.Group controlId="formBasicPassword">
    <Form.Label>Password</Form.Label>
    <Form.Control type="password" placeholder="Password" />
  </Form.Group>
  <Form.Group controlId="formBasicCheckbox">
    <Form.Check type="checkbox" label="Check me out" />
  </Form.Group>
  <Button variant="primary" type="submit">
    Submit
  </Button>
</Form>

I tried few approaches by placing fontsize attribute in style, yet its not workin.我通过在样式中放置 fontsize 属性尝试了几种方法,但它不起作用。

Can anyone suggest me any solution/link for further analysis谁能建议我任何解决方案/链接以进行进一步分析

You should use the ::placeholder CSS pseudo-element like the following:您应该使用::placeholder CSS 伪元素,如下所示:

.input::placeholder {
  font-size: 13px;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM