pac-container react autocomplete-我如何引用CSS

我正在尝试为我的Google自动填充组件更改pac-container。我想为这个pac-container设置样式,但是我不知道如何引用已经定义的类名的css。

这是我的代码

...
    constructor(props) {
        super(props);
        this.state = {
            address_ignore_autofill: this.props.address,};
        this.autocomplete = null;
    }

    componentDidmount() {
        this.autocomplete = new 
google.maps.places.Autocomplete(document.getElementById('address'),{});
        this.autocomplete.addListener("place_changed",this.handlePlaceSelect)
    }

    handleFormChange = (event) => {
        this.setState({ address_ignore_autofill: event.target.value });
    };

    render() {
        const { classes } = this.props;
        return (
            <TextField
                onChange={(e) => this.handleFormChange(e)}
            />
        );
    }

我应该在哪里修改.pac-container??我尝试在index.css中进行修改,但这是行不通的。我还尝试过将<Textfield/>类包装到div中并进行

import './test.css'

<div classname='test'>
  <Textfield>
</div>

this is test.css

.test .pac-container {
    margin-top: 500
}

但是那也不起作用。

 .pac-container {
    margin-top: 500
}

也不起作用。

我知道我缺少一些非常愚蠢的东西。请帮忙。谢谢

jhk911 回答:pac-container react autocomplete-我如何引用CSS

您需要在保证金最高值中包含该单位

.pac-container {
    margin-top: 500px;
}
本文链接:https://www.f2er.com/3076979.html

大家都在问