diff options
| author | bors <bors@rust-lang.org> | 2019-05-19 21:36:15 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-05-19 21:36:15 +0000 |
| commit | a5000c5098d08d9240d875fcb4231533fb922ead (patch) | |
| tree | 26242ae0209975db567fa87a28b4cd0cda1d75a0 | |
| parent | 6afcb5628523b0baae5704ad34ac1aba8ba10de6 (diff) | |
| parent | 9db0fd7fd6a09969c3f3a0018599cef9e12b4ba9 (diff) | |
| download | rust-a5000c5098d08d9240d875fcb4231533fb922ead.tar.gz rust-a5000c5098d08d9240d875fcb4231533fb922ead.zip | |
Auto merge of #60272 - Jakst:patch-1, r=Manishearth
Explicitly set height on rust logo <img> element in docs The layout of the left side menu in docs reflows when navigating between pages because of missing height on the <img> element of rust logo. Setting height='100' tells the browser to reserve that vertical space, leading to a less janky experience.
| -rw-r--r-- | src/librustdoc/html/layout.rs | 6 | ||||
| -rw-r--r-- | src/librustdoc/html/static/rustdoc.css | 23 |
2 files changed, 24 insertions, 5 deletions
diff --git a/src/librustdoc/html/layout.rs b/src/librustdoc/html/layout.rs index acf019fd225..ae0bd1aafa8 100644 --- a/src/librustdoc/html/layout.rs +++ b/src/librustdoc/html/layout.rs @@ -182,14 +182,14 @@ pub fn render<T: fmt::Display, S: fmt::Display>( let p = SlashChecker(&p); if layout.logo.is_empty() { format!("<a href='{path}index.html'>\ - <img src='{static_root_path}rust-logo{suffix}.png' \ - alt='logo' width='100'></a>", + <div class='logo-container'>\ + <img src='{static_root_path}rust-logo{suffix}.png' alt='logo'></div></a>", path=p, static_root_path=static_root_path, suffix=page.resource_suffix) } else { format!("<a href='{}index.html'>\ - <img src='{}' alt='logo' width='100'></a>", + <div class='logo-container'><img src='{}' alt='logo'></div></a>", p, layout.logo) } diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css index 522b6d60a18..4b122e73cbe 100644 --- a/src/librustdoc/html/static/rustdoc.css +++ b/src/librustdoc/html/static/rustdoc.css @@ -182,12 +182,25 @@ nav.sub { display: none !important; } -.sidebar img { +.logo-container { + height: 100px; + width: 100px; + position: relative; margin: 20px auto; display: block; margin-top: 10px; } +.logo-container > img { + max-width: 100px; + max-height: 100px; + position: absolute; + left: 50%; + top: 50%; + transform: translate(-50%, -50%); + display: block; +} + .sidebar .location { border: 1px solid; font-size: 17px; @@ -1030,14 +1043,20 @@ h3 > .collapse-toggle, h4 > .collapse-toggle { padding: 0; } - .sidebar img { + .sidebar .logo-container { width: 35px; + height: 35px; margin-top: 5px; margin-bottom: 5px; float: left; margin-left: 50px; } + .sidebar .logo-container > img { + max-width: 35px; + max-height: 35px; + } + .sidebar-menu { position: fixed; z-index: 10; |
