styled menus and header for small medium and large screens

This commit is contained in:
jorge 2022-12-01 10:08:19 +01:00
parent 1644f30e44
commit 055f78f357
6 changed files with 275 additions and 225 deletions

View File

@ -46,7 +46,7 @@ function ofisuport_setup() {
*/ */
add_theme_support( 'post-thumbnails' ); add_theme_support( 'post-thumbnails' );
// This theme uses wp_nav_menu() in one location. // This theme uses wp_nav_menu()
register_nav_menus( register_nav_menus(
array( array(
'menu-1' => esc_html__( 'Primary', 'ofisuport' ), 'menu-1' => esc_html__( 'Primary', 'ofisuport' ),

View File

@ -61,6 +61,7 @@
<div class="secondary"> <div class="secondary">
<?php the_header_image_tag(); ?> <?php the_header_image_tag(); ?>
<nav id="site-navigation" class="secondary-navigation"> <nav id="site-navigation" class="secondary-navigation">
<button class="menu-toggle" aria-controls="secondary-menu" aria-expanded="false"><?php esc_html_e( 'Secondary Menu', 'ofisuport' ); ?></button>
<?php <?php
wp_nav_menu( wp_nav_menu(
array( array(

View File

@ -1,7 +1,10 @@
.main-navigation,.secondary-navigation {
//display: block;
//width: 100%;
@media screen {
.custom-logo {
min-width: 11rem;
margin: 1rem;
}
.main-navigation,.secondary-navigation {
ul { ul {
display: none; display: none;
list-style: none; list-style: none;
@ -61,7 +64,7 @@
display: flex; display: flex;
align-items: center; align-items: center;
min-height: 100%; min-height: 100%;
padding: 0 1rem; padding: 0 0.5rem;
text-decoration: none; text-decoration: none;
font-size: 1rem; font-size: 1rem;
} }
@ -72,6 +75,9 @@
.current-menu-ancestor > a { .current-menu-ancestor > a {
font-weight: bold; font-weight: bold;
} }
}
.main-navigation {
.current-menu-item::after { .current-menu-item::after {
border-bottom: 2px solid #000; border-bottom: 2px solid #000;
display: block; display: block;
@ -79,50 +85,44 @@
width: 60%; width: 60%;
margin: 0 20%; margin: 0 20%;
} }
} }
.secondary-navigation {
.main-navigation {
}
.secondary-navigation {
padding: 1.5rem 0; padding: 1.5rem 0;
a { a {
text-transform: uppercase; text-transform: uppercase;
} }
} }
/* Small menu. */ /* Small menu. */
.menu-toggle, .menu-toggle,
.main-navigation.toggled ul { .main-navigation.toggled ul {
display: block; display: block;
}
} }
@media screen and (min-width: 48em) {
@media screen and (min-width: 37.5em) {
.site-branding { .site-branding {
//display: inline-block;
//float: left;
} }
.custom-logo { .custom-logo {
width: 11rem; min-width: 11rem;
margin: 1rem; margin: 1rem 1rem 1rem 0;
} }
//.menu-primary-menu-container {
// height: 100%;
//}
//.menu-primary-menu-container,
//.menu-secondary-menu-container {
// display: flex;
// justify-content: end;
//}
.menu-toggle { .menu-toggle {
display: none; display: none;
} }
.main-navigation ul { .main-navigation,.secondary-navigation {
ul {
display: flex; display: flex;
justify-content: end;
//height:100%;
} }
.secondary-navigation ul { a {
display: flex; padding: 0 0.5rem;
}
}
.main-navigation {
ul {
justify-content: end;
}
}
.secondary-navigation {
} }
} }
@ -147,3 +147,10 @@
flex: 1 0 50%; flex: 1 0 50%;
} }
} }
@media screen and (min-width: 80em) {
.main-navigation,.secondary-navigation {
a {
padding: 0 1rem;
}
}
}

View File

@ -1,4 +1,5 @@
.no-sidebar { @media screen {
.no-sidebar {
.site { .site {
display: grid; display: grid;
grid-template-columns: auto; grid-template-columns: auto;
@ -12,11 +13,21 @@
} }
.site-header { .site-header {
.main { .main {
//display: grid;
//grid-template-columns: 1fr 4fr;i
display: flex; display: flex;
flex-flow: column;
align-items: center; align-items: center;
justify-content: space-between; }
.secondary {
}
}
}
}
@media screen and (min-width: 48em) {
.no-sidebar {
.site {
}
.site-header {
.main {
border-bottom: 1px solid $color__grey-lighter; border-bottom: 1px solid $color__grey-lighter;
} }
.secondary { .secondary {
@ -24,4 +35,20 @@
justify-content: center; justify-content: center;
} }
} }
}
}
@media screen and (min-width: 80em) {
.no-sidebar {
.site {
}
.site-header {
.main {
flex-flow: row;
align-items: center;
justify-content: space-between;
}
.secondary {
}
}
}
} }

143
style.css
View File

@ -713,25 +713,38 @@ textarea {
/*-------------------------------------------------------------- /*--------------------------------------------------------------
# Layouts # Layouts
--------------------------------------------------------------*/ --------------------------------------------------------------*/
.no-sidebar .site { @media screen {
.no-sidebar .site {
display: grid; display: grid;
grid-template-columns: auto; grid-template-columns: auto;
grid-template-areas: "header" "main" "footer"; grid-template-areas: "header" "main" "footer";
margin: auto; margin: auto;
padding: 0 3rem; padding: 0 3rem;
max-width: 80em; max-width: 80em;
} }
.no-sidebar .site-header .main {
.no-sidebar .site-header .main {
display: flex; display: flex;
flex-flow: column;
align-items: center; align-items: center;
justify-content: space-between; }
border-bottom: 1px solid #eee;
} }
.no-sidebar .site-header .secondary { @media screen and (min-width: 48em) {
.no-sidebar .site-header .main {
border-bottom: 1px solid #eee;
}
.no-sidebar .site-header .secondary {
display: flex; display: flex;
justify-content: center; justify-content: center;
}
}
@media screen and (min-width: 80em) {
.no-sidebar .site-header .main {
flex-flow: row;
align-items: center;
justify-content: space-between;
}
} }
/*-------------------------------------------------------------- /*--------------------------------------------------------------
@ -739,103 +752,99 @@ textarea {
--------------------------------------------------------------*/ --------------------------------------------------------------*/
/* Navigation /* Navigation
--------------------------------------------- */ --------------------------------------------- */
.main-navigation ul, .secondary-navigation ul { @media screen {
.custom-logo {
min-width: 11rem;
margin: 1rem;
}
.main-navigation ul, .secondary-navigation ul {
display: none; display: none;
list-style: none; list-style: none;
margin: 0; margin: 0;
padding-left: 0; padding-left: 0;
} }
.main-navigation ul ul, .secondary-navigation ul ul {
.main-navigation ul ul, .secondary-navigation ul ul {
box-shadow: 0 3px 3px rgba(0, 0, 0, 0.2); box-shadow: 0 3px 3px rgba(0, 0, 0, 0.2);
float: left; float: left;
position: absolute; position: absolute;
top: 100%; top: 100%;
left: -999em; left: -999em;
z-index: 99999; z-index: 99999;
} }
.main-navigation ul ul ul, .secondary-navigation ul ul ul {
.main-navigation ul ul ul, .secondary-navigation ul ul ul {
left: -999em; left: -999em;
top: 0; top: 0;
} }
.main-navigation ul ul li:hover > ul,
.main-navigation ul ul li:hover > ul, .main-navigation ul ul li.focus > ul, .secondary-navigation ul ul li:hover > ul,
.main-navigation ul ul li.focus > ul, .secondary-navigation ul ul li:hover > ul, .secondary-navigation ul ul li.focus > ul {
.secondary-navigation ul ul li.focus > ul {
display: block; display: block;
left: auto; left: auto;
} }
.main-navigation ul ul a, .secondary-navigation ul ul a {
.main-navigation ul ul a, .secondary-navigation ul ul a {
width: 200px; width: 200px;
} }
.main-navigation ul li:hover > ul,
.main-navigation ul li:hover > ul, .main-navigation ul li.focus > ul, .secondary-navigation ul li:hover > ul,
.main-navigation ul li.focus > ul, .secondary-navigation ul li:hover > ul, .secondary-navigation ul li.focus > ul {
.secondary-navigation ul li.focus > ul {
left: auto; left: auto;
} }
.main-navigation li, .secondary-navigation li {
.main-navigation li, .secondary-navigation li {
position: relative; position: relative;
} }
.main-navigation a, .secondary-navigation a {
.main-navigation a, .secondary-navigation a {
display: flex; display: flex;
align-items: center; align-items: center;
min-height: 100%; min-height: 100%;
padding: 0 1rem; padding: 0 0.5rem;
text-decoration: none; text-decoration: none;
font-size: 1rem; font-size: 1rem;
} }
.main-navigation .current_page_item > a,
.main-navigation .current_page_item > a, .main-navigation .current-menu-item > a,
.main-navigation .current-menu-item > a, .main-navigation .current_page_ancestor > a,
.main-navigation .current_page_ancestor > a, .main-navigation .current-menu-ancestor > a, .secondary-navigation .current_page_item > a,
.main-navigation .current-menu-ancestor > a, .secondary-navigation .current_page_item > a, .secondary-navigation .current-menu-item > a,
.secondary-navigation .current-menu-item > a, .secondary-navigation .current_page_ancestor > a,
.secondary-navigation .current_page_ancestor > a, .secondary-navigation .current-menu-ancestor > a {
.secondary-navigation .current-menu-ancestor > a {
font-weight: bold; font-weight: bold;
} }
.main-navigation .current-menu-item::after {
.main-navigation .current-menu-item::after, .secondary-navigation .current-menu-item::after {
border-bottom: 2px solid #000; border-bottom: 2px solid #000;
display: block; display: block;
content: ""; content: "";
width: 60%; width: 60%;
margin: 0 20%; margin: 0 20%;
} }
.secondary-navigation {
.secondary-navigation {
padding: 1.5rem 0; padding: 1.5rem 0;
} }
.secondary-navigation a {
.secondary-navigation a {
text-transform: uppercase; text-transform: uppercase;
} }
/* Small menu. */
/* Small menu. */ .menu-toggle,
.menu-toggle, .main-navigation.toggled ul {
.main-navigation.toggled ul {
display: block; display: block;
}
} }
@media screen and (min-width: 37.5em) { @media screen and (min-width: 48em) {
.custom-logo { .custom-logo {
width: 11rem; min-width: 11rem;
margin: 1rem; margin: 1rem 1rem 1rem 0;
} }
.menu-toggle { .menu-toggle {
display: none; display: none;
} }
.main-navigation ul { .main-navigation ul, .secondary-navigation ul {
display: flex; display: flex;
justify-content: end;
} }
.secondary-navigation ul { .main-navigation a, .secondary-navigation a {
display: flex; padding: 0 0.5rem;
}
.main-navigation ul {
justify-content: end;
} }
} }
@ -864,6 +873,12 @@ textarea {
flex: 1 0 50%; flex: 1 0 50%;
} }
@media screen and (min-width: 80em) {
.main-navigation a, .secondary-navigation a {
padding: 0 1rem;
}
}
/* Posts and pages /* Posts and pages
--------------------------------------------- */ --------------------------------------------- */
.sticky { .sticky {

File diff suppressed because one or more lines are too long