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:
Tammo ter Hark 2026-11-27 19:56:11 +01:00
commit 3e370322e7
2 changed files with 112 additions and 77 deletions

View file

@ -193,15 +193,19 @@
{# 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
against a legacy stored value that still carries the unit. Row 138
default: 30 px. #}
#survey-nav .logo-left > img {
padding-top: {{ aSurveyInfo.options.brandlogotopmargin|default('30')|replace({'px': ''}) }}px;
default: 30 px. Emitted as margin-top on the logo container: together with
the padding-top:0 on .logo-container / .logo-container > img and the
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 {
padding-top: {{ aSurveyInfo.options.centerlogotopmargin|default('30')|replace({'px': ''}) }}px;
#survey-nav .logo-center.logo-container {
margin-top: {{ aSurveyInfo.options.centerlogotopmargin|default('30')|replace({'px': ''}) }}px;
}
#survey-nav .logo-right > img {
padding-top: {{ aSurveyInfo.options.rightlogotopmargin|default('30')|replace({'px': ''}) }}px;
#survey-nav .logo-right.logo-container {
margin-top: {{ aSurveyInfo.options.rightlogotopmargin|default('30')|replace({'px': ''}) }}px;
}
{# Row 138: header bar height (option headerheight, plain px number; the "px"

View file

@ -80,56 +80,58 @@ For the survey navigator ("Next", "Back", etc.), see: navigation/navigator.twig
fixed-top) is kept as fallback. #}
{% 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 class="container-fluid d-flex align-items-center">
{% if ShowMenu %}
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar"
aria-controls="small-screens-menus" aria-expanded="false">
<span class="visually-hidden-focusable">{{ gT("Tools") }}</span>
<span class="navbar-toggler-icon" aria-hidden="true"></span>
</button>
{% endif %}
{# Left logo #}
{% if showBrandLogo %}
<div class="navbar-brand logo-container logo-left {{ navmacros.logoVisibilityClasses(aSurveyInfo.options, 'brand') }}">
{{ image(brandLogoFile, aSurveyInfo.name, {"class": "logo img-fluid"}) }}
</div>
{% else %}
<div class="navbar-brand logo-left">
{{ aSurveyInfo.name }}
</div>
{% endif %}
{# Center logo (absolutely centered via CSS, see sass/plain.sass) #}
{% if showCenterLogo %}
<div class="navbar-brand logo-container logo-center {{ navmacros.logoVisibilityClasses(aSurveyInfo.options, 'center') }}">
{{ image(centerLogoFile, aSurveyInfo.name, {"class": "logo img-fluid"}) }}
</div>
{% endif %}
{# RIGHT zone — always pushed to the far right (ms-auto on the wrapper).
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 #}
<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 %}
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar"
aria-controls="small-screens-menus" aria-expanded="false">
<span class="visually-hidden-focusable">{{ gT("Tools") }}</span>
<span class="navbar-toggler-icon" aria-hidden="true"></span>
</button>
{% endif %}
{# Left logo #}
{% if showBrandLogo %}
<div class="navbar-brand logo-container logo-left {{ navmacros.logoVisibilityClasses(aSurveyInfo.options, 'brand') }}">
{{ image(brandLogoFile, aSurveyInfo.name, {"class": "logo img-fluid"}) }}
</div>
{% else %}
<div class="navbar-brand logo-left">
{{ aSurveyInfo.name }}
</div>
{% endif %}
{# Center logo (absolutely centered within the logo row via CSS, see sass/plain.sass) #}
{% if showCenterLogo %}
<div class="navbar-brand logo-container logo-center {{ navmacros.logoVisibilityClasses(aSurveyInfo.options, 'center') }}">
{{ image(centerLogoFile, aSurveyInfo.name, {"class": "logo img-fluid"}) }}
</div>
{% endif %}
{# Right logo — far right of the logo row (ms-auto) #}
{% 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"}) }}
</div>
{% endif %}
{% if ShowMenu %}
<div id="navbar" class="collapse navbar-collapse navbar-nav-scroll pt-2">
<ul class="nav navbar-nav navbar-action-link navbar-right">
{{ include('./subviews/navigation/save_links.twig') }}
{{ include('./subviews/navigation/clearall_links.twig') }}
{{ include('./subviews/navigation/question_index_menu.twig') }}
{{ include('./subviews/navigation/language_changer_top_menu.twig') }}
</ul>
</div>
{% 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 %}
<div id="navbar" class="collapse navbar-collapse navbar-nav-scroll pt-2 w-100">
<ul class="nav navbar-nav navbar-action-link navbar-right ms-auto">
{{ include('./subviews/navigation/save_links.twig') }}
{{ include('./subviews/navigation/clearall_links.twig') }}
{{ include('./subviews/navigation/question_index_menu.twig') }}
{{ include('./subviews/navigation/language_changer_top_menu.twig') }}
</ul>
</div>
{% endif %}
</div>
</div>
{% endif %}