I am using twitter bootstrap’s nav-tabs
. I would like to make all the corners of tab-content
rounded except when the first tab is selected.
So basically in this case when the first <li>
has active class then .tab-content
‘s border-top-left-radius
should be nothing.
I am not sure how do i conditionally set the styles just for 1st tab?
Here is the JSFiddle Demo
Update 1
Ok i got it working by setting styles on individual tab-pane
.tab-pane:not(:first-child) {
background-color: rgb(241, 241,241);
border-radius: 5px;
border-style: solid;
border-width: 1.0px;
border-color: #ADADAD;
padding: 20px;
}
.tab-pane:first-child{
background-color: rgb(241, 241,241);
border-top-right-radius: 5px;
border-bottom-right-radius: 5px;
border-bottom-left-radius: 5px;
border-style: solid;
border-width: 1.0px;
border-color: #ADADAD;
padding: 20px;
}
i was wondering if i can avoid repetition and combine?
new jsfiddle demo
4
Answers
Ok finally i got it working
here is working JSFiddle
You can do this by either using JavaScript or moving the
tab-content
inside of the<ul>
.navYour updated JSFiddle
After you move the content inside the nav, you can add this
Just do this,
apply
ul#main-nav li:first-child.active{
border-top-left-radius:0;
border-bottom-left-radius:0;
}
alternatively:
ul#main-nav li:first-child.active{
border-radius:0 10px 10px 0;
}
I would try moving the styles from .tab-content down into .tab-pane and then you can use child selectors for each .tab-pane.