Dropdown menu responsive with flexbox and css - html
I am a fresh newcomer and I have been studying and practising flexbox and CSS, just now I was trying to move my float elements into flexbox, but for a reason, I don't know my menu is broken I see the drop-down menu items upper the hamburger button, I would be happy if someone could explain what I am doing bad, thank you in advance. Here is the code:
.header {
background-color: #fff;
position: fixed;
text-align: center;
height: 50px;
width: 100%;
max-width: 480px;
box-shadow: 1px 1px 4px 0 rgba(0, 0, 0, .1);
z-index: 3;
display: flex;
flex-direction: row-reverse;
flex-wrap: nowrap;
justify-content: space-between;
align-items: center;
}
.header ul {
margin: 0;
padding: 0;
list-style: none;
overflow: hidden;
background-color: #fff;
display: flex;
flex-direction: column;
flex: 1;
}
.header .logo {
/*float: right; */
display: block;
font-size: 1em;
padding: 20px 20px;
color: #000;
display: inline-block;
}
.header .logo img {
height: 12px;
width: 12px;
}
.header .mail {
/* float: right; */
display: block;
font-size: 1em;
padding: 20px 20px;
color: #000;
display: inline-block;
}
.header .mail img {
height: 15px;
width: 19px;
}
.header .menu-item {
font-size: 1em;
color: #000;
padding-top: 30px;
line-height: 2.5em;
}
.header .menu-sub-item {
font-size: 1em;
color: #c4c0bf;
line-height: 2.5em;
}
.header .menu {
clear: both;
max-height: 0;
transition: max-height .2s ease-out;
display: flex;
}
<header class="header">
<img src="" alt="">
<img src="" alt="">
<input class="menu-btn" type="checkbox" id="menu-btn">
<label class="menu-icon" for="menu-btn"><span class="nav-icon"></span></label>
<ul class="menu">
<li class="menu-item"><span></span></li>
<li class="menu-sub-item">
</li>
<hr>
<li class="menu-item"><span></span></li>
<li class="menu-sub-item">
</li>
<li class="menu-sub-item">
</li>
<li class="menu-sub-item">
</li>
<li class="menu-sub-item">
</li>
<hr>
<li class="menu-item"><span></span></li>
<li class="menu-sub-item">
</li>
<li class="menu-sub-item">
</li>
<li class="menu-sub-item">
</li>
</ul>
</header>
[as you see, the menu has reduced his size and the drop down went up after moving all elements into flexbox, before the menu cover his width and drop down cover all the background]
Related
Change menu icon when hovering over its container
I am trying to build a nav bar. So here is the thing. What I want to do is to change both the color of menu icon and the word "menu" when hovering over their container. I use background color to build this icon, so I cannot simply change background color to change the icon. Otherwise, the background of the whole container would be blue. .nav-item{ display: inline-block; vertical-align: middle; height: 60px; margin: 5px; } #primary-logo{ height: 50px; } .navbar{ border-top: 1px solid gray; border-bottom: 1px solid gray; } .nav-list{ list-style-type: none; padding-left: 0px; display: flex; align-items: center; padding-bottom: 5px; gap: 24px; } .menu-line{ width: 34px; height:5px; background-color: black; margin: 6px 0px; } .menu-item{ display: inline-block; vertical-align: middle; } .menu-sec:hover{ color: rgb(39, 42, 202); cursor: pointer; } .menu-line:hover{ width: 34px; height:5px; background-color: rgb(39, 42, 202); margin: 6px 0px; } <nav> <div class="nav-item"> <img id="primary-logo" src="800px-The_Economist_Logo.svg.png" alt="Economist Logo" /> </div> <div class="navbar nav-item"> <ul class="nav-list"> <li class="menu-sec"> <div class="menu-item"> <!-- menu icon --> <div class="menu-line"></div> <div class="menu-line"></div> <div class="menu-line"></div> </div> <div class="menu-item">Menu</div> </li> <li>Weekly edition</li> <li>Search</li> </ul> </div> </nav>
You can do it as below. I added this line .menu-sec:hover .menu-line {background-color: rgb(39, 42, 202)}. I also removed some duplicated lines. .nav-item { display: inline-block; vertical-align: middle; height: 60px; margin: 5px; } #primary-logo { height: 50px; } .navbar { border-top: 1px solid gray; border-bottom: 1px solid gray; } .nav-list { list-style-type: none; padding-left: 0px; display: flex; align-items: center; padding-bottom: 5px; gap: 24px; } .menu-line { width: 34px; height: 5px; background-color: black; margin: 6px 0px; } .menu-item { display: inline-block; vertical-align: middle; } .menu-sec:hover { color: rgb(39, 42, 202); cursor: pointer; } .menu-sec:hover .menu-line { background-color: rgb(39, 42, 202); } <nav> <div class="nav-item"> <img id="primary-logo" src="800px-The_Economist_Logo.svg.png" alt="Economist Logo" /> </div> <div class="navbar nav-item"> <ul class="nav-list"> <li class="menu-sec"> <div class="menu-item"> <!-- menu icon --> <div class="menu-line"></div> <div class="menu-line"></div> <div class="menu-line"></div> </div> <div class="menu-item">Menu</div> </li> <li>Weekly edition</li> <li>Search</li> </ul> </div> </nav>
Removing line breaks in navbar
I am creating a navbar with a logo on the left side on the navbar and the links on the right side of the navbar. Although I have been successful, there are some unwanted line breaks in the text on the right side of the navbar. How do I get rid of the line breaks in the texts "How it works" and "Available Products"? I am not using Bootstrap and I do not want to use it. * { padding: 0; margin: 0; font-family: "Roboto", sans-serif; } ul { list-style-type: none; overflow: hidden; } li { float: left; } .container { align-items: center; justify-content: center; display: flex; } img { max-width: 100%; width: 72.5%; height: auto; } .logo { flex-basis: 75%; margin-top: 10px; margin-left: 10px; } .nav-link { display: block; text-align: center; text-decoration: none; font-size: 20px; padding-right: 20px; } <header id="header"> <nav id="nav-bar"> <div> <ul> <div class="container"> <div class="logo"> <li> <img id="header-img" src="https://i.ibb.co/5Mcnrcm/N-logo.png" style="vertical-align: middle" /> </li> </div> <li><a class="nav-link" href="#f">Features</a></li> <li><a class="nav-link" href="#h">How It Works</a></li> <li><a class="nav-link" href="#a">Available Products</a></li> </div> </ul> </div> </nav> </header>
It can be done by applying CSS white-space: nowrap; to e.g. .nav-link as shown below: * { padding: 0; margin: 0; font-family: "Roboto", sans-serif; } ul { list-style-type: none; overflow: hidden; } li { float: left; } .container { align-items: center; justify-content: center; display: flex; } img { max-width: 100%; width: 72.5%; height: auto; } .logo { flex-basis: 75%; margin-top: 10px; margin-left: 10px; } .nav-link { display: block; text-align: center; text-decoration: none; font-size: 20px; padding-right: 20px; white-space: nowrap; } <header id="header"> <nav id="nav-bar"> <div> <ul> <div class="container"> <div class="logo"> <li> <img id="header-img" src="https://i.ibb.co/5Mcnrcm/N-logo.png" style="vertical-align: middle" /> </li> </div> <li><a class="nav-link" href="#f">Features</a></li> <li><a class="nav-link" href="#h">How It Works</a></li> <li><a class="nav-link" href="#a">Available Products</a></li> </div> </ul> </div> </nav> </header>
How do I get the background colour to change upon hover in a div dropdown
I have been trying to make the colour fill the entire dropdown relative to the text you are hovering but it is not filling the whole div element, only the space around the word. I have created a Fiddle to show the issue that I am having. I'm a beginner in CSS and HTML. As you can see I have tried to add padding but it is not filling the div element as you hover it. THE HTML is provided below and also within the Fiddle header { display: flex; justify-content: space-evenly; align-items: center; padding-top: 1.0rem; } .sub-1 { display: none; } .sub-1 ul { display: flex; flex-direction: column; gap: 2rem; padding-right: 4rem; padding-left: 1rem; margin-left: -9.5rem; height: 27.5rem; font-size: 1.6rem; background-color: white; list-style: none; } .sneakers { margin-top: 2rem; } .sub-1 a:link, .sub-1 a:visited { color: black; text-decoration: none; } .sub-1 a:hover { padding: 10px; background-color: blue; } li:hover .sub-1 { display: block; position: absolute; margin-left: -2rem; box-shadow: 1px 1px 10px grey; } .search-txt { border: none; outline: none; padding-top: 1.0rem; padding-left: 1.0rem; font-size: 1.5rem; color: black; } .search-nav { display: flex; font-size: 1.6rem; list-style: none; gap: 2.0rem; margin-left: -7.0rem; margin-top: -0.5rem; caret-color: transparent; } <header class="header"> <body> <div class="navbar"> <ul class="search-nav"> <li><a class="main-nav-link" href="#browse">Browse</a> <div class="sub-1"> <ul class=""> <li class="sneakers">Sneakers </li> <li>Apparel</li> <li>Electronics</li> <li>Trading Cards</li> <li>Collectibles</li> <li>Accessories</li> <li>NFTs</li> </ul> </div> </li> <li><a class="main-nav-link" href="#news">News</a></li> <li><a class="main-nav-link" href="#help">About</a> </li> <li><a class="main-nav-link" href="#account">My Account</a></li> <li><a class="main-nav-link sell" href="#sell">Sell</a></li> </ul> </div> </header> Fiddle
if i understand correctly the wrapper div with the sub-1 class is unnecessary. If you remove that div and add that class to the ul below it <li><a class="main-nav-link" href="#browse">Browse</a> <ul class="sub-1"> <li class="sneakers">Sneakers </li> <li>Apparel</li> <li>Electronics</li> <li>Trading Cards</li> <li>Collectibles</li> <li>Accessories</li> <li>NFTs</li> </ul> Then in your css add a background-color li:hover > .sub-1{ display: block; position: absolute; margin-left: -2rem; box-shadow: 1px 1px 10px grey; background: red; } I hope this helps, cheers!
centralization of the block with the popup menu in the center relative to the parent menu item from the main sidebar
I have a sidebar, with sub menu items. And I need to build a block with a pop-up menu so that the pop-up menu block is in the center relative to the parent menu item located in the sidebar. Like on a picture. Help, pls. Thank. [![enter image description here][1]][1][1]: https://i.stack.imgur.com/oEtuh.png .main { font-family: PT Sans; position: relative; display: flex; flex-direction: row; min-height: 100%; } .main_menu { display: flex; flex-direction: column; width: auto; background-color: #38618C; padding: 50px 0 0 0; z-index: 1; user-select: none; } .main_menu_content { display: flex; flex-direction: column; position: sticky; top: 50px; width: 100%; } .main_menu_content_list { display: flex; flex-direction: column; justify-content: space-between; text-align: center; height: 700px; width: 250px; } .main_menu_content_list li { list-style-type: none; } .main_menu_content_list a { display: flex; flex-direction: column; align-items: center; justify-content: center; font-style: normal; font-weight: normal; font-size: 18px; line-height: 23px; color: #D7DFE8; text-decoration: none; } .content_list_submenu { justify-content: center; position: absolute; padding: 0; margin: 0; left: 100%; height: 100vh; background-color: #F0F6F8; box-shadow: 10px 0px 5px rgba(0, 0, 0, 0.25); top: -50px; pointer-events: none; opacity: 0; display: none; transition: all linear 0.1s 0s; width: 250px; } .main_menu_content_list_submenu_popup { display: flex; flex-direction: column; align-items: flex-start; } .main_menu_content_list > li.main_menu_content_list_arrow > a:after{ content: ''; position: absolute; border: solid 10px; border-color: transparent #F0F6F8 transparent transparent; right: 0; opacity: 0; } .main_menu_content_list > li.main_menu_content_list_arrow:hover > a:after{ opacity: 1; } .main_menu_content_list li:hover .content_list_submenu { opacity: 1; pointer-events: auto; display: flex; } .main_menu_content_list_submenu_popup li:first-child { margin: 50px 0 0 0; } .main_menu_content_list_submenu_popup li:not(:first-child) { margin: 10px 0 0 0; } .main_menu_content_list li:hover > .content_list_submenu { display: flex; } .main_menu_content_list_submenu_popup a { font-style: normal; font-weight: normal; font-size: 16px; line-height: 21px; color: #38618C; } .main_menu_content_list_submenu_popup a:hover { color: #38618C; text-decoration: underline; } .main_menu_content_list_submenu_popup a:active { color: #FF5964; } .main_content { display: flex; align-items: center; flex-direction: column; width: 100%; max-width: 100%; min-height: 100%; } <div class="main"> <div class="main_menu"> <div class="main_menu_content"> <ul class="main_menu_content_list"> <li class="main_menu_content_list_arrow"><a href=""> <div class="main_menu_content_list_int"></div>Интернет </a> <div class="content_list_submenu"> <ul class="main_menu_content_list_submenu_popup"> <li><a class="" href="">Подключение</a></li> <li>Дополнительные услуги</li> <li>Настройка соединения</li> <li>Подключенные дома</li> <li>Документы</li> </ul> </div> </li> <li class="main_menu_content_list_arrow"><a href=""> <div class="main_menu_content_list_tv"></div>Телевидение </a> <div class="content_list_submenu"> <ul class="main_menu_content_list_submenu_popup"> <li><a class="" href="">Подключение</a></li> <li>Новости</li> <li>Акции</li> <li>Аналоговое ТВ</li> <li>Оборудование</li> <li>Настройка каналов</li> <li>Подключенные дома</li> <li>Документы</li> </ul> </div> </li> <li class="main_menu_content_list_arrow"><a href="/content/video.html"> <div class="main_menu_content_list_video"></div>Видеонаблюдение,<br>домофон </a> <div class="content_list_submenu"> <ul class="main_menu_content_list_submenu_popup"> <li><a class="" href="">Подключение</a></li> <li>Обслуживание</li> <li>Установка</li> <li>Заявка на ремонт</li> </ul> </div> </li> <li><a href="/content/rek.html"> <div class="main_menu_content_list_tvr"></div>ТВ Реклама </a></li> <li><a href=""> <div class="main_menu_content_list_intb"></div>Интернет для бизнеса </a></li> <div class="main_menu_content_list_sub_block"> <li>Оплата</li> <li>О компании</li> </div> <li class="main_menu_content_list_arrow"><a href=""> <div class="main_menu_content_list_sub_account"></div>Личный кабинет </a> <div class="content_list_submenu"> <ul class="main_menu_content_list_submenu_popup"> <li>Интернет</li> <li>Телевидение</li> </ul> </div> </li> </ul> </div> </div> <div class="main_content"> </div> </div>
The gist of what you need to do is have an absolutely positioned child element and a relatively positioned parent and then use top positioning combined with a translate on the child to vertically center it to the parent. I put some comments in the code to explain some other adjustments you would need to make in order to get this effect. .main { font-family: PT Sans; position: relative; display: flex; flex-direction: row; min-height: 100%; } .main_menu { display: flex; flex-direction: column; width: auto; background-color: #38618C; padding: 50px 0 0 0; z-index: 1; user-select: none; } .main_menu_content { display: flex; flex-direction: column; position: sticky; top: 50px; width: 100%; } .main_menu_content_list { display: flex; flex-direction: column; justify-content: space-between; text-align: center; height: 700px; width: 250px; } .main_menu_content_list li { list-style-type: none; /*Make the parent item position relative*/ position: relative; } .main_menu_content_list a { display: flex; flex-direction: column; align-items: center; justify-content: center; font-style: normal; font-weight: normal; font-size: 18px; line-height: 23px; color: #D7DFE8; text-decoration: none; } .content_list_submenu { justify-content: center; position: absolute; padding: 0; margin: 0; left: 100%; /*Remove height height: 100vh;*/ background-color: #F0F6F8; box-shadow: 10px 0px 5px rgba(0, 0, 0, 0.25); /*Change top toi 50% with a counter active transform*/ top: 50%; transform: translateY(-50%); pointer-events: none; opacity: 0; display: none; transition: all linear 0.1s 0s; width: 250px; } .main_menu_content_list_submenu_popup { display: flex; flex-direction: column; align-items: flex-start; /*Add padding here instead of margin on the li*/ padding-top: 20px; padding-bottom: 20px; } .main_menu_content_list > li.main_menu_content_list_arrow > a:after{ content: ''; position: absolute; border: solid 10px; border-color: transparent #F0F6F8 transparent transparent; right: 0; opacity: 0; } .main_menu_content_list > li.main_menu_content_list_arrow:hover > a:after{ opacity: 1; } .main_menu_content_list li:hover .content_list_submenu { opacity: 1; pointer-events: auto; display: flex; } /* Remove this rule .main_menu_content_list_submenu_popup li:first-child { margin: 50px 0 0 0; } */ .main_menu_content_list_submenu_popup li:not(:first-child) { margin: 10px 0 0 0; } .main_menu_content_list li:hover > .content_list_submenu { display: flex; } .main_menu_content_list_submenu_popup a { font-style: normal; font-weight: normal; font-size: 16px; line-height: 21px; color: #38618C; } .main_menu_content_list_submenu_popup a:hover { color: #38618C; text-decoration: underline; } .main_menu_content_list_submenu_popup a:active { color: #FF5964; } .main_content { display: flex; align-items: center; flex-direction: column; width: 100%; max-width: 100%; min-height: 100%; } <div class="main"> <div class="main_menu"> <div class="main_menu_content"> <ul class="main_menu_content_list"> <li class="main_menu_content_list_arrow"><a href=""> <div class="main_menu_content_list_int"></div>Интернет </a> <div class="content_list_submenu"> <ul class="main_menu_content_list_submenu_popup"> <li><a class="" href="">Подключение</a></li> <li>Дополнительные услуги</li> <li>Настройка соединения</li> <li>Подключенные дома</li> <li>Документы</li> </ul> </div> </li> <li class="main_menu_content_list_arrow"><a href=""> <div class="main_menu_content_list_tv"></div>Телевидение </a> <div class="content_list_submenu"> <ul class="main_menu_content_list_submenu_popup"> <li><a class="" href="">Подключение</a></li> <li>Новости</li> <li>Акции</li> <li>Аналоговое ТВ</li> <li>Оборудование</li> <li>Настройка каналов</li> <li>Подключенные дома</li> <li>Документы</li> </ul> </div> </li> <li class="main_menu_content_list_arrow"><a href="/content/video.html"> <div class="main_menu_content_list_video"></div>Видеонаблюдение,<br>домофон </a> <div class="content_list_submenu"> <ul class="main_menu_content_list_submenu_popup"> <li><a class="" href="">Подключение</a></li> <li>Обслуживание</li> <li>Установка</li> <li>Заявка на ремонт</li> </ul> </div> </li> <li><a href="/content/rek.html"> <div class="main_menu_content_list_tvr"></div>ТВ Реклама </a></li> <li><a href=""> <div class="main_menu_content_list_intb"></div>Интернет для бизнеса </a></li> <div class="main_menu_content_list_sub_block"> <li>Оплата</li> <li>О компании</li> </div> <li class="main_menu_content_list_arrow"><a href=""> <div class="main_menu_content_list_sub_account"></div>Личный кабинет </a> <div class="content_list_submenu"> <ul class="main_menu_content_list_submenu_popup"> <li>Интернет</li> <li>Телевидение</li> </ul> </div> </li> </ul> </div> </div> <div class="main_content"> </div> </div>
Add links on right of footer
I have these 3 links on the left side of footer, on the left side of the logo. I would like to add another 3 that are on the right side of the logo. But kinda float right and will always be 100px or so from the right side of web browser. Here is my fiddle: For the css I tried basically copying and pasting the list and getting it to float right but couldn't get it working right. footer { background-color: #30659B; height: 135px; width: 100% } .logo2 { width: 150px; fill: white; display: block; position: relative; margin: 0 auto; padding-top: 27px; } .nav2 { list-style-type: none; overflow: hidden; position: absolute; display: table; text-align: center; margin-top: -22px; padding: 0; } .li2 { display: inline-block; padding: 0; font-family: proxima nova; font-size: 10px; text-decoration: none; } .li2 a { display: block; text-decoration: none; text-align: center; color: white; /* margin: 32px 20px 0px 20px; */ margin-left: 100px; } <footer> <div class="logo2"> <svg class="logo2" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 268 50"><title>Artboard 1</title><path d="M46.26,10.5h6.46V35.17H65.55v5.69H46.26Z"/><path d="M82.8,38.59a9.1,9.1,0,0,1-7,2.82c-3.5,0-7.65-2.37-7.65-7.28,0-5.14,4.14-7,7.65-7,2.91,0,5.51.91,7,2.69v-3c0-2.23-1.91-3.69-4.82-3.69a9.25,9.25,0,0,0-6.42,2.59l-2.18-3.87A14.42,14.42,0,0,1,79,18.33c5,0,9.6,2,9.6,8.33v14.2H82.8Zm0-5.74a5.78,5.78,0,0,0-4.64-1.91c-2.28,0-4.14,1.23-4.14,3.32s1.87,3.23,4.14,3.23a5.78,5.78,0,0,0,4.64-1.91Z"/><path d="M109.15,38.08a10.29,10.29,0,0,1-7.74,3.32c-4.82,0-7.1-2.64-7.1-6.92V18.88h5.78V32.21c0,3,1.59,4.05,4.05,4.05a6.47,6.47,0,0,0,5-2.5V18.88h5.78v22h-5.78Z"/><path d="M135.5,27.57c0-3-1.59-4.1-4.05-4.1a6.26,6.26,0,0,0-5,2.59V40.86h-5.78v-22h5.78v2.87a10.07,10.07,0,0,1,7.69-3.41c4.82,0,7.15,2.73,7.15,7V40.86H135.5Z"/><path d="M157.26,18.33c4.51,0,7.24,2,8.69,4l-3.78,3.5a5.44,5.44,0,0,0-4.64-2.37c-3.5,0-6,2.55-6,6.37s2.46,6.42,6,6.42a5.55,5.55,0,0,0,4.64-2.37L166,37.4c-1.46,2-4.19,4-8.69,4-6.78,0-11.65-4.78-11.65-11.56S150.48,18.33,157.26,18.33Z"/><path d="M184.61,27.48c0-3-1.59-4-4.1-4a6.4,6.4,0,0,0-5,2.59V40.86h-5.78V10.5h5.78V21.74a10.17,10.17,0,0,1,7.74-3.41c4.82,0,7.15,2.64,7.15,6.92V40.86h-5.78Z"/><path d="M196.12,49.24V18.88h5.78v2.78a8.49,8.49,0,0,1,6.78-3.32c5.64,0,9.74,4.19,9.74,11.52s-4.1,11.56-9.74,11.56A8.4,8.4,0,0,1,201.9,38v11.2Zm10.74-25.76a6.47,6.47,0,0,0-5,2.5v7.78a6.62,6.62,0,0,0,5,2.5c3.32,0,5.55-2.59,5.55-6.42S210.19,23.47,206.86,23.47Z"/><path d="M235.94,38.59a9.1,9.1,0,0,1-7,2.82c-3.51,0-7.65-2.37-7.65-7.28,0-5.14,4.14-7,7.65-7,2.91,0,5.51.91,7,2.69v-3c0-2.23-1.91-3.69-4.82-3.69a9.25,9.25,0,0,0-6.42,2.59l-2.18-3.87a14.42,14.42,0,0,1,9.6-3.46c5,0,9.6,2,9.6,8.33v14.2h-5.78Zm0-5.74a5.78,5.78,0,0,0-4.64-1.91c-2.28,0-4.14,1.23-4.14,3.32s1.87,3.23,4.14,3.23a5.78,5.78,0,0,0,4.64-1.91Z"/><path d="M262.57,38.08a8.62,8.62,0,0,1-6.78,3.32c-5.55,0-9.74-4.19-9.74-11.51s4.14-11.56,9.74-11.56a8.47,8.47,0,0,1,6.78,3.37V10.5h5.83V40.86h-5.83Zm0-12.11a6.36,6.36,0,0,0-5-2.5c-3.28,0-5.55,2.59-5.55,6.42s2.28,6.37,5.55,6.37a6.36,6.36,0,0,0,5-2.5Z"/><path d="M7.56,38.52l8.13,10.73a1.41,1.41,0,0,0,2.16,0L26,38.52a1.34,1.34,0,0,0-.56-2L18.53,33A4,4,0,0,0,15,33l-6.89,3.5A1.34,1.34,0,0,0,7.56,38.52Z"/><path d="M30.31,14.15,18.12.82a1.91,1.91,0,0,0-2.7,0L3.23,14.15a4,4,0,0,0-1,2.16L-.38,34.52c-.13.9,1,1.53,1.93,1.07L4.29,34.2l12.48-6.37L29.25,34.2,32,35.59c.92.47,2.06-.17,1.93-1.07l-2.57-18.2A4,4,0,0,0,30.31,14.15Z"/></svg> </div> <ul class="nav2"> <li class="li2">ABOUT US</li> <li class="li2">OUR WORK</li> <li class="li2">SERVICES</li> </ul> <!-- <div id="sup"> <ul class="nav3"> <li class="li3">ABOUT US</li> <li class="li3">OUR WORK</li> <li class="li3">SERVICES</li> </ul> </div> --> </footer> Here is what the footer should look like in the end
You can simply achieve that footer with the use of flexbox as demonstrated below. Hope, this helps. footer { background-color: #30659B; width: 100vw; } .logo2 { width: 150px; fill: white; display: block; } .nav { padding:0; list-style-type: none; color: white; display: flex; /*Generates a flexbox layout with default flex direction as row */ width: 100%; /* Not really required */ height:100px; align-items: center; /*Aligns contents vertically */ justify-content: space-around; } li { padding:0; font-family: proxima nova; font-size: 10px; text-decoration: none; text-align:center; margin:5px; } li:first-child{ margin-left:100px; } li:last-child{ margin-right:100px; } li a { text-decoration: none; color: white; } <footer> <ul class="nav"> <li class="li2">ABOUT US</li> <li class="li2">OUR WORK</li> <li class="li2">SERVICES</li> <li> <div class="logo2"> <svg class="logo2" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 268 50"><title>Artboard 1</title><path d="M46.26,10.5h6.46V35.17H65.55v5.69H46.26Z"/><path d="M82.8,38.59a9.1,9.1,0,0,1-7,2.82c-3.5,0-7.65-2.37-7.65-7.28,0-5.14,4.14-7,7.65-7,2.91,0,5.51.91,7,2.69v-3c0-2.23-1.91-3.69-4.82-3.69a9.25,9.25,0,0,0-6.42,2.59l-2.18-3.87A14.42,14.42,0,0,1,79,18.33c5,0,9.6,2,9.6,8.33v14.2H82.8Zm0-5.74a5.78,5.78,0,0,0-4.64-1.91c-2.28,0-4.14,1.23-4.14,3.32s1.87,3.23,4.14,3.23a5.78,5.78,0,0,0,4.64-1.91Z"/><path d="M109.15,38.08a10.29,10.29,0,0,1-7.74,3.32c-4.82,0-7.1-2.64-7.1-6.92V18.88h5.78V32.21c0,3,1.59,4.05,4.05,4.05a6.47,6.47,0,0,0,5-2.5V18.88h5.78v22h-5.78Z"/><path d="M135.5,27.57c0-3-1.59-4.1-4.05-4.1a6.26,6.26,0,0,0-5,2.59V40.86h-5.78v-22h5.78v2.87a10.07,10.07,0,0,1,7.69-3.41c4.82,0,7.15,2.73,7.15,7V40.86H135.5Z"/><path d="M157.26,18.33c4.51,0,7.24,2,8.69,4l-3.78,3.5a5.44,5.44,0,0,0-4.64-2.37c-3.5,0-6,2.55-6,6.37s2.46,6.42,6,6.42a5.55,5.55,0,0,0,4.64-2.37L166,37.4c-1.46,2-4.19,4-8.69,4-6.78,0-11.65-4.78-11.65-11.56S150.48,18.33,157.26,18.33Z"/><path d="M184.61,27.48c0-3-1.59-4-4.1-4a6.4,6.4,0,0,0-5,2.59V40.86h-5.78V10.5h5.78V21.74a10.17,10.17,0,0,1,7.74-3.41c4.82,0,7.15,2.64,7.15,6.92V40.86h-5.78Z"/><path d="M196.12,49.24V18.88h5.78v2.78a8.49,8.49,0,0,1,6.78-3.32c5.64,0,9.74,4.19,9.74,11.52s-4.1,11.56-9.74,11.56A8.4,8.4,0,0,1,201.9,38v11.2Zm10.74-25.76a6.47,6.47,0,0,0-5,2.5v7.78a6.62,6.62,0,0,0,5,2.5c3.32,0,5.55-2.59,5.55-6.42S210.19,23.47,206.86,23.47Z"/><path d="M235.94,38.59a9.1,9.1,0,0,1-7,2.82c-3.51,0-7.65-2.37-7.65-7.28,0-5.14,4.14-7,7.65-7,2.91,0,5.51.91,7,2.69v-3c0-2.23-1.91-3.69-4.82-3.69a9.25,9.25,0,0,0-6.42,2.59l-2.18-3.87a14.42,14.42,0,0,1,9.6-3.46c5,0,9.6,2,9.6,8.33v14.2h-5.78Zm0-5.74a5.78,5.78,0,0,0-4.64-1.91c-2.28,0-4.14,1.23-4.14,3.32s1.87,3.23,4.14,3.23a5.78,5.78,0,0,0,4.64-1.91Z"/><path d="M262.57,38.08a8.62,8.62,0,0,1-6.78,3.32c-5.55,0-9.74-4.19-9.74-11.51s4.14-11.56,9.74-11.56a8.47,8.47,0,0,1,6.78,3.37V10.5h5.83V40.86h-5.83Zm0-12.11a6.36,6.36,0,0,0-5-2.5c-3.28,0-5.55,2.59-5.55,6.42s2.28,6.37,5.55,6.37a6.36,6.36,0,0,0,5-2.5Z"/><path d="M7.56,38.52l8.13,10.73a1.41,1.41,0,0,0,2.16,0L26,38.52a1.34,1.34,0,0,0-.56-2L18.53,33A4,4,0,0,0,15,33l-6.89,3.5A1.34,1.34,0,0,0,7.56,38.52Z"/><path d="M30.31,14.15,18.12.82a1.91,1.91,0,0,0-2.7,0L3.23,14.15a4,4,0,0,0-1,2.16L-.38,34.52c-.13.9,1,1.53,1.93,1.07L4.29,34.2l12.48-6.37L29.25,34.2,32,35.59c.92.47,2.06-.17,1.93-1.07l-2.57-18.2A4,4,0,0,0,30.31,14.15Z"/></svg> </div></li> <li class="li3">TWITTER</li> <li class="li3">FACEBOOK</li> <li class="li3">INSTAGRAM</li> </ul> </footer>
Try with this <ul class="nav2"> <li class="li2">ABOUT US</li> <li class="li2">OUR WORK</li> <li class="li2">SERVICES</li> <li class="li2"><svg class="logo2" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg">Tu logo</svg></li> <li class="li2">TWITTER</li> <li class="li2">INSTAGRAM</li> <li class="li2">FACEBOOK</li> </ul>
Sure, try with this css class: .nav2 { list-style-type: none; overflow: hidden; text-align: center; margin: auto; padding: 0; width:100%; z-index:1000; }