我正在尝试使用React和Material UI构建一个模拟网站,我使用RaisdedButtonExampleSimple组件来显示Material UI中的按钮。这是一个名为App-Intro的div,上面是带有文本的Div“Customer-Choice”。文本出现在按钮上方,即使它位于App.js代码中按钮下方的Div中。有这样的原因吗?
.App {
text-align: center;
}
.iconmenu {
margin: auto;
}
.App-logo {
/* animation: App-logo-spin infinite 20s linear; */
height: 200px;
}
.App-header {
background-color: rgb(255, 255, 255);
height: 150px;
padding: 20px;
color: white;
}
.App-title {
font-size: 1.5em;
}
.App-intro {
font-size: 1.5em;
}
.Customer-Choice {}
@keyframes App-logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import "./button.css";
import ReactDOM from 'react-dom';
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
import getMuiTheme from 'material-ui/styles/getMuiTheme';
import AppBarExampleIcon from './Navbar';
import {lightGreen600} from 'material-ui/styles/colors';
import BadgeExampleSimple from "./badge";
import IconMenuExampleSimple from "./iconmenu.js";
import RefreshIndicatorExampleLoading from "./refreshindicator.js"
import RaisedButtonExampleSimple from "./button.js"
class App extends Component {
render() {
return (
<MuiThemeProvider>
<div className="App">
<AppBarExampleIcon iconClassNameLeft={BadgeExampleSimple}
color1 = {lightGreen600} />
{/* <div className = "iconmenu"> <IconMenuExampleSimple/> </div> */}
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<div className="button1"><RaisedButtonExampleSimple/></div>
<h1 className="App-title">Welcome to React</h1>
</header>
<h1 className="App-intro">
Lawn Service and Home Cleaning Done Right
</h1>
</div>
<div className="Customer-Choice">
<h1>Why Customers Choose Us</h1>
</div>
</MuiThemeProvider>
);
}
}
export default App;
答案 0 :(得分:0)
检查ErrorDocument 404 /error_pages/new404.html
,它可能继承了导致问题的CSS。
您还可以为此<h1>Why Customers Choose Us</h1>
添加一个类名,并将其作为
<h1 className="customerChoice">
。