Skip to content

Commit 00f736f

Browse files
committed
feat: Added tabs
1 parent de5dbc7 commit 00f736f

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;
@@ -767,6 +768,88 @@ blockquote p:last-child {
767768
margin: 0 auto;
768769
}
769770

771+
/* Tabs */
772+
.nav {
773+
list-style: none;
774+
display: flex;
775+
justify-content: start;
776+
border-bottom: 1px solid black;
777+
position: relative;
778+
779+
/* Lines extend 1rem into gutter on both sides */
780+
width: calc(100% + 2rem);
781+
margin-left: -1rem;
782+
783+
> :not(:last-child) {
784+
border-right: none;
785+
}
786+
}
787+
788+
.nav-item {
789+
border: 1px solid var(--color-tabs-divider);
790+
border-bottom: none;
791+
padding: 10px;
792+
position: relative;
793+
794+
a {
795+
text-decoration: none;
796+
}
797+
798+
.active {
799+
color: black;
800+
}
801+
}
802+
803+
.nav-item:has(.active) {
804+
/* Change the border colors of li that is has a child with a class "active" */
805+
border-top: 1px solid black;
806+
border-left: 1px solid black;
807+
808+
/* Change the border of next child */
809+
+ li {
810+
border-left: 1px solid black;
811+
}
812+
813+
&::after {
814+
content: "";
815+
position: absolute;
816+
display: block;
817+
border-bottom: 1px solid white;
818+
bottom: -1px; /* Moves the line down 1px (aka the thickness of the border) */
819+
left: 0;
820+
width: 100%;
821+
z-index: 9999;
822+
}
823+
}
824+
825+
.nav-item:last-child:has(.active) {
826+
/* If on last tab, change the right border since it does not have a next sibling */
827+
border-right: 1px solid black;
828+
}
829+
830+
.tab-content {
831+
border-bottom: 1px solid black;
832+
833+
/* Lines extend 1rem into gutter on both sides */
834+
width: calc(100% + 2rem);
835+
margin-left: -1rem;
836+
837+
.tab-pane {
838+
display: none;
839+
840+
/* Push the content 1rem right due to the gutter displacement */
841+
margin-left: 1rem;
842+
}
843+
844+
.tab-pane * {
845+
margin-left: 0;
846+
}
847+
848+
.active {
849+
display: block !important;
850+
}
851+
}
852+
770853
/* Codeblocks */
771854
.highlight-mf {
772855
grid-column: 1 / -1 !important;

0 commit comments

Comments
 (0)