So I have a child div with a border within parent div with a border. The child div has 3 tabs all with a width of 33.3334%. but there is tiny gap at the end of the tabs between the child border and the parent border. See the picture:
I need to get rid of this gap, so that the border of the parent is the only one visible. Making the tab widths any bigger pushes the 3rd one onto the next line.
Can anyone please help?
Thanks
li.ui-state-default.ui-corner-top.ui-tabs-active.ui-state-active {
background-color: #a0a3a2;
border-top-right-radius: 5px;
}
li.ui-state-default.ui-corner-top {
width: 33.3334%;
border-right: 2px solid #a0a3a2;
border-bottom: 2px solid #a0a3a2;
border-top-right-radius: 5px;
}
#ui-id-3.ui-tabs-anchor {
width: 33.3334%;
border-top-right-radius: 0px!important;
}
.woocommerce-tabs {
margin-bottom: 20px;
border: 2px solid #adb0b2;
border-radius: 5px;
background-color: #ffffff;
padding: 5px;
}
<div class="wpb_tabs wpb_content_element" data-interval="0">
<div class="wpb_wrapper wpb_tour_tabs_wrapper ui-tabs vc_clearfix ui-widget ui-widget-content ui-corner-all">
<ul class="wpb_tabs_nav ui-tabs-nav vc_clearfix ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" role="tablist">
<li class="ui-state-default ui-corner-top ui-tabs-active ui-state-active" role="tab" tabindex="0" aria-controls="tab-6f4746f8-2705-5" aria-labelledby="ui-id-1" aria-selected="true" aria-expanded="true">
<a href="#tab-6f4746f8-2705-5" class="ui-tabs-anchor" role="presentation" tabindex="-1" id="ui-id-1">PRODUCT DETAILS</a>
</li>
<li class="ui-state-default ui-corner-top" role="tab" tabindex="-1" aria-controls="tab-42783517-3ace-8" aria-labelledby="ui-id-2" aria-selected="false" aria-expanded="false">
<a href="#tab-42783517-3ace-8" class="ui-tabs-anchor" role="presentation" tabindex="-1" id="ui-id-2">DELIVERY DETAILS</a>
</li>
<li class="ui-state-default ui-corner-top" role="tab" tabindex="-1" aria-controls="tab-1429777272805-2-1" aria-labelledby="ui-id-3" aria-selected="false" aria-expanded="false">
<a href="#tab-1429777272805-2-1" class="ui-tabs-anchor" role="presentation" tabindex="-1" id="ui-id-3">REVIEWS</a>
</li>
</ul>
</div>
</div>
Even if you get rid of the gap, you’ll still have a double border so you also need to get rid of one of the borders. You can hide the border on the last
li
with this:But you may still have a gap in the bottom border.
Without seeing the rest of your styling, it’s hard to say for sure, but often these unwanted gaps are caused by whitespace in the HTML. This seems counter-intuitive because usually whitespace doesn’t matter, but between images and inline block elements it often introduces unwanted gaps.
Unfortunately (to my knowledge) there isn’t an elegant solution to this issue. There are hacky solutions using CSS (e.g. set the font-size to zero for the parent element and set an explicit font size for your
li
elements), but the easiest is to just remove the whitespace between the</li>
and the</ul>
. See https://css-tricks.com/fighting-the-space-between-inline-block-elements/ for more suggestions.Run the snippet below for a demonstration – I’ve replaced the whitespace (including newline) with a comment, which is fine as long as there’s no whitespace around the comment.
Using CSS3
box-sizing
property will solve your problem.CSS
HTML
JSFIDDLE: http://jsfiddle.net/yd6ao3d4/