css - 如何从 Material UI TextField React 组件中删除 flex 边框和插入框阴影?

标签 css reactjs input textfield box-shadow

这是输入字段:

enter image description here

它有内部阴影和 flex 的边框。

代码如下:

import React, {Component} from 'react';
import TextField from 'material-ui/TextField';
import { connect } from 'react-redux';

class SearchInput extends Component {

    constructor(props) {
        super(props);
        this.state = {
            searchInputFieldValue: ''
        };
    }

    textFieldOnChangeSearch(event) {
        this.setState({searchInputFieldValue: event.target.value});
        this.props.phoneBookSearch(event.target.value);
    }

    render() {
        return (
            <div>
                <TextField
                    underlineShow={false}
                    hintText="Hae.."
                    onChange={this.textFieldOnChangeSearch.bind(this)}
                    value={this.state.searchInputFieldValue}
                    style={{
                        boxShadow: 'none',
                        height: '57px', 
                        width: '460px',
                        /*
                        borderStyle: 'solid',
                        borderColor: '#2375BB',
                        borderWidth: '2px',
                        */
                        backgroundColor: '#FFFFFF'
                    }}
                    />
            </div>
        )
    }
}

export default SearchInput;

这是它在浏览器检查中的显示方式:

如果我取消注释代码中样式的注释部分,它会显示如下:

enter image description here

正如您所看到的,这是我想要的蓝色边框,但 flex 的边框和内部阴影仍然显示在背景中。

如何删除它们? 甚至 box-shadow:无!重要;在网络工具中不会删除它。

最佳答案

请检查应用了 boxShadowborderRadius 的元素。当你找到它时,相应地你可以使用Material UI Textfiled的不同属性并影响其样式。

如果样式位于主元素上,那么您的样式属性应该有效。

我怀疑它位于 input 元素上,您可以使用 TextFieldinputStyle 属性进行更改。

另请检查docs更多元素特定样式属性选项。

关于css - 如何从 Material UI TextField React 组件中删除 flex 边框和插入框阴影?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48090977/

相关文章:

css - 影响 CSS/HTML 中父元素的背景图像?

jquery - 使用 span 使用 css 创建换行符

javascript - React.children.only 期望接收单个 react 元素子 Navigator

php - 从 XML 标签生成表单字段

javascript - 在 JavaScript 函数中使用时,HTML 复选框输入更改为类型 "true"或 "false"

jquery - 无法使用 jquery 函数来绝对定位适用于 iphone 的 div

html - 如何让两个div并排 float ?

javascript - react 加载新页面

javascript - 发送自定义用户代理字符串以及我的 header (获取)

javascript - 有没有更好的方式来写这个,或者更短更紧凑的方式