Skip to content

Commit 2f88447

Browse files
committed
feat: Support tabs on mobile
1 parent 96e218e commit 2f88447

File tree

1 file changed

+68
-43
lines changed

1 file changed

+68
-43
lines changed

assets/css/v2/style.css

Lines changed: 68 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -791,24 +791,22 @@ blockquote p:last-child {
791791

792792
/* Tabs */
793793
.nav-tabs {
794-
list-style: none;
795794
display: flex;
796-
justify-content: start;
797-
border-bottom: 1px solid black;
798-
position: relative;
795+
flex-direction: column;
796+
border: none;
797+
list-style: none;
799798

800-
/* Lines extend 1rem into gutter on both sides */
801-
width: calc(100% + 2rem);
802-
margin-left: -1rem;
799+
width: 100%;
800+
margin-left: 0;
801+
padding: 0;
803802

804803
> :not(:last-child) {
805-
border-right: none;
804+
border-bottom: none;
806805
}
807806
}
808807

809808
.nav-item {
810-
border: 1px solid var(--color-tabs-divider);
811-
border-bottom: none;
809+
border: 1px solid black;
812810
padding: 10px;
813811
position: relative;
814812

@@ -821,53 +819,80 @@ blockquote p:last-child {
821819
}
822820
}
823821

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;
822+
.tab-content {
823+
.tab-pane {
824+
display: none;
825+
}
828826

829-
/* Change the border of next child */
830-
+ li {
831-
border-left: 1px solid black;
827+
.tab-pane * {
828+
margin-left: 0;
832829
}
833830

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;
831+
.active {
832+
display: block !important;
843833
}
844834
}
845835

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-
}
836+
@media (min-width: 429px) {
837+
/* iPhone 12+ Pro Max */
838+
.nav-tabs {
839+
flex-direction: row;
840+
justify-content: start;
841+
border-bottom: 1px solid black;
842+
position: relative;
850843

851-
.tab-content {
852-
border-bottom: 1px solid black;
844+
/* Lines extend 1rem into gutter on both sides */
845+
width: calc(100% + 2rem);
846+
margin-left: -1rem;
847+
848+
> :not(:last-child) {
849+
border-right: none;
850+
}
851+
}
853852

854-
/* Lines extend 1rem into gutter on both sides */
855-
width: calc(100% + 2rem);
856-
margin-left: -1rem;
853+
.nav-item {
854+
border: 1px solid var(--color-tabs-divider);
855+
border-bottom: none;
856+
}
857857

858-
.tab-pane {
859-
display: none;
858+
.nav-item:has(.active) {
859+
/* Change the border colors of li that is has a child with a class "active" */
860+
border-top: 1px solid black;
861+
border-left: 1px solid black;
860862

861-
/* Push the content 1rem right due to the gutter displacement */
862-
margin-left: 1rem;
863+
/* Change the border of next child */
864+
+ li {
865+
border-left: 1px solid black;
866+
}
867+
868+
&::after {
869+
content: "";
870+
position: absolute;
871+
display: block;
872+
border-bottom: 1px solid white;
873+
bottom: -1px; /* Moves the line down 1px (aka the thickness of the border) */
874+
left: 0;
875+
width: 100%;
876+
z-index: 9999;
877+
}
863878
}
864879

865-
.tab-pane * {
866-
margin-left: 0;
880+
.nav-item:last-child:has(.active) {
881+
/* If on last tab, change the right border since it does not have a next sibling */
882+
border-right: 1px solid black;
867883
}
868884

869-
.active {
870-
display: block !important;
885+
.tab-content {
886+
border-bottom: 1px solid black;
887+
888+
/* Lines extend 1rem into gutter on both sides */
889+
width: calc(100% + 2rem);
890+
margin-left: -1rem;
891+
892+
.tab-pane {
893+
/* Push the content 1rem right due to the gutter displacement */
894+
margin-left: 1rem;
895+
}
871896
}
872897
}
873898

0 commit comments

Comments
 (0)