【发布时间】:2018-10-04 14:04:26
【问题描述】:
我在路线中使用了 NavLink,然后根据我想要的设计添加了一些填充和背景颜色等。然后为活动的 css 按钮添加了一个左边框样式,让用户很容易知道他们在哪里。但是由于某种原因,我无法使我的 css 按钮的边框/背景可点击,并且左边框仅位于文本旁边而不是背景。任何人都可以帮助我吗?
这是css:
.tab-selections {
background-color: rgb(242, 242, 242);
padding: 1.4em 6em;
height: 1.7em;
display: inline-block;
margin: .3em;
vertical-align: top;
align-items: center;
text-align: center;
color: rgb(75, 75, 75);
font-size: 15px;
}
.active {
display: inline-block;
background-color: rgb(205, 221, 255);
border-left: .6em solid;
border-left-color: rgb(87, 0, 255);
text-align: center;
}
这是 HTML (ReactJS):
<div className="article container">
<div className="flex container parent">
<div className="tab-selections">
<NavLink
to="/sample/article"
style={{ color: '#4b4b4b', textDecoration: 'none' }}
>
ARTICLES
</NavLink>
</div>
<div className="tab-selections">
<NavLink
to="/sample/casestudies"
style={{ color: '#4b4b4b', textDecoration: 'none' }}
>
CASE STUDIES /<br />
WHITEPAPERS
</NavLink>
</div>
<div className="tab-selections">
<NavLink
to="/sample/news"
style={{ color: '#4b4b4b', textDecoration: 'none' }}
>
NEWS/EVENTS
</NavLink>
</div>
</div>
【问题讨论】:
-
(旁白:我们喜欢这里简洁的问题,最好不要包含对答案的评论的答案。不要担心只能选择一个正确答案 - 选择一个您喜欢,并且您可以投票给其他任何人,尽管没有义务这样做。这是我们说“谢谢”的方式。
标签: javascript html css reactjs