【发布时间】:2021-04-03 12:29:32
【问题描述】:
我实际上在使用 React 中的样式化组件处理 CSS 时遇到了麻烦。下面给出的是代码sn-p
import React from 'react';
import { Navbar, Container, Row, Col } from 'reactstrap';
import styled from 'styled-components';
const Styles = styled.div`
.navbar {
background-color: black;
position: absolute;
bottom: 0;
width: 100%;
}
.h1 {
color: white;
}
`;
const Footer = () => {
return (
<Styles>
<Navbar>
<Container>
<Row>
<Col sm={{ size: 4 }}>
<h1>Hi</h1>
</Col>
</Row>
</Container>
</Navbar>
</Styles>
);
};
export default Footer;
我想要做的是将h1 标记的颜色更改为白色,但上面的自定义 CSS 不起作用。我也试过background-color,但问题仍然存在。
【问题讨论】:
标签: javascript css reactjs jsx styled-components