In this article, you’ll learn how to customize the appearance of the tabs shortcode.
Table of contents
Navigate to Dashboard → Shortcodes → Settings and look for the Custom CSS code field. Copy/paste the following styles to the
.su-tabs > .su-tabs-nav > span {
/* Background color */
background-color: #ffcc00;
/* Text color */
color: #00ffcc;
/* Text size */
font-size: 20px;
}
.su-tabs > .su-tabs-nav > span:not(.su-tabs-current) {
/* Background color */
background-color: #ffcc00;
/* Text color */
color: #00ffcc;
/* Text size */
font-size: 20px;
}
.su-tabs > .su-tabs-nav > span:hover {
/* Background color */
background-color: #ffcc00;
/* Text color */
color: #00ffcc;
}
.su-tabs > .su-tabs-nav > span.su-tabs-current {
/* Background color */
background-color: #ffcc00;
/* Text color */
color: #00ffcc;
}
.su-tabs > .su-tabs-nav > span.su-tabs-current:hover {
/* Background color */
background-color: #ffcc00;
/* Text color */
color: #00ffcc;
}
.su-tabs > .su-tabs-panes > div {
/* Background color */
background-color: #ffcc00;
/* Text color */
color: #00ffcc;
/* Text size */
font-size: 20px;
}
If you want to customize each tab separately, use the following CSS code. Replace 2 with an index of the tab you want to modify.
/* Second tab, inactive */ .su-tabs > .su-tabs-nav > span:nth-child(2) {} /* Second tab, on mouse over */ .su-tabs > .su-tabs-nav > span:nth-child(2):hover {} /* Second tab, active state */ .su-tabs > .su-tabs-nav > span:nth-child(2).su-tabs-current {} /* Second tab, active state, on mouse over */ .su-tabs > .su-tabs-nav > span:nth-child(2).su-tabs-current:hover {} /* Second tab content */ .su-tabs > .su-tabs-panes > div:nth-child(2) {}
The following snippet will stretch tab handles to full width of the tabs container.
@media screen and (min-width: 768px) {
.su-tabs-nav {
display: flex;
}
.su-tabs-nav span {
flex-basis: 100%;
text-align: center;
}
.su-tabs-nav span:last-child {
margin-right: 0;
}
}
Result
Code
.su-tabs {
background-color: orange;
}
.su-tabs > .su-tabs-nav > span {
background-color: red;
color: aquamarine;
}
.su-tabs > .su-tabs-nav > span:hover {
background-color: gold;
color: red;
}
.su-tabs > .su-tabs-nav > span.su-tabs-current {
background-color: deepskyblue;
color: white;
}
.su-tabs > .su-tabs-panes > .su-tabs-pane {
background-color: deepskyblue;
color: white;
}