【发布时间】:2021-09-08 02:44:29
【问题描述】:
当我将鼠标悬停在 box1 时,我想显示一个边框。
当我悬停时,会显示边框,但一会儿会显示黑色边框。
另外,当我悬停时,布局会移到底部。
如果有人知道如何解决这个问题,请告诉我。
import "./styles.css";
import styled from "styled-components";
const Box = styled.div`
padding: 9px 18px;
cursor: pointer;
display: inline-block;
color: #222426;
&:hover {
border: solid #e2e6ea 1px;
transition: all 0.2s cubic-bezier(0.08, 0.52, 0.52, 1);
}
span {
cursor: pointer;
font-weight: bold;
font-size: 20px;
line-height: 20px;
color: #222426;
}
`;
const App = () => {
return (
<>
<div className="App">
<h1>Hello CodeSandbox</h1>
<h2>Start editing to see some magic happen!</h2>
</div>
<Box>
<span>box1</span>
</Box>
<div>
<span>aaaaaaa</span>
</div>
<div style={{ width: "full", height: "100px", background: "red" }}></div>
</>
);
};
export default App;
【问题讨论】:
标签: css reactjs styled-components