changeset 7044:eaf600434cf5

less: change markup and styling for the logo shown in the top left corner Based on work by Dominik Ruf, but in this changeset, the goal is just to improve markup and styling while keeping exactly the same look and feel. In that process, it also fixes some browser specific issues that gave odd spacing/positioning. All styling (especially the logo image URL) is moved to CSS/LESS, using background-image styling instead of an img tag. The logo image is made a :before on the site branding text and will usually have to align with this text, so we use inline-block to align to the baseline. We set the right amount of negative margin-bottom so the image can go below the baseline. We use a "big enough" negative margin-top to allow the image to bleed outside the line height and into the 12px top padding. We assume the background image doesn't need cropping or panning and do thus not set background-size, background-position, or background-repeat.
author Mads Kiilerich <mads@kiilerich.com>
date Mon, 27 Nov 2017 02:55:44 +0100
parents 079b24620dce
children 99f81d23ea20
files kallithea/public/css/style.css kallithea/public/less/style.less kallithea/templates/base/root.html
diffstat 3 files changed, 24 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/public/css/style.css	Tue Oct 24 21:41:07 2017 +0200
+++ b/kallithea/public/css/style.css	Mon Nov 27 02:55:44 2017 +0100
@@ -98,9 +98,16 @@
   min-height: 44px;
   background-color: #577632;
 }
-nav.navbar #logo > .navbar-brand > img {
-  margin-top: -9px;
-  margin-right: 5px;
+/* logo */
+.navbar-brand .branding:before {
+  content: "";
+  display: inline-block;
+  margin-right: .2em;
+  background-image: url("../images/kallithea-logo.svg");
+  width: 140px;
+  height: 30px;
+  margin-bottom: -4px;
+  margin-top: -12px;
 }
 /* every direct child of a panel, that is not .panel-heading, should auto
  * overflow to prevent overflowing of elements like text boxes and tables */
--- a/kallithea/public/less/style.less	Tue Oct 24 21:41:07 2017 +0200
+++ b/kallithea/public/less/style.less	Mon Nov 27 02:55:44 2017 +0100
@@ -106,9 +106,19 @@
   min-height: 44px;
   background-color: #577632;
 }
-nav.navbar #logo > .navbar-brand > img {
-  margin-top: -9px;
-  margin-right: 5px;
+
+/* logo */
+.navbar-brand .branding {
+  &:before {
+    content: "";
+    display: inline-block;
+    margin-right: .2em;
+    background-image: url("../images/kallithea-logo.svg");
+    width: 140px;
+    height: 30px;
+    margin-bottom: -4px;
+    margin-top: -12px;
+  }
 }
 
 /* every direct child of a panel, that is not .panel-heading, should auto
--- a/kallithea/templates/base/root.html	Tue Oct 24 21:41:07 2017 +0200
+++ b/kallithea/templates/base/root.html	Mon Nov 27 02:55:44 2017 +0100
@@ -116,10 +116,7 @@
       <nav class="navbar navbar-inverse mainmenu">
           <div class="navbar-header" id="logo">
             <a class="navbar-brand" href="${h.url('home')}">
-                <img class="pull-left" src="${h.url('/images/kallithea-logo.svg')}" alt="Kallithea"/>
-                  %if c.site_name:
-                    <span class="branding">${c.site_name}</span>
-                  %endif
+              <span class="branding">${c.site_name}</span>
             </a>
             <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
               <span class="sr-only">Toggle navigation</span>