I'm trying to make this simple website and right now I'm working on the navbar. In the navbar I also have this logo that I created with font awesome and text, it also has a bigger font size than the other elements in the navbar. My problem is that the logo text isn't aligning with all the other text in the navbar.
* {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
font-size: 16px
}
body {
background-color: RGB(40, 43, 48);
margin: 0;
padding: 0;
}
nav {
background-color: RGB(30, 33, 36);
text-align: center;
justify-content: center;
justify-items: center;
}
.main-nav {
display: flex;
list-style: none;
padding: 0;
margin: 0;
}
.main-nav li {
padding: 10px;
}
.main-nav li a {
color: white;
text-decoration: none;
font-weight: bold;
}
.push {
margin-left: auto;
}
.nav-logo {
font-size: 20px;
display: inline-block;
position: relative;
color: white;
}
.nav-logo:after {
content: '';
position: absolute;
width: 100%;
transform: scaleX(0);
height: 2px;
top: 24px;
bottom: 0;
left: 0;
background-color: white;
transform-origin: center;
transition: transform 0.25s ease-out;
}
.nav-logo:hover:after {
transform: scaleX(1);
transform-origin: center;
}
nav-content {}
<script src="https://kit.fontawesome.com/df395811d0.js" crossorigin="anonymous"></script>
<nav>
<ul class="main-nav">
<li>
<i class="fa-solid fa-greater-than fa-18px"></i> Terminalize
</li>
<li> HTML </li>
<li> CSS </li>
<li> JavaScript </li>
<li> Python </li>
<li> Windows </li>
<li> Linux </li>
<li> MacOS </li>
<li class="nav-content push "> About </li>
</ul>
</nav>
What my navbar looks like
you just had to set align-items: center on your main-nav class, as shown below:
* {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
font-size: 16px
}
body {
background-color: RGB(40, 43, 48);
margin: 0;
padding: 0;
}
nav {
background-color: RGB(30, 33, 36);
text-align: center;
justify-content: center;
justify-items: center;
}
.main-nav {
display: flex;
align-items: center;
list-style: none;
padding: 0;
margin: 0;
}
.main-nav li {
padding: 10px;
}
.main-nav li a {
color: white;
text-decoration: none;
font-weight: bold;
}
.push {
margin-left: auto;
}
.nav-logo {
font-size: 20px;
display: inline-block;
position: relative;
color: white;
}
.nav-logo:after {
content: '';
position: absolute;
width: 100%;
transform: scaleX(0);
height: 2px;
top: 24px;
bottom: 0;
left: 0;
background-color: white;
transform-origin: center;
transition: transform 0.25s ease-out;
}
.nav-logo:hover:after {
transform: scaleX(1);
transform-origin: center;
}
nav-content {}
<script src="https://kit.fontawesome.com/df395811d0.js" crossorigin="anonymous"></script>
<nav>
<ul class="main-nav">
<li>
<i class="fa-solid fa-greater-than fa-18px"></i> Terminalize
</li>
<li> HTML </li>
<li> CSS </li>
<li> JavaScript </li>
<li> Python </li>
<li> Windows </li>
<li> Linux </li>
<li> MacOS </li>
<li class="nav-content push "> About </li>
</ul>
</nav>
Related
I'm currently having some issues with this navbar. The pc version works great, though mobile version seems to size the width of the menu a bit too big making all the items in the nav not center properly.
In the picture above, you can see the mobile view. We can identify that the menu is not centered by looking at the border radius on the bottom. I've also dotted the first nav item with the same dimensions on both sides.
Here's a jsfiddle if you'd like to try it yourself:
const hamburger = document.querySelector(".hamburger");
const navMenu = document.querySelector(".nav-menu");
hamburger.addEventListener("click", mobileMenu);
function mobileMenu() {
hamburger.classList.toggle("active");
navMenu.classList.toggle("active");
}
const navLink = document.querySelectorAll(".nav-link");
navLink.forEach(n => n.addEventListener("click", closeMenu));
function closeMenu() {
hamburger.classList.remove("active");
navMenu.classList.remove("active");
}
#import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght#0,500;1,400&display=swap');
.navbar {
margin: 0;
padding: 0;
box-sizing: border-box;
}
.navbar html {
font-size: 62.5%;
font-family: 'Roboto', sans-serif;
}
.navbar li {
list-style: none;
}
.navbar a {
text-decoration: none;
}
.navbar {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1rem 1.5rem;
background-color: #353535;
}
.hamburger {
display: none;
}
.bar {
display: block;
width: 25px;
height: 3px;
margin: 5px auto;
-webkit-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
background-color: #fff;
}
.nav-menu {
display: flex;
justify-content: space-between;
align-items: center;
}
.nav-item {
margin-left: 3rem;
}
.nav-link {
font-size: 1.6rem;
font-weight: 400;
color: #7ef284;
}
.nav-link:hover {
color: #6dd573;
}
.nav-logo {
font-size: 2.1rem;
font-weight: 500;
color: #7ef284;
}
#media only screen and (max-width: 768px) {
.nav-menu {
position: fixed;
left: -200%;
top: 3rem;
flex-direction: column;
background-color: #353535;
width: 100%;
text-align: center;
transition: 0.3s;
box-shadow: 0 10px 27px rgba(0, 0, 0, 0.05);
border-radius: 0 0 15px 15px;
}
.nav-menu.active {
left: 0;
}
.nav-item {
margin: 2.5rem 0;
}
.hamburger {
display: block;
cursor: pointer;
}
.hamburger.active .bar:nth-child(2) {
opacity: 0;
}
.hamburger.active .bar:nth-child(1) {
transform: translateY(8px) rotate(45deg);
}
.hamburger.active .bar:nth-child(3) {
transform: translateY(-8px) rotate(-45deg);
}
}
<header class="header">
<nav class="navbar">
Demo
<ul class="nav-menu">
<li class="nav-item">
Home page
</li>
<li class="nav-item">
Info
</li>
<li class="nav-item">
Privacy Policy
</li>
<li class="nav-item">
Contact
</li>
</ul>
<div class="hamburger">
<span class="bar"></span>
<span class="bar"></span>
<span class="bar"></span>
</div>
</nav>
</header>
Thanks to #CBroe, I got it working by setting padding-left to 0.
I have been asked to make horizontal navbar with a horizontal submenu as well. This behaves differently than the typical navbar, and the main issue I cannot solve is when I hover an item in the nav, it underlines and displays the submenu correctly. When I move the cursor to the submenu though, the underline disappears. I cannot figure out how to keep it underlined while mousing about the submenu.
HTML:
<!-- Beginning of Header -->
<div class='menu-container'>
<div class='menu'>
<div class='logo'>
<img
src="/images/logo.svg"
alt="Pershing's Own"
height="100"
width="150" />
</div>
<div class='calendar'>Calendar</div>
<div class='feedback'>Give Feedback</div>
<div class='tickets'><a class='red-button' href='https://www.eventbrite.com/o/the-us-army-band-pershings-own-2494510190'>Tickets</a></div>
</div>
</div>
<div class='header-container'>
<nav class='nav-container' role='navigation'>
<ul class='nav-menu'>
<li class='dropdown' tabindex='-1'>
Concerts & Events
<ul class='red-submenu'> <!-- Start of submenu -->
<li><a href='/event-page/event-page.html'>Concerts</a></li>
<li><a href='#'>Special Events</a></li>
<li><a href='#'>Twilight Tattoo</a></li>
<li><a href='#'>Workshops</a></li>
</ul> <!-- End of submenu -->
</li>
<li class='dropdown' tabindex='-1'>
Vacancies
<ul class='red-submenu'> <!-- Start of submenu -->
<li><a href='#'>Current Openings</a></li>
<li><a href='#'>Conducting</a></li>
<li><a href='#'>Other Army Opportunities</a></li>
</ul>
</li>
<li class='dropdown' tabindex='-1'>
Watch & Listen
<ul class='red-submenu'> <!-- Start of submenu -->
<li><a href='#'>Live Webcasts</a></li>
<li><a href='#'>YouTube Channel</a></li>
<li><a href='#'>Recordings</a></li>
</ul>
</li>
<li class='dropdown' tabindex='-1'>
Meet the Band
<ul class='red-submenu'> <!-- Start of submenu -->
<li><a href='/meet-the-band/soldiers.html'>Musicians</a></li>
<li><a href='/meet-the-band/ensembles.html'>Ensembles</a></li>
<li><a href='#'>Support Staff</a></li>
<li><a href='#'>Command Staff</a></li>
</ul>
</li>
<li class='dropdown' tabindex='-1'>
Engagement
<ul class='red-submenu'>
<li><a href='#'>Workshops</a></li>
<li><a href='#'>Competitions</a></li>
<li><a href='#'>Educational Outreach</a></li>
</ul>
</li>
</ul>
</nav>
</div>
<!-- End of Header -->
CSS:
body {
width: 1200px;
margin: 0 auto;
}
.nav-container {
color: #0C275B;
display: flex;
font-weight: 700;
justify-content: center;
}
nav {
width: 100%;
height: 75px;
display: flex;
justify-content: space-between;
align-items: center;
}
.nav-menu {
display: flex;
align-self: flex-end;
margin-bottom: 0px;
padding-left: 180px;
justify-content: space-evenly;
text-transform: uppercase;
font-size: 0.9em;
width: inherit;
}
.nav-menu a:link {
text-decoration: none;
color: #0C275B;
}
.nav-menu a:visited {
text-decoration: none;
color: #0C275B;
}
.nav-menu li {
display: inline;
padding-left: 0;
}
.nav-menu:focus {
pointer-events:none;
}
.dropdown a {
text-decoration: none;
font-size: 1em;
position: relative;
transition: all 0.6s;
}
.dropdown a:after {
content: '';
width: 0;
height: 0.3em;
position: absolute;
bottom: -5px;
left: 50%;
background: #0C275B;
transition: all 0.5s;
}
.dropdown a:hover:after {
width: 100%;
left: 0;
background: #C31F3C;
}
.red-submenu {
padding-left: 25%;
visibility: hidden;
opacity: 0;
position: absolute;
transition: all 0.5s ease;
border-top: solid white 0.5rem;
left: 0;
text-transform: none;
}
.red-submenu li {
padding-left: 80px;
}
.dropdown:active .red-submenu,
.dropdown:focus .red-submenu,
.dropdown:hover > .red-submenu,
.red-submenu:hover {
visibility: visible;
opacity: 1;
background-color: #C31F3C;
display: block;
width: 100%;
}
ul li ul li {
clear: both;
width: 100%;
}
.red-submenu a:link {
text-decoration: none;
color: #FFF;
}
.red-submenu a:visited {
text-decoration: none;
color: #FFF;
}
.red-submenu li a:hover:after {
width: 0%;
background: #C31F3C;
}
body {
font-family: 'Raleway', sans-serif;
font-size: 18px;
font-style: normal;
font-weight: 300;
line-height: 1.8em;
color: #0C275B;
}
.menu-container {
color: #0C275B;
padding: 20px 0;
display: flex;
justify-content: center;
height: 60px;
}
.menu {
width: 100%;
display: flex;
justify-content: space-between;
font-size: 0.9em;
font-weight: 700;
}
.calendar {
margin-left: auto;
}
.feedback,
.tickets {
margin-left: 20px;
}
.tickets {
padding-right: 20px;
}
a.red-button {
color: #FFF;
background-color: #C31F3C;
font-family: 'Raleway', sans-serif;
font-weight: 700;
padding: 5px 10px 5px 10px;
height: 2.1em;
text-align: center;
border-radius: 10px;
text-decoration: none;
}
.logo {
width: 150px;
display: flex;
padding-left: 20px;
justify-content: flex-start;
}
I created a codepen here.
Menu has no JS - only HTML and CSS. If JS would solve this, that would be fine, but if there's a way to do it with just HTML and CSS, that would be preferable.
You should put the :hover on the li.dropdown element. So replace .dropdown a:hover:after with .dropdown:hover > a::after.
// Before
.dropdown a:hover:after {
width: 100%;
left: 0;
background: #C31F3C;
}
// After
.dropdown:hover > a::after {
width: 100%;
left: 0;
background: #C31F3C;
}
body {
width: 1200px;
margin: 0 auto;
}
.nav-container {
color: #0C275B;
display: flex;
font-weight: 700;
justify-content: center;
}
nav {
width: 100%;
height: 75px;
display: flex;
justify-content: space-between;
align-items: center;
}
.nav-menu {
display: flex;
align-self: flex-end;
margin-bottom: 0px;
padding-left: 180px;
justify-content: space-evenly;
text-transform: uppercase;
font-size: 0.9em;
width: inherit;
}
.nav-menu a:link {
text-decoration: none;
color: #0C275B;
}
.nav-menu a:visited {
text-decoration: none;
color: #0C275B;
}
.nav-menu li {
display: inline;
padding-left: 0;
}
.nav-menu:focus {
pointer-events:none;
}
.dropdown a {
text-decoration: none;
font-size: 1em;
position: relative;
transition: all 0.6s;
}
.dropdown a:after {
content: '';
width: 0;
height: 0.3em;
position: absolute;
bottom: -5px;
left: 50%;
background: #0C275B;
transition: all 0.5s;
}
.dropdown:hover > a::after {
width: 100%;
left: 0;
background: #C31F3C;
}
.red-submenu {
padding-left: 25%;
visibility: hidden;
opacity: 0;
position: absolute;
transition: all 0.5s ease;
border-top: solid white 0.5rem;
left: 0;
text-transform: none;
}
.red-submenu li {
padding-left: 80px;
}
.dropdown:active .red-submenu,
.dropdown:focus .red-submenu,
.dropdown:hover > .red-submenu,
.red-submenu:hover {
visibility: visible;
opacity: 1;
background-color: #C31F3C;
display: block;
width: 100%;
}
ul li ul li {
clear: both;
width: 100%;
}
.red-submenu a:link {
text-decoration: none;
color: #FFF;
}
.red-submenu a:visited {
text-decoration: none;
color: #FFF;
}
.red-submenu li a:hover:after {
width: 0%;
background: #C31F3C;
}
body {
font-family: 'Raleway', sans-serif;
font-size: 18px;
font-style: normal;
font-weight: 300;
line-height: 1.8em;
color: #0C275B;
}
.menu-container {
color: #0C275B;
padding: 20px 0;
display: flex;
justify-content: center;
height: 60px;
}
.menu {
width: 100%;
display: flex;
justify-content: space-between;
font-size: 0.9em;
font-weight: 700;
}
.calendar {
margin-left: auto;
}
.feedback,
.tickets {
margin-left: 20px;
}
.tickets {
padding-right: 20px;
}
a.red-button {
color: #FFF;
background-color: #C31F3C;
font-family: 'Raleway', sans-serif;
font-weight: 700;
padding: 5px 10px 5px 10px;
height: 2.1em;
text-align: center;
border-radius: 10px;
text-decoration: none;
}
.logo {
width: 150px;
display: flex;
padding-left: 20px;
justify-content: flex-start;
}
<!-- Beginning of Header -->
<div class='menu-container'>
<div class='menu'>
<div class='logo'>
<img
src="/images/logo.svg"
alt="Pershing's Own"
height="100"
width="150" />
</div>
<div class='calendar'>Calendar</div>
<div class='feedback'>Give Feedback</div>
<div class='tickets'><a class='red-button' href='https://www.eventbrite.com/o/the-us-army-band-pershings-own-2494510190'>Tickets</a></div>
</div>
</div>
<div class='header-container'>
<nav class='nav-container' role='navigation'>
<ul class='nav-menu'>
<li class='dropdown' tabindex='-1'>
Concerts & Events
<ul class='red-submenu'> <!-- Start of submenu -->
<li><a href='/event-page/event-page.html'>Concerts</a></li>
<li><a href='#'>Special Events</a></li>
<li><a href='#'>Twilight Tattoo</a></li>
<li><a href='#'>Workshops</a></li>
</ul> <!-- End of submenu -->
</li>
<li class='dropdown' tabindex='-1'>
Vacancies
<ul class='red-submenu'> <!-- Start of submenu -->
<li><a href='#'>Current Openings</a></li>
<li><a href='#'>Conducting</a></li>
<li><a href='#'>Other Army Opportunities</a></li>
</ul>
</li>
<li class='dropdown' tabindex='-1'>
Watch & Listen
<ul class='red-submenu'> <!-- Start of submenu -->
<li><a href='#'>Live Webcasts</a></li>
<li><a href='#'>YouTube Channel</a></li>
<li><a href='#'>Recordings</a></li>
</ul>
</li>
<li class='dropdown' tabindex='-1'>
Meet the Band
<ul class='red-submenu'> <!-- Start of submenu -->
<li><a href='/meet-the-band/soldiers.html'>Musicians</a></li>
<li><a href='/meet-the-band/ensembles.html'>Ensembles</a></li>
<li><a href='#'>Support Staff</a></li>
<li><a href='#'>Command Staff</a></li>
</ul>
</li>
<li class='dropdown' tabindex='-1'>
Engagement
<ul class='red-submenu'>
<li><a href='#'>Workshops</a></li>
<li><a href='#'>Competitions</a></li>
<li><a href='#'>Educational Outreach</a></li>
</ul>
</li>
</ul>
</nav>
</div>
<!-- End of Header -->
<!-- Begin main section -->
<div class='main-container'>
</div>
So I am trying to create a webpage which has a sticky Navbar and Parallax Effect. It has 2 sections: first is the picture and under is some text. The navbar is only visible in the text sections.
Unfortunately, the navbar is, like, getting under the picture and then pops out when I scroll down to the text section. Would be grateful if someone could help me with this problem (first time making a webpage)!
body {
height: 100%;
overflow: auto;
margin: 0;
padding: 0;
line-height: 1.5;
background-color: white;
font-family: "Trebuchet MS", Helvetica, sans-serif;
}
.container {
width: 80%;
margin: 0 auto;
}
header {
position: fixed;
background: #f4f4f4;
width: 100%;
height: 15%;
/* padding: 0px 30px;*/
box-sizing: border-box;
}
.name {
float: left;
width: 180px;
padding-right: 150px;
}
nav {
width: 100%;
height: 50px;
top: 0;
padding: 15px 0px;
color: black;
text-decoration: none;
}
nav ul {
list-style-type: none;
margin: 0;
padding: 0;
}
nav li {
display: inline-block;
margin-left: 10px;
margin-top: 0px;
position: relative;
padding: 20px;
}
nav ul li a {
color: black;
text-decoration: none;
text-transform: uppercase;
font-family: "Trebuchet MS", Helvetica, sans-serif;
transition: .4s;
}
<header>
<nav>
<div class="container">
<div class="name">
<img src="logoimg.png> </img>
</div>
<ul>
<li> Home </li>
<li> Who we are </li>
<li> What we do </li>
<li> Our projects </li>
<li> Contact us </li>
</ul>
</nav>
</header>
Add z-index to the CSS for nav:
nav {
width: 100%;
height:50px;
top: 0;
padding:15px 0px;
color: black;
text-decoration: none;
z-index: 20
}
This question already has answers here:
How to display two elements on the same line?
(2 answers)
Closed 5 years ago.
Now I'm making a single page app and I want the navbar to be at the top of the page and the next div "map" that is used to display Google Map will fit in all the page.
When I set the container to display: flex the map appear but navbar get wrapped to the left.
Page when I set container display to flex:
Page WITHOUT setting container display to flex:
What should I do? Here is my HTML code and CSS:
/*
DEMO STYLE
*/
#import "https://fonts.googleapis.com/css?family=Poppins:300,400,500,600,700";
html {
box-sizing: border-box;
}
body {
font-family: 'Poppins', sans-serif;
background: #fafafa;
}
p {
font-family: 'Poppins', sans-serif;
font-size: 1.1em;
font-weight: 300;
line-height: 1.7em;
color: #999;
}
a,
a:hover,
a:focus {
color: inherit;
text-decoration: none;
transition: all 0.3s;
}
.navbar {
padding: 15px 10px;
background: #fff;
border: none;
border-radius: 0;
margin-bottom: 40px;
box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);
display: flex;
align-items: center;
flex: 1;
}
.navbar-btn {
box-shadow: none;
outline: none !important;
border: none;
}
.navbar-header {
height: 30%;
}
.line {
width: 100%;
height: 1px;
border-bottom: 1px dashed #ddd;
margin: 40px 0;
}
/* ---------------------------------------------------
SIDEBAR STYLE
----------------------------------------------------- */
#sidebar {
width: 250px;
position: fixed;
top: 0;
left: -250px;
height: 100vh;
z-index: 999;
background: #7386D5;
color: #fff;
transition: all 0.3s;
overflow-y: scroll;
box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.2);
}
#sidebar.active {
left: 0;
}
#dismiss {
width: 35px;
height: 35px;
line-height: 35px;
text-align: center;
background: #7386D5;
position: absolute;
top: 10px;
right: 10px;
cursor: pointer;
-webkit-transition: all 0.3s;
-o-transition: all 0.3s;
transition: all 0.3s;
}
#dismiss:hover {
background: #fff;
color: #7386D5;
}
.overlay {
position: fixed;
width: 100vw;
height: 100vh;
background: rgba(0, 0, 0, 0.7);
z-index: 998;
display: none;
}
#sidebar .sidebar-header {
padding: 20px;
background: #6d7fcc;
}
#sidebar ul.components {
padding: 20px 0;
border-bottom: 1px solid #47748b;
}
#sidebar ul p {
color: #fff;
padding: 10px;
}
#sidebar ul li a {
padding: 10px;
font-size: 1.1em;
display: block;
}
#sidebar ul li a:hover {
color: #7386D5;
background: #fff;
}
#sidebar ul li.active>a,
a[aria-expanded="true"] {
color: #fff;
background: #6d7fcc;
}
a[data-toggle="collapse"] {
position: relative;
}
a[aria-expanded="false"]::before,
a[aria-expanded="true"]::before {
content: '\e259';
display: block;
position: absolute;
right: 20px;
font-family: 'Glyphicons Halflings';
font-size: 0.6em;
}
a[aria-expanded="true"]::before {
content: '\e260';
}
ul ul a {
font-size: 0.9em !important;
padding-left: 30px !important;
background: #6d7fcc;
}
ul.CTAs {
padding: 20px;
}
ul.CTAs a {
text-align: center;
font-size: 0.9em !important;
display: block;
border-radius: 5px;
margin-bottom: 5px;
}
a.download {
background: #fff;
color: #7386D5;
}
a.article,
a.article:hover {
background: #6d7fcc !important;
color: #fff !important;
}
/* ---------------------------------------------------
CONTENT STYLE
----------------------------------------------------- */
#content {
width: 100%;
padding: 0;
min-height: 100vh;
transition: all 0.3s;
position: absolute;
top: 0;
right: 0;
display: flex
}
#map {
width: 100%;
flex: 2;
}
<div class="wrapper">
<!-- Sidebar Holder -->
<nav id="sidebar">
<div id="dismiss">
<i class="glyphicon glyphicon-arrow-left"></i>
</div>
<div class="sidebar-header">
<h3>Bootstrap Sidebar</h3>
</div>
<ul class="list-unstyled components">
<p>Dummy Heading</p>
<li class="active">
Home
<ul class="collapse list-unstyled" id="homeSubmenu">
<li>
Home 1
</li>
<li>
Home 2
</li>
<li>
Home 3
</li>
</ul>
</li>
<li>
About
Pages
<ul class="collapse list-unstyled" id="pageSubmenu">
<li>
Page 1
</li>
<li>
Page 2
</li>
<li>
Page 3
</li>
</ul>
</li>
<li>
Portfolio
</li>
<li>
Contact
</li>
</ul>
<ul class="list-unstyled CTAs">
<li>
Download source
</li>
<li>
Back to article
</li>
</ul>
</nav>
<!-- Page Content Holder -->
<div id="content">
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" id="sidebarCollapse" class="btn btn-info navbar-btn">
<i class="glyphicon glyphicon-align-left"></i>
<span>Open Sidebar</span>
</button>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li>
Page
</li>
<li>
Page
</li>
<li>
Page
</li>
<li>
Page
</li>
</ul>
</div>
</div>
</nav>
<div id="map"></div>
</div>
</div>
<div class="overlay"></div>
Your nav is wrapped inside div class="content" together with div class="map". The browser will try to fit nav and map next to each other since they're part of the same flex-container. Moving your nav out of the div class="content" should do your bidding.
Try to add these properties to your .navbar
.navbar{
position: fixed;
top: 0;
left: 0;
right:0
}
How to make properly such navigation bar, especially this two intersecting lines. I know that I can use transform: skewX(10deg); for rotating this vertical line, but not sure am I ok with whole html&css
HTML:
<main>
<div class="rounded-rectangle">
<ul class="top">
<li>
<button>text</button>
</li>
<li>
<button>text</button>
</li>
</ul>
<ul class="bottom">
<li>
<button>text</button>
</li>
<li>
<button>text</button>
</li>
</ul>
</div>
</main>
Fiddle
You could use pseudo elements of the container to draw the intersecting lines.
html,
body {
height: 100%;
}
body {
display: flex;
flex-direction: row;
font-family: 'Raleway', sans-serif;
background-color: #e24d3d;
}
main {
flex-grow: 1;
}
ul li {
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
list-style: none;
text-transform: uppercase;
font-size: 30px;
}
button {
background-color: transparent;
border: none;
color: white;
padding: 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 2.5em;
font-family: 'Raleway', sans-serif;
text-transform: uppercase;
}
button:focus {
outline: -webkit-focus-ring-color auto 0px;
}
ul.top {
display: flex;
justify-content: space-around;
height: 50%;
}
ul.top div:nth-last-child(1) {
border-right: 1px solid #FFF;
}
ul.bottom {
display: flex;
justify-content: space-around;
height: 50%;
}
.rounded-rectangle {
background-color: rgba(128, 213, 226, 0.4);
height: 320px;
max-width: 520px;
border-radius: 10px;
margin: auto;
position: relative;
}
.rounded-rectangle:before, .rounded-rectangle:after {
content: '';
position: absolute;
background: #fff;
}
.rounded-rectangle:before {
top: 50%;
height: 1px;
left: 0; right: 0;
}
.rounded-rectangle:after {
left: 50%;
width: 1px;
top: 0; bottom: 0;
transform: rotate(10deg);
}
ul {
padding: 0;
margin: 0;
}
<main>
<div class="rounded-rectangle">
<ul class="top">
<li>
<button>text</button>
</li>
<li>
<button>text</button>
</li>
</ul>
<ul class="bottom">
<li>
<button>text</button>
</li>
<li>
<button>text</button>
</li>
</ul>
</div>
</main>