-
Notifications
You must be signed in to change notification settings - Fork 203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix top navbar style #1719
Fix top navbar style #1719
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,12 @@ div.nav-container { | |
color: var(--color-navbar-standard); | ||
/* The font size must be specified in pixels because the height is specified in pixels. */ | ||
font: 16px $font-family-sans; | ||
position: relative; | ||
|
||
.container, .pure-menu-horizontal { | ||
position: relative; | ||
height: 100%; | ||
} | ||
|
||
li { | ||
border-left: 1px solid var(--color-border); | ||
|
@@ -73,18 +79,18 @@ div.nav-container { | |
} | ||
} | ||
|
||
.pure-menu-right { | ||
float: right; | ||
} | ||
|
||
form.landing-search-form-nav { | ||
max-width: 1200px; | ||
height: 100%; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you can get rid of this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
display: flex; | ||
flex-direction: row; | ||
|
||
#search-input-nav { | ||
float: right; | ||
max-width: 150px; | ||
display: none; | ||
border-left: 1px solid var(--color-border); | ||
height: 100%; | ||
overflow-x: hidden; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a trick I used to fix the scrollbar issue when the font-size is too big. I thought |
||
|
||
@media #{$media-sm} { | ||
display: block; | ||
|
@@ -107,7 +113,7 @@ div.nav-container { | |
font-size: 0.8em; | ||
box-shadow: none; | ||
background-color: var(--color-background); | ||
height: 31px; | ||
height: 100%; | ||
} | ||
} | ||
|
||
|
@@ -122,8 +128,21 @@ div.nav-container { | |
See https://github.com/rust-lang/docs.rs/issues/1669. | ||
*/ | ||
.pure-menu-item a { | ||
/* 0.5 em is the padding */ | ||
max-height: calc(#{$top-navbar-height} - 0.5em * 2); | ||
max-height: 100%; | ||
overflow-x: hidden; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think these lines are unnecessary. When I remove these properties locally, the unwanted grey rectangles (which are tiny vertical scrollbars) go away. Also, with these properties removed, even if the menu items' font size is weird, it doesn't interfere with the main page. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In fact, I think this whole CSS rule (including the comment about what happens with a locally installed old Fira Sans) should get deleted. Switching to the flex layout seems like it sufficed to fix the issue with overflowing menu titles, even without this rule. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (I just tested in a locally installed Firefox, with the Fira Sans from #1669 (comment), at these commits:
And I can confirm that at (1) I have the overflow issue. Both (2) and (3) fix the overflow issue, and (3) additionally fixes the scrollbar issue introduced in this branch. BTW the scrollbar issue seems to be Chrome-only. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
text-overflow: ellipsis; | ||
} | ||
|
||
.docsrs-logo, .pure-menu-item a { | ||
padding: 8px 1em; | ||
} | ||
|
||
.pure-menu-item { | ||
height: 100%; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is also unnecessary. |
||
} | ||
|
||
.spacer { | ||
flex-grow: 1; | ||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are the
position: relative
andheight: 100%
needed for here? I think they are unnecessary.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's because with this, we can set the element of the navbar to
height: 100%
. It prevents the bottom margin to disappear in case the font size is too big.