Skip to content

Improve css so anchor don't go under sidebar #638

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

Merged
merged 1 commit into from
Mar 14, 2018

Conversation

GuillaumeGomez
Copy link
Member

When clicking on anchors, they don't go under the top navbar now.

@sorin-davidoi
Copy link
Contributor

Hi, thanks for opening this! While this certainly fixed the issue, it slightly breaks other functionality:

  • The header no longer hides when scrolling down
  • The sidebar no longer animates properly

The changes also must go into the Stylus files, otherwise the changes will be overwritten during the build step (see https://github.com/rust-lang-nursery/mdBook/blob/master/CONTRIBUTING.md#making-changes-to-the-style for a guide).

@GuillaumeGomez
Copy link
Member Author

The sidebar never hid when scrolling down for me... I'll fix the other issues.

@sorin-davidoi
Copy link
Contributor

I think it only hides when the sidebar is hidden.

@GuillaumeGomez
Copy link
Member Author

Ah that's why! Then it's an easy fix.


.sidebar-visible .content {
position: absolute
top: 52px
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how well this will scale - the header may have a different size depending on font settings (it's 51px on my machine).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's 52 on mine haha.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't you define it as something like 3 em to make sure the size scales appropriately? I imagine hard-coding the size is probably going to make a difference when people view things on mobile.

@@ -2,20 +2,18 @@

.page-wrapper {
box-sizing: border-box
left: 0
position: absolute
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't really dig having position: absolute, but can't think of another way to do it either.

@GuillaumeGomez
Copy link
Member Author

Ok, should be fine.

@Michael-F-Bryan Michael-F-Bryan merged commit cc92d66 into rust-lang:master Mar 14, 2018
@GuillaumeGomez GuillaumeGomez deleted the improve-css branch March 14, 2018 15:24
Ruin0x11 pushed a commit to Ruin0x11/mdBook that referenced this pull request Aug 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants