I’m trying to make an underline of the selected tab be above the horizontal line, something like this:
However, I’m only getting this:
I think using border will not fix the problem, since the more distant of the text I put it, the more the hr tag moves down.
CSS:
.chart-area-tabs .currentTab {
font-weight: 600;
border-bottom: 1px solid #000;
padding-bottom: 3px;
}
JSX:
<div className='chart-area-tabs'>
<p className="currentTab">Sales (0$)</p>
<p>Order Volume (0)</p>
<p>Ticket Size ($0.00)</p>
</div>
<hr style={{width: 870}}/>
How can I correct this code?
2
Answers
You should remove padding/margin around tab items. And then add to each tab padding. After that you will be able to add border-bottom for active tab.example how to add paddings
Here is a solution using a simple flex-box, padded tabs, and borders instead of an
<hr>
tag. I don’t think the<hr>
is the way to go here, since to get your desired UI you would need to overlap some other element on top of the<hr>
, which seems unnecessarily difficult.