fix(header): exact logo-top margin (0px touches top); menu texts on their own header row
- nav_bar.twig: header split into two rows — row 1 .survey-nav-logo-row holds all logos (left far left, center absolutely centered in the row, right ms-auto far right) so they align; row 2 #navbar holds the menu texts (language changer, save/clear all, question index) full-width, right-aligned - sass/plain.sass (leading): #survey-nav align-items:flex-start, container stretch, .survey-nav-logo-row relative/w-100, .logo-container and its img padding-top:0, .logo-center top:0 translateX(-50%); dropped .logo-right margin-left:0 (ms-auto now on the element) - css/plain.css: compiled from sass with dart-sass (export guard green) - custom_header.twig: <pos>logotopmargin now emitted as margin-top on the .logo-*.logo-container, so the value is the EXACT distance from the top of the header to the logo (0px = logo touches the top of the page) - README.md: header layout + logo-top-distance sections updated Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
parent
dc2f09e73c
commit
3e370322e7
4 changed files with 112 additions and 77 deletions
32
README.md
32
README.md
|
|
@ -16,12 +16,15 @@ copying of files needed.
|
||||||
child options (a field with `parent="..."` is hidden unless the parent is
|
child options (a field with `parent="..."` is hidden unless the parent is
|
||||||
`on`), image previews (lightbox) and image upload — see
|
`on`), image previews (lightbox) and image upload — see
|
||||||
`options/options.twig` and the sections below.
|
`options/options.twig` and the sections below.
|
||||||
- Header with left / center / right logos: the left logo always sticks to the
|
- Header with left / center / right logos in a single top row: the left logo
|
||||||
far left, the center logo is always exactly centered (absolutely positioned,
|
always sticks to the far left, the center logo is always exactly centered
|
||||||
independent of the other logos), the right logo always sticks to the far right;
|
(absolutely positioned, independent of the other logos), the right logo
|
||||||
when a right logo is present, the right-side menu texts (language changer,
|
always sticks to the far right — so all logos align nicely. The right-side
|
||||||
save/clear all, question index) still appear at the right but BELOW the logo.
|
menu texts (language changer, save/clear all, question index) sit on their
|
||||||
Each logo can be hidden on small screens.
|
own row in the header, below the logos, right-aligned.
|
||||||
|
Each logo can be hidden on small screens, and each logo has a top margin
|
||||||
|
option that is the exact distance from the top of the header to the logo
|
||||||
|
(`0` = the logo touches the top of the page).
|
||||||
- House-style colors, fonts and logos per client variant, without code
|
- House-style colors, fonts and logos per client variant, without code
|
||||||
duplication (thin variants extending this starter theme).
|
duplication (thin variants extending this starter theme).
|
||||||
|
|
||||||
|
|
@ -125,9 +128,10 @@ LimeSurvey developers).
|
||||||
|
|
||||||
Three independent logo options in the Images category: `brandlogo`(+`brandlogofile`)
|
Three independent logo options in the Images category: `brandlogo`(+`brandlogofile`)
|
||||||
left, `centerlogo`(+`centerlogofile`) center, `rightlogo`(+`rightlogofile`)
|
left, `centerlogo`(+`centerlogofile`) center, `rightlogo`(+`rightlogofile`)
|
||||||
right. The center logo is absolutely positioned at `left: 50%` of the
|
right. All three logos share one top-aligned row (`.survey-nav-logo-row` in
|
||||||
full-width navbar container (see `css/plain.css`), so it sits in the true
|
`nav_bar.twig`); the center logo is absolutely positioned at `left: 50%` of
|
||||||
center of the header no matter how wide the left or right logo is. Logo files
|
that row (see `css/plain.css`), so it sits in the true center of the header no
|
||||||
|
matter how wide the left or right logo is. Logo files
|
||||||
are looked up in the theme's own `files/` folder first, then in the starter
|
are looked up in the theme's own `files/` folder first, then in the starter
|
||||||
theme's `files/` folder.
|
theme's `files/` folder.
|
||||||
|
|
||||||
|
|
@ -146,9 +150,13 @@ and should contrast with `headerbackgroundcolor`.
|
||||||
|
|
||||||
## Distance from the logo to the top of the screen
|
## Distance from the logo to the top of the screen
|
||||||
|
|
||||||
Option `logotopmargin` (Images category, e.g. `15px` or `0px`) sets the top
|
Per logo, options `brandlogotopmargin` / `centerlogotopmargin` /
|
||||||
padding of the header logos, applied in `custom_header.twig`. Use `0px` to
|
`rightlogotopmargin` (Header category, plain px number 0-100, e.g. `30` or
|
||||||
align a logo exactly with the top of the screen.
|
`0`) set the distance from the top of the header to the top of that logo,
|
||||||
|
applied as `margin-top` on the logo container in `custom_header.twig`. The
|
||||||
|
header content is top-aligned and the logo containers/images have no top
|
||||||
|
padding (see `css/plain.css`), so the value is the EXACT distance: use `0`
|
||||||
|
to make a logo touch the top of the page.
|
||||||
|
|
||||||
## Sticky header per screen size (computer / tablet / mobile)
|
## Sticky header per screen size (computer / tablet / mobile)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
@charset "UTF-8";
|
||||||
body.font-arial {
|
body.font-arial {
|
||||||
font-family: Arial, Helvetica, sans-serif;
|
font-family: Arial, Helvetica, sans-serif;
|
||||||
}
|
}
|
||||||
|
|
@ -204,31 +205,51 @@ div.qvideo .question-valid-container {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Header: three zones — left logo always far left, center logo always exactly
|
/* Header: TWO rows inside #survey-nav (markup in nav_bar.twig) —
|
||||||
centered (absolute, independent of the other zones), right zone always far
|
* row 1 (.survey-nav-logo-row): the logos. Left logo always far left, center
|
||||||
right (ms-auto on .survey-nav-right). When a right logo is present, the
|
* logo always exactly centered (absolute, independent of the other logos),
|
||||||
right-side menu texts (language changer, save/clear all, question index) sit
|
* right logo always far right (ms-auto). All logos share this single row, so
|
||||||
BELOW the logo (flex-column wrapper), still right-aligned. */
|
* they align nicely.
|
||||||
|
* row 2 (#navbar): the menu texts (language changer, save/clear all, question
|
||||||
|
* index) on their own full-width row below the logos, right-aligned.
|
||||||
|
* The header content is TOP-aligned (align-items: flex-start) and the logo
|
||||||
|
* containers/images get padding-top: 0, so the per-logo top margin option
|
||||||
|
* (<pos>logotopmargin, emitted as margin-top on .logo-container in
|
||||||
|
* custom_header.twig) is the EXACT distance from the top of the header to the
|
||||||
|
* top of the logo: 0 px = the logo touches the top of the page. */
|
||||||
|
#survey-nav {
|
||||||
|
align-items: flex-start;
|
||||||
|
}
|
||||||
|
|
||||||
#survey-nav .container-fluid,
|
#survey-nav .container-fluid,
|
||||||
#survey-nav .container {
|
#survey-nav .container {
|
||||||
|
align-items: stretch;
|
||||||
|
}
|
||||||
|
|
||||||
|
#survey-nav .survey-nav-logo-row {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#survey-nav .logo-container {
|
||||||
|
padding-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#survey-nav .logo-container > img {
|
||||||
|
padding-top: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#survey-nav .logo-center {
|
#survey-nav .logo-center {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
top: 50%;
|
top: 0;
|
||||||
transform: translate(-50%, -50%);
|
transform: translateX(-50%);
|
||||||
float: none;
|
float: none;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#survey-nav .logo-right {
|
|
||||||
margin-left: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* NOTE: the swatch-chip / disable-mode styles for the options page live INLINE in
|
/* NOTE: the swatch-chip / disable-mode styles for the options page live INLINE in
|
||||||
options/options.twig (<style> block) — the admin options page does not load
|
* options/options.twig (<style> block) — the admin options page does not load
|
||||||
css/plain.css, so they would not apply from here (rows 117-119). */
|
* css/plain.css, so they would not apply from here (rows 117-119). */
|
||||||
|
|
||||||
/*# sourceMappingURL=plain.css.map */
|
/*# sourceMappingURL=plain.css.map */
|
||||||
|
|
|
||||||
|
|
@ -193,15 +193,19 @@
|
||||||
{# Prompt M: per-logo top margin (options <pos>logotopmargin hold a plain px
|
{# Prompt M: per-logo top margin (options <pos>logotopmargin hold a plain px
|
||||||
number 0-100; the "px" unit is added here. |replace({'px':''}) guards
|
number 0-100; the "px" unit is added here. |replace({'px':''}) guards
|
||||||
against a legacy stored value that still carries the unit. Row 138
|
against a legacy stored value that still carries the unit. Row 138
|
||||||
default: 30 px. #}
|
default: 30 px. Emitted as margin-top on the logo container: together with
|
||||||
#survey-nav .logo-left > img {
|
the padding-top:0 on .logo-container / .logo-container > img and the
|
||||||
padding-top: {{ aSurveyInfo.options.brandlogotopmargin|default('30')|replace({'px': ''}) }}px;
|
top-aligned header in css/plain.css (sass/plain.sass), the value is the
|
||||||
|
EXACT distance from the top of the header to the top of the logo —
|
||||||
|
0 px means the logo touches the top of the page. #}
|
||||||
|
#survey-nav .logo-left.logo-container {
|
||||||
|
margin-top: {{ aSurveyInfo.options.brandlogotopmargin|default('30')|replace({'px': ''}) }}px;
|
||||||
}
|
}
|
||||||
#survey-nav .logo-center > img {
|
#survey-nav .logo-center.logo-container {
|
||||||
padding-top: {{ aSurveyInfo.options.centerlogotopmargin|default('30')|replace({'px': ''}) }}px;
|
margin-top: {{ aSurveyInfo.options.centerlogotopmargin|default('30')|replace({'px': ''}) }}px;
|
||||||
}
|
}
|
||||||
#survey-nav .logo-right > img {
|
#survey-nav .logo-right.logo-container {
|
||||||
padding-top: {{ aSurveyInfo.options.rightlogotopmargin|default('30')|replace({'px': ''}) }}px;
|
margin-top: {{ aSurveyInfo.options.rightlogotopmargin|default('30')|replace({'px': ''}) }}px;
|
||||||
}
|
}
|
||||||
|
|
||||||
{# Row 138: header bar height (option headerheight, plain px number; the "px"
|
{# Row 138: header bar height (option headerheight, plain px number; the "px"
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,15 @@ For the survey navigator ("Next", "Back", etc.), see: navigation/navigator.twig
|
||||||
fixed-top) is kept as fallback. #}
|
fixed-top) is kept as fallback. #}
|
||||||
{% set bStickyConfigured = aSurveyInfo.options.headerstickycomputer is defined %}
|
{% set bStickyConfigured = aSurveyInfo.options.headerstickycomputer is defined %}
|
||||||
<div id="survey-nav" class="navbar {{ navClass }} navbar-expand-md {% if not bStickyConfigured %}fixed-top{% endif %} border-bottom pt-0 pb-0 {% if sHeaderFont != 'base' %}font-{{ sHeaderFont }}{% endif %}"{% if sHeaderTextColor != '' %} style="color: {{ sHeaderTextColor }};"{% endif %}>
|
<div id="survey-nav" class="navbar {{ navClass }} navbar-expand-md {% if not bStickyConfigured %}fixed-top{% endif %} border-bottom pt-0 pb-0 {% if sHeaderFont != 'base' %}font-{{ sHeaderFont }}{% endif %}"{% if sHeaderTextColor != '' %} style="color: {{ sHeaderTextColor }};"{% endif %}>
|
||||||
<div class="container-fluid d-flex align-items-center">
|
<div class="container-fluid d-flex flex-column">
|
||||||
|
{# ROW 1 — the logos (layout rules in sass/plain.sass): left logo always
|
||||||
|
far left, center logo always exactly centered (absolute, independent
|
||||||
|
of the other logos), right logo always far right (ms-auto). All logos
|
||||||
|
share this single top-aligned row, so they align nicely. The per-logo
|
||||||
|
top margin (<pos>logotopmargin) is applied as margin-top on
|
||||||
|
.logo-container in custom_header.twig and is the EXACT distance from
|
||||||
|
the top of the header to the top of the logo (0 px = touches top). #}
|
||||||
|
<div class="survey-nav-logo-row d-flex align-items-start w-100">
|
||||||
{% if ShowMenu %}
|
{% if ShowMenu %}
|
||||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar"
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar"
|
||||||
aria-controls="small-screens-menus" aria-expanded="false">
|
aria-controls="small-screens-menus" aria-expanded="false">
|
||||||
|
|
@ -98,30 +106,25 @@ For the survey navigator ("Next", "Back", etc.), see: navigation/navigator.twig
|
||||||
{{ aSurveyInfo.name }}
|
{{ aSurveyInfo.name }}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{# Center logo (absolutely centered via CSS, see sass/plain.sass) #}
|
{# Center logo (absolutely centered within the logo row via CSS, see sass/plain.sass) #}
|
||||||
{% if showCenterLogo %}
|
{% if showCenterLogo %}
|
||||||
<div class="navbar-brand logo-container logo-center {{ navmacros.logoVisibilityClasses(aSurveyInfo.options, 'center') }}">
|
<div class="navbar-brand logo-container logo-center {{ navmacros.logoVisibilityClasses(aSurveyInfo.options, 'center') }}">
|
||||||
{{ image(centerLogoFile, aSurveyInfo.name, {"class": "logo img-fluid"}) }}
|
{{ image(centerLogoFile, aSurveyInfo.name, {"class": "logo img-fluid"}) }}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{# RIGHT zone — always pushed to the far right (ms-auto on the wrapper).
|
{# Right logo — far right of the logo row (ms-auto) #}
|
||||||
Layout rules (see sass/plain.sass):
|
|
||||||
- left logo always far left, right logo always far right;
|
|
||||||
- center logo always exactly centered (absolute), independent of the
|
|
||||||
other logos;
|
|
||||||
- when a right logo is present, the right-side menu texts (language
|
|
||||||
changer, save/clear all, question index) still appear at the right,
|
|
||||||
but BELOW the logo (flex-column wrapper). #}
|
|
||||||
<div class="survey-nav-right ms-auto d-flex flex-column align-items-end">
|
|
||||||
{# Right logo #}
|
|
||||||
{% if showRightLogo %}
|
{% if showRightLogo %}
|
||||||
<div class="navbar-brand logo-container logo-right {{ navmacros.logoVisibilityClasses(aSurveyInfo.options, 'right') }}">
|
<div class="navbar-brand logo-container logo-right ms-auto {{ navmacros.logoVisibilityClasses(aSurveyInfo.options, 'right') }}">
|
||||||
{{ image(rightLogoFile, aSurveyInfo.name, {"class": "logo img-fluid"}) }}
|
{{ image(rightLogoFile, aSurveyInfo.name, {"class": "logo img-fluid"}) }}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{# ROW 2 — the menu texts (language changer, save/clear all, question
|
||||||
|
index) on their own full-width row in the header, BELOW the logo row,
|
||||||
|
right-aligned (ms-auto on the ul). #}
|
||||||
{% if ShowMenu %}
|
{% if ShowMenu %}
|
||||||
<div id="navbar" class="collapse navbar-collapse navbar-nav-scroll pt-2">
|
<div id="navbar" class="collapse navbar-collapse navbar-nav-scroll pt-2 w-100">
|
||||||
<ul class="nav navbar-nav navbar-action-link navbar-right">
|
<ul class="nav navbar-nav navbar-action-link navbar-right ms-auto">
|
||||||
{{ include('./subviews/navigation/save_links.twig') }}
|
{{ include('./subviews/navigation/save_links.twig') }}
|
||||||
{{ include('./subviews/navigation/clearall_links.twig') }}
|
{{ include('./subviews/navigation/clearall_links.twig') }}
|
||||||
{{ include('./subviews/navigation/question_index_menu.twig') }}
|
{{ include('./subviews/navigation/question_index_menu.twig') }}
|
||||||
|
|
@ -131,5 +134,4 @@ For the survey navigator ("Next", "Back", etc.), see: navigation/navigator.twig
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue