1
Fork 0

Wrap logo in container to prevent layout reflow

This commit is contained in:
Jakob Ståhl 2019-04-27 15:09:57 +02:00 committed by Guillaume Gomez
parent f998182fb4
commit 184e3a3f92
2 changed files with 9 additions and 2 deletions

View file

@ -182,14 +182,16 @@ pub fn render<T: fmt::Display, S: fmt::Display>(
let p = SlashChecker(&p); let p = SlashChecker(&p);
if layout.logo.is_empty() { if layout.logo.is_empty() {
format!("<a href='{path}index.html'>\ format!("<a href='{path}index.html'>\
<div class='logo-container'>\
<img src='{static_root_path}rust-logo{suffix}.png' \ <img src='{static_root_path}rust-logo{suffix}.png' \
alt='logo' width='100'></a>", alt='logo' width='100'></div></a>",
path=p, path=p,
static_root_path=static_root_path, static_root_path=static_root_path,
suffix=page.resource_suffix) suffix=page.resource_suffix)
} else { } else {
format!("<a href='{}index.html'>\ format!("<a href='{}index.html'>\
<img src='{}' alt='logo' width='100'></a>", <div class='logo-container'>\
<img src='{}' alt='logo' width='100'></div></a>",
p, p,
layout.logo) layout.logo)
} }

View file

@ -182,6 +182,11 @@ nav.sub {
display: none !important; display: none !important;
} }
.logo-container {
height: 0;
padding-bottom: 50%;
}
.sidebar img { .sidebar img {
margin: 20px auto; margin: 20px auto;
display: block; display: block;