繁体   English   中英

React-Bootstrap中如何调整表单控件的宽度

[英]How to adjust the width of the form control in React-Bootstrap

导航栏

除非我明确设置它的宽度,否则搜索栏的宽度不会改变,但这样做也会影响它在 window 尺寸较小时的外观。

我尝试使用只有 1 列的容器,但宽度仍然没有填满整行。

如何更改搜索栏的宽度?

导航栏:

    <Navbar style={{ position: 'sticky' }} bg="zocalo-blue" variant="dark" expand="lg" fixed="top">
        <Navbar.Brand className="mr-0">
            Test
        </Navbar.Brand>
        <Navbar.Toggle aria-controls="responsive-navbar-nav" size="sm"/>
        <Navbar.Collapse id="responsive-navbar-nav">
        <Nav className="justify-content-center flex-md-grow-1">
          <SearchBar />
        </Nav>
        <Nav className="ml-auto align-top">
          <CartIcon />
          <User />
        </Nav>
        </Navbar.Collapse>
    </Navbar>

搜索栏:

  <Form className="mb-0" inline>
      <Form.Group as={Row} controlId="search-materials">
        <InputGroup>
          <FormControl type="text" placeholder="Search" className="searchbar"/>
          <InputGroup.Append>
            <Button variant="zocalo-orange">
              <div>
                <i className="fa fa-search fa-lg"></i>
              </div>
            </Button>
          </InputGroup.Append>
        </InputGroup>
      </Form.Group>
  </Form>

您可以通过在其中提供样式来控制宽度。

<div style={{width:"100%"}}>
<Search/>
</div>

暂无
暂无

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

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