Skip to content

Commit 184e3a3

Browse files
jakstGuillaumeGomez
authored andcommitted
Wrap logo in container to prevent layout reflow
1 parent f998182 commit 184e3a3

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/librustdoc/html/layout.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -182,14 +182,16 @@ pub fn render<T: fmt::Display, S: fmt::Display>(
182182
let p = SlashChecker(&p);
183183
if layout.logo.is_empty() {
184184
format!("<a href='{path}index.html'>\
185+
<div class='logo-container'>\
185186
<img src='{static_root_path}rust-logo{suffix}.png' \
186-
alt='logo' width='100'></a>",
187+
alt='logo' width='100'></div></a>",
187188
path=p,
188189
static_root_path=static_root_path,
189190
suffix=page.resource_suffix)
190191
} else {
191192
format!("<a href='{}index.html'>\
192-
<img src='{}' alt='logo' width='100'></a>",
193+
<div class='logo-container'>\
194+
<img src='{}' alt='logo' width='100'></div></a>",
193195
p,
194196
layout.logo)
195197
}

src/librustdoc/html/static/rustdoc.css

+5
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,11 @@ nav.sub {
182182
display: none !important;
183183
}
184184

185+
.logo-container {
186+
height: 0;
187+
padding-bottom: 50%;
188+
}
189+
185190
.sidebar img {
186191
margin: 20px auto;
187192
display: block;

0 commit comments

Comments
 (0)