Skip to content

Commit f6e7df2

Browse files
committed
specify nav's anchor selector for applying styles
1 parent b9157dc commit f6e7df2

5 files changed

Lines changed: 96 additions & 61 deletions

File tree

assets/sass/components/_dropdown.scss

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
margin: 0 !important;
2020
min-width: 100%;
2121
opacity: 0;
22-
padding-top: $margin-base !important;
22+
padding-top: $margin-base;
2323
padding-right: 0;
24-
padding-bottom: $margin-base !important;
24+
padding-bottom: $margin-base;
2525
padding-left: 0;
2626
position: absolute !important;
2727
top: 100%;
@@ -43,18 +43,22 @@
4343
left: auto;
4444
transform-origin: 100% 0;
4545
}
46-
a,
47-
.a {
48-
color: $black-text-solid !important;
49-
@include text-overflow();
50-
&:focus,
51-
&:hover {
52-
background-color: $offwhite-solid;
46+
li {
47+
> a,
48+
> .a {
49+
color: $black-text-solid;
50+
@include text-overflow();
51+
&:focus,
52+
&:hover {
53+
background-color: $offwhite-solid;
54+
}
55+
}
56+
&.active {
57+
> a,
58+
> .a {
59+
background-color: $offwhite-solid;
60+
}
5361
}
54-
}
55-
.active > a,
56-
.active > .a {
57-
background-color: $offwhite-solid;
5862
}
5963
}
6064

@@ -80,7 +84,7 @@
8084
}
8185
~ .dropdown-menu {
8286
min-width: 100%;
83-
padding-top: ($btn-height + $margin-base + ($nav-height - $btn-height)) !important;
87+
padding-top: ($btn-height + $margin-base + ($nav-height - $btn-height));
8488
// position
8589
top: ($margin-base * -1 + ($nav-height - $btn-height) / -2);
8690
left: 0;

assets/sass/components/_nav.scss

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@
44
padding: 0;
55
position: relative;
66
@include clearfix();
7-
a,
8-
.a {
9-
align-items: center;
10-
display: flex;
11-
min-height: $nav-height;
12-
padding: 0 $grid-gutter;
13-
position: relative;
14-
&:focus,
15-
&:hover {
16-
text-decoration: none;
17-
}
18-
}
197
li {
208
display: block;
219
position: relative;
10+
> a,
11+
> .a {
12+
align-items: center;
13+
display: flex;
14+
min-height: $nav-height;
15+
padding: 0 $grid-gutter;
16+
position: relative;
17+
&:focus,
18+
&:hover {
19+
text-decoration: none;
20+
}
21+
}
2222
}
2323
ul {
2424
margin: 0;

css/base.css

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3045,9 +3045,9 @@ pre code {
30453045
margin: 0 !important;
30463046
min-width: 100%;
30473047
opacity: 0;
3048-
padding-top: 8px !important;
3048+
padding-top: 8px;
30493049
padding-right: 0;
3050-
padding-bottom: 8px !important;
3050+
padding-bottom: 8px;
30513051
padding-left: 0;
30523052
position: absolute !important;
30533053
top: 100%;
@@ -3077,22 +3077,22 @@ pre code {
30773077
-webkit-transform-origin: 100% 0;
30783078
transform-origin: 100% 0;
30793079
}
3080-
.dropdown-menu a,
3081-
.dropdown-menu .a {
3082-
color: #212121 !important;
3080+
.dropdown-menu li > a,
3081+
.dropdown-menu li > .a {
3082+
color: #212121;
30833083
display: block;
30843084
line-height: inherit;
30853085
overflow: hidden;
30863086
text-overflow: ellipsis;
30873087
white-space: nowrap;
30883088
}
3089-
.dropdown-menu a:focus, .dropdown-menu a:hover,
3090-
.dropdown-menu .a:focus,
3091-
.dropdown-menu .a:hover {
3089+
.dropdown-menu li > a:focus, .dropdown-menu li > a:hover,
3090+
.dropdown-menu li > .a:focus,
3091+
.dropdown-menu li > .a:hover {
30923092
background-color: #f5f5f5;
30933093
}
3094-
.dropdown-menu .active > a,
3095-
.dropdown-menu .active > .a {
3094+
.dropdown-menu li.active > a,
3095+
.dropdown-menu li.active > .a {
30963096
background-color: #f5f5f5;
30973097
}
30983098

@@ -3120,7 +3120,7 @@ pre code {
31203120
}
31213121
.dropdown-toggle-btn ~ .dropdown-menu {
31223122
min-width: 100%;
3123-
padding-top: 56px !important;
3123+
padding-top: 56px;
31243124
top: -14px;
31253125
left: 0;
31263126
-webkit-transform: scale(1, 0);
@@ -4041,8 +4041,12 @@ input[type="checkbox"]:checked + .switch-toggle-red:active:after, input[type="ra
40414041
.nav:after {
40424042
clear: both;
40434043
}
4044-
.nav a,
4045-
.nav .a {
4044+
.nav li {
4045+
display: block;
4046+
position: relative;
4047+
}
4048+
.nav li > a,
4049+
.nav li > .a {
40464050
-webkit-box-align: center;
40474051
-webkit-align-items: center;
40484052
-ms-flex-align: center;
@@ -4055,15 +4059,11 @@ input[type="checkbox"]:checked + .switch-toggle-red:active:after, input[type="ra
40554059
padding: 0 16px;
40564060
position: relative;
40574061
}
4058-
.nav a:focus, .nav a:hover,
4059-
.nav .a:focus,
4060-
.nav .a:hover {
4062+
.nav li > a:focus, .nav li > a:hover,
4063+
.nav li > .a:focus,
4064+
.nav li > .a:hover {
40614065
text-decoration: none;
40624066
}
4063-
.nav li {
4064-
display: block;
4065-
position: relative;
4066-
}
40674067
.nav ul {
40684068
margin: 0;
40694069
padding: 0;

0 commit comments

Comments
 (0)