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' );
// This theme uses wp_nav_menu() in one location.
// This theme uses wp_nav_menu()
register_nav_menus(
array(
'menu-1' => esc_html__( 'Primary', 'ofisuport' ),

View File

@ -61,6 +61,7 @@
<div class="secondary">
<?php the_header_image_tag(); ?>
<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
wp_nav_menu(
array(

View File

@ -1,129 +1,129 @@
.main-navigation,.secondary-navigation {
//display: block;
//width: 100%;
ul {
display: none;
list-style: none;
margin: 0;
padding-left: 0;
@media screen {
.custom-logo {
min-width: 11rem;
margin: 1rem;
}
.main-navigation,.secondary-navigation {
ul {
box-shadow: 0 3px 3px rgba(0, 0, 0, 0.2);
float: left;
position: absolute;
top: 100%;
left: -999em;
z-index: 99999;
display: none;
list-style: none;
margin: 0;
padding-left: 0;
ul {
box-shadow: 0 3px 3px rgba(0, 0, 0, 0.2);
float: left;
position: absolute;
top: 100%;
left: -999em;
top: 0;
}
z-index: 99999;
li {
ul {
left: -999em;
top: 0;
}
&:hover > ul,
&.focus > ul {
display: block;
left: auto;
li {
&:hover > ul,
&.focus > ul {
display: block;
left: auto;
}
}
a {
width: 200px;
}
:hover > a,
.focus > a {
}
a:hover,
a.focus {
}
}
a {
width: 200px;
}
:hover > a,
.focus > a {
}
a:hover,
a.focus {
li:hover > ul,
li.focus > ul {
left: auto;
}
}
li:hover > ul,
li.focus > ul {
left: auto;
li {
position: relative;
&:hover > a,
&.focus > a {
}
}
a {
display: flex;
align-items: center;
min-height: 100%;
padding: 0 0.5rem;
text-decoration: none;
font-size: 1rem;
}
.current_page_item > a,
.current-menu-item > a,
.current_page_ancestor > a,
.current-menu-ancestor > a {
font-weight: bold;
}
}
li {
position: relative;
&:hover > a,
&.focus > a {
.main-navigation {
.current-menu-item::after {
border-bottom: 2px solid #000;
display: block;
content: "";
width: 60%;
margin: 0 20%;
}
}
a {
display: flex;
align-items: center;
min-height: 100%;
padding: 0 1rem;
text-decoration: none;
font-size: 1rem;
.secondary-navigation {
padding: 1.5rem 0;
a {
text-transform: uppercase;
}
}
.current_page_item > a,
.current-menu-item > a,
.current_page_ancestor > a,
.current-menu-ancestor > a {
font-weight: bold;
}
.current-menu-item::after {
border-bottom: 2px solid #000;
display: block;
content: "";
width: 60%;
margin: 0 20%;
}
}
.main-navigation {
}
.secondary-navigation {
padding: 1.5rem 0;
a {
text-transform: uppercase;
/* Small menu. */
.menu-toggle,
.main-navigation.toggled ul {
display: block;
}
}
/* Small menu. */
.menu-toggle,
.main-navigation.toggled ul {
display: block;
}
@media screen and (min-width: 37.5em) {
.site-branding {
//display: inline-block;
//float: left;
}
@media screen and (min-width: 48em) {
.site-branding {
}
.custom-logo {
width: 11rem;
margin: 1rem;
}
//.menu-primary-menu-container {
// height: 100%;
//}
//.menu-primary-menu-container,
//.menu-secondary-menu-container {
// display: flex;
// justify-content: end;
//}
min-width: 11rem;
margin: 1rem 1rem 1rem 0;
}
.menu-toggle {
display: none;
}
.main-navigation ul {
display: flex;
justify-content: end;
//height:100%;
.main-navigation,.secondary-navigation {
ul {
display: flex;
}
a {
padding: 0 0.5rem;
}
}
.main-navigation {
ul {
justify-content: end;
}
}
.secondary-navigation {
}
.secondary-navigation ul {
display: flex;
}
}
.comment-navigation,
@ -147,3 +147,10 @@
flex: 1 0 50%;
}
}
@media screen and (min-width: 80em) {
.main-navigation,.secondary-navigation {
a {
padding: 0 1rem;
}
}
}

View File

@ -1,27 +1,54 @@
.no-sidebar {
.site {
display: grid;
grid-template-columns: auto;
grid-template-areas:
@media screen {
.no-sidebar {
.site {
display: grid;
grid-template-columns: auto;
grid-template-areas:
"header"
"main"
"footer";
margin: auto;
padding: 0 3rem;
max-width: 80em;
}
.site-header {
.main {
//display: grid;
//grid-template-columns: 1fr 4fr;i
display: flex;
align-items: center;
justify-content: space-between;
border-bottom: 1px solid $color__grey-lighter;
margin: auto;
padding: 0 3rem;
max-width: 80em;
}
.secondary {
display:flex;
justify-content: center;
.site-header {
.main {
display: flex;
flex-flow: column;
align-items: center;
}
.secondary {
}
}
}
}
@media screen and (min-width: 48em) {
.no-sidebar {
.site {
}
.site-header {
.main {
border-bottom: 1px solid $color__grey-lighter;
}
.secondary {
display:flex;
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 {
}
}
}
}

223
style.css
View File

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

File diff suppressed because one or more lines are too long