Skip to content

Commit 2820d7d

Browse files
committed
feat: Added tabs
1 parent a0624dd commit 2820d7d

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed

assets/css/v2/style.css

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
--color-footer-text: #e2e2e2;
2323
--color-product-title: #8d8d8d;
2424
--color-table-divider: #cccccc;
25+
--color-tabs-divider: #00000033;
2526
--color-codeblock-code-with-comment: #00963926;
2627

2728
--sidebar-margin: 24px;
@@ -788,6 +789,88 @@ blockquote p:last-child {
788789
margin: 0 auto;
789790
}
790791

792+
/* Tabs */
793+
.nav {
794+
list-style: none;
795+
display: flex;
796+
justify-content: start;
797+
border-bottom: 1px solid black;
798+
position: relative;
799+
800+
/* Lines extend 1rem into gutter on both sides */
801+
width: calc(100% + 2rem);
802+
margin-left: -1rem;
803+
804+
> :not(:last-child) {
805+
border-right: none;
806+
}
807+
}
808+
809+
.nav-item {
810+
border: 1px solid var(--color-tabs-divider);
811+
border-bottom: none;
812+
padding: 10px;
813+
position: relative;
814+
815+
a {
816+
text-decoration: none;
817+
}
818+
819+
.active {
820+
color: black;
821+
}
822+
}
823+
824+
.nav-item:has(.active) {
825+
/* Change the border colors of li that is has a child with a class "active" */
826+
border-top: 1px solid black;
827+
border-left: 1px solid black;
828+
829+
/* Change the border of next child */
830+
+ li {
831+
border-left: 1px solid black;
832+
}
833+
834+
&::after {
835+
content: "";
836+
position: absolute;
837+
display: block;
838+
border-bottom: 1px solid white;
839+
bottom: -1px; /* Moves the line down 1px (aka the thickness of the border) */
840+
left: 0;
841+
width: 100%;
842+
z-index: 9999;
843+
}
844+
}
845+
846+
.nav-item:last-child:has(.active) {
847+
/* If on last tab, change the right border since it does not have a next sibling */
848+
border-right: 1px solid black;
849+
}
850+
851+
.tab-content {
852+
border-bottom: 1px solid black;
853+
854+
/* Lines extend 1rem into gutter on both sides */
855+
width: calc(100% + 2rem);
856+
margin-left: -1rem;
857+
858+
.tab-pane {
859+
display: none;
860+
861+
/* Push the content 1rem right due to the gutter displacement */
862+
margin-left: 1rem;
863+
}
864+
865+
.tab-pane * {
866+
margin-left: 0;
867+
}
868+
869+
.active {
870+
display: block !important;
871+
}
872+
}
873+
791874
/* Codeblocks */
792875
.highlight-mf {
793876
grid-column: 1 / -1 !important;

0 commit comments

Comments
 (0)