From 9ef94f51b63e02be300ef5ce19001f749152155f Mon Sep 17 00:00:00 2001 From: Uncledaviss Date: Thu, 16 May 2024 09:28:52 +0200 Subject: [PATCH] Fix nav on destop --- global/global.css | 63 +++++++++++++++++++++++++++++++++-------------- 1 file changed, 44 insertions(+), 19 deletions(-) diff --git a/global/global.css b/global/global.css index 99fcf8b..e7ae01c 100644 --- a/global/global.css +++ b/global/global.css @@ -1,7 +1,8 @@ -body{ +body { min-width: 100%; margin: 0; } + .wrapper { display: flex; flex-flow: row wrap; @@ -10,12 +11,12 @@ body{ background-color: #333333; } -.wrapper > * { +.wrapper>* { /*padding: 10px;*/ flex: 1 100%; } -.container{ +.container { /* We first create a flex layout context */ display: flex; @@ -35,7 +36,7 @@ body{ min-width: auto; } -.container_menu{ +.container_menu { /* We first create a flex layout context */ display: flex; @@ -56,7 +57,7 @@ body{ } /******* header *******/ -header{ +header { background-color: #151b54; } @@ -73,18 +74,19 @@ header{ } -#header p{ +#header p { margin: 0; padding: 0; } /* navigation */ /* Add a black background color to the top navigation */ -nav{ +nav { background-color: #333; display: flex; flex-direction: row; } + .topnav { background-color: #333; overflow: hidden; @@ -134,7 +136,7 @@ nav{ position: absolute; background-color: #f9f9f9; min-width: 160px; - box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); + box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2); z-index: 1; } @@ -149,7 +151,8 @@ nav{ } /* Add a dark background on topnav links and the dropdown button on hover */ -.topnav a:hover, .dropdown:hover .dropbtn { +.topnav a:hover, +.dropdown:hover .dropbtn { background-color: #555; color: white; } @@ -165,21 +168,32 @@ nav{ display: block; } -main -{ +main { background-color: #eeeeee; } +.topnav.responsive .dropdown-content { + position: relative; + display: flex; + flex-direction: column; + max-height: 0; +} + +.dropbtn:hover + .dropdown-content { + max-height: unset; +} + /* Medium screens */ @media all and (max-width: 600px) { + /******* header *******/ #header { /* When on medium sized screens, we center it by evenly distributing empty space around items */ flex-flow: column wrap; } - #header .flex-item{ + #header .flex-item { padding: 2px; margin: 2px; line-height: 25px; @@ -195,12 +209,14 @@ main /* Small screens */ @media all and (max-width: 500px) { + /******* header *******/ #header { /* On small screens, we are no longer using row direction but column */ flex-flow: column wrap; } - #header .flex-item{ + + #header .flex-item { padding: 2px; margin: 2px; line-height: 25px; @@ -210,40 +226,49 @@ main /******* navigation *******/ /* When the screen is less than 600 pixels wide, hide all links, except for the first one ("Home"). Show the link that contains should open and close the topnav (.icon) */ - .topnav a:not(:first-child), .dropdown .dropbtn { + .topnav a:not(:first-child), + .dropdown .dropbtn { display: none; } + .topnav a.icon { float: right; display: block; } - .container_menu{ + .container_menu { display: flex; flex-flow: row; } /* The "responsive" class is added to the topnav with JavaScript when the user clicks on the icon. This class makes the topnav look good on small screens (display the links vertically instead of horizontally) */ - .topnav.responsive {position: relative;} + .topnav.responsive { + position: relative; + } + .topnav.responsive a.icon { position: absolute; right: 0; top: 0; } + .topnav.responsive a { float: none; display: block; text-align: left; } - .topnav.responsive .dropdown {float: none;} - .topnav.responsive .dropdown-content {position: relative;} + + .topnav.responsive .dropdown { + float: none; + } + .topnav.responsive .dropdown .dropbtn { display: block; width: 100%; text-align: left; } - .responsive{ + .responsive { display: flex; flex-flow: column; }