Header not positioning correctly in IE - html

Working on a header and currently using Flexbox to position the header and everything is positioned center correctly like I want when I test locally on my Mac but when others on my team are testing in IE or Windows based machines the header is no longer being positioned in the center. It becomes full width positioned either left or right and I'm really not sure what I am missing or doing incorrectly. Any help would be appreciated.
What it should look like
What it's doing on a Windows machine
html
<header class="mcc-header ember-view">
<div class="mcc-full mcc-div">
<div class="mcc-header-content">
<a href="/" class="mcc-header-logo">
<span class="mcc-logo-title">MCC Semi</span>
</a>
<ul class="mcc-header-nav">
<li class="mcc-header-nav-item">
Company Profile
</li>
<li class="mcc-header-nav-item">
News
</li>
<li class="mcc-header-nav-item">
Contact Us
</li>
<li class="mcc-header-nav-item">
EN | CN
</li>
<li class="mcc-header-nav-item">
</li>
<li class="mcc-header-nav-item">
Login
</li>
<li class="mcc-header-nav-item">
Sign Up
</li>
</ul>
</div>
</div>
<div class="mcc-full">
<div id="main-menu" class="mcc-header-menu">
<div class="mcc-full">
<div class="mcc-header-legal">
<ul class="mcc-header-legal-list">
<li class="mcc-header-legal-item">
Products
</li>
<li class="mcc-header-legal-item">
Catalog
</li>
<li class="mcc-header-legal-item">
Applications
</li>
<li class="mcc-header-legal-item">
Quality
</li>
<li class="mcc-header-legal-item">
Calendar
</li>
</ul>
</div>
</div>
<form class="mcchf" id="mcchf-h-search" action="" method="get" title="" role="search">
<label class="mcchf">Search</label>
<input class="mcchf" id="mcchf-h-st" type="text" name="q" placeholder="Search">
<label class="mcchf">Submit search query</label>
<input class="mcchf" id="mcchf-h-sb" type="submit" value="">
</form>
</div>
</div>
</div>
</header>
css
.mcc-header {
background-color: #fff;
display: block;
padding-bottom: 24px;
position: fixed;
width: 100%;
height: 90px;
top: 0;
left: 0;
padding-right: 50px;
padding-left: 50px;
z-index: 800
}
.mcc-header-content {
display: flex;
flex-direction: column;
padding-top: 6px
}
.mcc-header-nav {
column-count: 2;
display: block;
width: 100%
}
#media screen and (min-width:760px) {
.mcc-header-content {
flex-direction: row;
justify-content: space-between;
padding-bottom: 0
}
.mcc-header-nav {
column-count: 3;
width: auto
}
}
#media screen and (min-width:1020px) {
.mcc-header .mcc-header-content {
align-items: flex-start;
padding-top: 0
}
.mcc-header .mcc-header-nav {
column-count: 1;
width: auto
}
}
.mcc-header-nav-item {
display: block;
text-align: center;
width: 100%
}
#media screen and (min-width:1020px) {
.mcc-header .mcc-header-nav-item {
display: inline;
text-align: left;
width: auto
}
}
.mcc-header-nav-link {
display: block;
margin-bottom: 0;
padding-bottom: 20px;
padding-top: 4px;
white-space: nowrap
}
#media screen and (min-width:760px) {
.mcc-header-nav-link {
display: inline-block;
padding-right: 24px
}
}
.mcc-header-legal {
border-bottom: none;
display: flex;
flex-direction: column;
justify-content: center
}
.mcc-header-legal-list {
display: block;
text-align: center;
}
#media screen and (min-width:760px) {
.mcc-header-legal {
align-items: baseline;
flex-direction: row;
margin-top: 0
}
.mcc-header-legal-list {
text-align: left
}
}
.mcc-header-legal-item {
display: inline-block;
padding-right: 24px;
padding-top: 24px;
text-align: left;
white-space: nowrap
}
.mcc-header-legal-item:last-of-type {
padding-right: 0
}
#media screen and (min-width:1020px) {
.mcc-header .mcc-header-legal-item {
margin-left: 0 !important;
padding-top: 8px
}
}
.mcc-header-logo {
display: block;
flex-shrink: 0;
padding-bottom: 0;
padding-top: 8px;
position: relative
}
.mcc-header-logo .mcc-logo-title {
height: 1px;
width: 1px;
position: absolute;
overflow: hidden;
top: -10px
}
#mcchf-h-search {
position: absolute;
top: 56px;
right: 5rem;
width: 250px;
height: 22px
}
#mcchf-h-search label.mcchf {
display: none
}
#mcchf-h-st {
position: absolute;
right: 30px;
width: 225px;
height: 22px;
padding-left: 5px;
cursor: text;
color: #111;
border-bottom: 1px solid #000;
border-top: none;
border-left: none;
border-right: none;
background: #fff;
-webkit-appearance: none;
border-radius: 0;
text-transform: none
}
#mcchf-h-sb {
position: absolute;
top: 0;
right: 0;
overflow: hidden;
width: 18px;
height: 18px;
cursor: pointer;
white-space: nowrap;
color: #000;
border: 0;
background: url('');
}
input {
display: block;
margin-bottom: .667em;
font-family: inherit;
font-size: 1rem;
line-height: 1.333em;
text-transform: uppercase;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
background-repeat: repeat-x;
background-size: .09em .09em;
background-position: 0 90%
}

Related

How to shift one element of an <li> list to the right

I have an unordered linked list. I'm trying to shift one of the items in the navigation all the way to the right (Order) as if it had text-align: right;. I tried using float: right; and text-align: right;, but none of them seemed to work. If I set the margin-left to a really high number (such as 100px) it does shift to the right, but if I resize my window then I can't see it anymore or it's not on the right side of the page. Here is the HTML:
nav {
position: fixed;
}
.navigation-links-no-style a {
text-decoration: none;
position: relative;
margin: 15px;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
}
li {
float: left;
}
.navigation-links li {
padding-top: 1.3em;
}
.navbar {
overflow: hidden;
position: fixed;
top: 0;
width: 100%;
border-bottom: solid 1px black;
background: white;
padding-left: 5em;
}
.navbar a {
float: left;
display: block;
text-align: center;
padding: 14px 16px;
text-decoration: none;
margin-left: 20px;
color: black;
font-size: 14pt;
}
.order {
color: #FFFFFF !important;
background: #1419e2;
text-decoration: none;
padding: 8px;
border-radius: 5px;
margin-top: 15px;
}
<div class="navbar">
<a class="glacier-hills" href="glacier_hills.html">
<img src="Images/Glacier-Hills-Logo.svg" alt="" width="182" height="90">
</a>
<ul class="navigation-links">
<div class="navigation-links-no-style">
<li>
<a class="menu" href="menu.html">Menu</a>
</li>
<li>
<a class="location" href="location.html">Hours and Location</a>
</li>
</div>
<li>
<a class="order" href="order.html">Order</a>
</li>
</ul>
</div>
Any help would be greatly appreciated. Thanks!
Assuming you're looking to move your .order element, you'll want to apply the float: right rule to the parent (<li>) element. I've added a class to this, .order-container, to make this easier to achieve in the following example.
Note also that once you float to the right, it will be off the screen by default. You'll want to set a negative margin-right to circumvent this. I've gone with margin-right: -10em in the following, to match the offset from the image on the left.
Ultimately, you may wish to consider using a framework to achieve responsive design, ensuring that the offset is correct regardless of screen size.
nav {
position: fixed;
}
.navigation-links-no-style a {
text-decoration: none;
position: relative;
margin: 15px;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
}
li {
float: left;
}
.navigation-links li {
padding-top: 1.3em;
}
.navbar {
overflow: hidden;
position: fixed;
top: 0;
width: 100%;
border-bottom: solid 1px black;
background: white;
padding-left: 5em;
}
.navbar a {
float: left;
display: block;
text-align: center;
padding: 14px 16px;
text-decoration: none;
margin-left: 20px;
color: black;
font-size: 14pt;
}
.order {
color: #FFFFFF !important;
background: #1419e2;
text-decoration: none;
padding: 8px;
border-radius: 5px;
margin-top: 15px;
float: right;
}
.order-container {
float: right;
margin-right: 10em;
}
<div class="navbar">
<a class="glacier-hills" href="glacier_hills.html">
<img src="Images/Glacier-Hills-Logo.svg" alt="" width="182" height="90">
</a>
<ul class="navigation-links">
<div class="navigation-links-no-style">
<li>
<a class="menu" href="menu.html">Menu</a>
</li>
<li>
<a class="location" href="location.html">Hours and Location</a>
</li>
</div>
<li class="order-container">
<a class="order" href="order.html">Order</a>
</li>
</ul>
</div>
MDN still advises that <div> is not a valid child of <ul>. Furthermore float adds a whole heap of side effects by removing the items from the natural flow of the document. To modernize this we can make use of display:flex
/*Normalise body*/
body {
margin:0;
}
/*Set flex on the nabar top position logo and links*/
.navbar {
display: flex;
}
/*Ad a maring to the logo link*/
.navbar > a:first-of-type {
margin-left: 5em;
}
nav {
position: fixed;
}
.navigation-links-no-style a {
text-decoration: none;
}
.navbar ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
width: 100%;
/*Ad flex to the nav link element*/
display: flex;
/*Vertically center the links*/
align-items:center;
}
/*Push the last element right but give it a little margin to the right*/
.navbar ul>li:last-of-type {
margin-left: auto;
margin-right:1em;
}
.navigation-links li {
padding-top: 1.3em;
}
.navbar {
overflow: hidden;
position: fixed;
top: 0;
width: 100%;
border-bottom: solid 1px black;
background: white;
}
.navbar a {
display: block;
text-align: center;
padding: 14px 16px;
text-decoration: none;
margin-left: 20px;
color: black;
font-size: 14pt;
}
.order {
color: #FFFFFF !important;
background: #1419e2;
text-decoration: none;
padding: 8px;
border-radius: 5px;
margin-top: 15px;
}
<div class="navbar">
<a class="glacier-hills" href="glacier_hills.html">
<img src="Images/Glacier-Hills-Logo.svg" alt="" width="182" height="90">
</a>
<ul class="navigation-links">
<li>
<a class="menu" href="menu.html">Menu</a>
</li>
<li>
<a class="location" href="location.html">Hours and Location</a>
</li>
<li>
<a class="order" href="order.html">Order</a>
</li>
</ul>
</div>
You should use media queries for making navbar responsive.
a {
text-decoration: none;
color: black;
}
.navbar {
width: 100%;
overflow: hidden;
position: fixed;
top: 0;
display: flex;
justify-content: space-between;
border-bottom: solid 1px black;
}
.div-links {
display: flex;
align-items: center;
width: 70%;
}
.nav-links {
width: 100%;
display: flex;
justify-content: end;
align-items: center;
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
}
.nav-links li {
padding: 2rem;
}
.nav-items {
width: 30%;
display: flex;
justify-content: space-around;
}
.order {
overflow: hidden;
color: #ffffff !important;
background: #1419e2;
text-decoration: none;
padding: 0.8rem;
border-radius: 5px;
}
<div class="navbar">
<a href="glacier_hills.html">
<img
src="Images/Glacier-Hills-Logo.svg"
alt=""
width="182"
height="90"
/>
</a>
<div class="div-links">
<ul class="nav-links">
<div class="nav-items">
<li>
<a class="menu" href="menu.html">Menu</a>
</li>
<li>
<a class="location" href="location.html">Hours and Location</a>
</li>
</div>
<li class="btn">
<a class="order" href="order.html">Order</a>
</li>
</ul>
</div>
</div>

Hero section under transparent navigational menu

I've been trying to search for a solution but I couldn't find any yet.
I would like to make a transparent navigational menu bar with a hero section just like in this website here https://paragonmigration.com/
I'm having trouble with the image part where the navigation menu overlapses it.
This is what I have done so far with html:
body {
padding: 0;
margin: 0;
width: 100%; /* fixes white space on the right side */
overflow-x: hidden; /* fixes white space on the right side */
}
h4 {
font-size: 18px;
}
/*#top-header {
height: 39px;
background-color: #36404a;
color: #fff;
line-height: 39px;
padding-left: 50px;
margin: 0;
padding: 0;
}*/
.top-header {
display: flex;
background-color: #36404a;
color: #fff;
height: 39px;
align-items: center;
}
.top-header > div {
margin: 0 15px;
}
.top-header > div > i {
margin-right: 5px;
}
.top-header-address {
padding-left: 50px;
}
.top-header-email {
flex: 2;
}
.top-header-facebook {
flex-basis: 2em;
}
.top-header-facebook a {
color: #fff;
}
.top-header-book {
display: flex; /* in order to center the elements inside */
background-color: #fa0505;
flex-basis: 251px;
height: 100%; /* in order to entirely stretch and fill to the parent element's* height */
align-items: center;
justify-content: center;
}
/* remove the right margin for the last div */
.top-header div:nth-last-child(1) {
margin: 0;
}
.top-header-book a {
text-decoration: none;
color: #fff;
margin-right: 5px;
font-weight: bold;
}
/*
#site-header-menu {
position: absolute;
top: 0;
left: 0;
width: 100%;
}
*/
.nav-menu {
display: flex;
height: 80px;
background-color: rgba(255, 255, 255, 0.6);
align-items: center;
}
/* add sticky functionality to navigation menu */
.sticky {
position: fixed;
top: 0;
width: 100%;
background-color: #36404a;
color: #fff;
z-index: 2;
}
.sticky.nav-menu ul li a {
color: #fff;
}
.logo img {
height: 75px;
width: 156px;
}
.nav-menu ul {
display: flex;
flex: 4;
/*height: 100%;*/
justify-content: center;
align-items: center;
list-style-type: none;
margin: 0;
padding: 0;
}
.nav-menu ul > li {
font-size: 14px;
margin: 0 10px;
}
.nav-menu ul li a {
text-decoration: none;
color: #000;
}
.have-questions {
display: flex;
align-items: center;
justify-items: center;
text-align: center;
}
.message-icon i {
color: red;
}
.questions {
font-size: 18px;
margin: 10px;
line-height: 1.5em;
}
#slider {
position: relative;
top: -150px;
padding: 0;
background: url('../assets/images/slide.jpg') no-repeat center center fixed;
/* background-size: cover;*/
height: 750px;
color: #fff;
z-index: -1;
}
<div id="site-header-menu">
<div class="container top-header">
<div class="top-header-address">
<i class="fas fa-map-marker-alt"></i>
Address: 2903, Single Business Tower, Dubai
</div>
<div class="top-header-email">
<i class="far fa-envelope"></i>
Email Address: info#paragonmigration.com
</div>
<div class="top-header-facebook">
<i class="fab fa-facebook-f"></i>
</div>
<div class="top-header-book">
Book A Consultation
<i class="fas fa-long-arrow-alt-right"></i>
</div>
</div><!-- #site-header-menu -->
<div class="nav-menu" id="nav-menu">
<div class="logo"><img src="assets/images/logo.png" alt="logo"></div>
<ul>
<li>HOME</li>
<li>ABOUT US</li>
<li>CANADA</li>
<li>POLAND</li>
<li>AUSTRALIA</li>
<li>NEW ZEALAND</li>
<li>UK</li>
<li>CONTACT US</li>
</ul>
<div class="have-questions">
<div class="message-icon"><i class="far fa-comment-alt fa-3x"></i></div>
<div class="questions">
<div>Have any Questions?</div>
<div>04 303 3000</div>
</div>
</div>
</div><!-- .nav-menu -->
</div><!-- site-header-menu -->
<div id="slider">
<p id="welcome">WELCOME TO PARAGON</p>
<p id="migration">Migration and Visa</p>
<p id="consultants"><em>Consultants</em></p>
LEARN MORE >
</div><!-- #slider -->

Navbar Height Not Readjusting?

I have a navbar that is not re-sizing correctly when my logo image gets shrunk. Here is a link to the Codepen page for the complete code:
https://codepen.io/gabor-szekely/pen/JeMqQz
Basically, I am trying to re-size the "Sino Medical" logo image in the top left corner to 80% of it's original size, but when I do so, the entire navbar is not shrinking along with it, and is therefore too tall.
Can anyone help?
Here is the HTML:
<div class="navWrapper">
<nav class="flex-wrapper">
<div class="top-row-logo">
<img class="logo-img" src="https://img1.wsimg.com/isteam/ip/7bf494f1-7493-4549-b272-842b0d021577/logo/345e441d-0495-4f5b-bd62-f6413ac9b7a5.png/:/rs=h:71" alt="Sino Medical Institute">
</div>
<div class="top-row-links">
<ul>
<li>
Home
</li>
<li>
About Us
</li>
<li>
Services
</li>
<li>
Register
</li>
<li>
Contact Us
</li>
<li>
FAQ
</li>
</ul>
</div>
<div class="login-links">
<ul>
<li>
Login
</li>
</ul>
</div>
</nav>
</div>
And here is the relevant CSS:
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
}
li {
float: left;
}
li a {
text-align: center;
padding: 0 1.5em;
color: #333;
}
.navWrapper {
position: fixed;
top: 0;
left: 0;
width: 100%;
}
.flex-wrapper {
display: flex;
flex-flow: row nowrap;
background-color: white;
border-bottom: 1px solid #c8c8dc;
}
.top-row-logo {
flex: 1;
}
.logo-img {
margin-left: 3.2rem;
height: 80%; /* THIS IS THE ISSUE! */
}
.top-row-links, .login-links {
margin: auto 0;
}
.top-row-links {
flex: 1.5;
margin-right: 3.2rem;
}
.login-links {
margin-right: 4rem;
}
Thanks!
You could set the .top-row-logo to align-self: center instead of having it set to stretch which it inherits from the parent elements align-items declaration and set the .logo-img to display: block to get rid of the white space below the image.
In regards to setting the height of the element as a percentage value, this isn't possible unless you explicitly set the height of the imgelement's containing block. So for your case, you could do something like below:
.top-row-logo {
flex: 1;
align-self: center;
height: calc(71px * 0.8);
}
.logo-img {
margin-left: 3.2rem;
height: 100%;
display: block;
}
Or, if you want to be more dynamic you could use some javascript to set the height so even if the height of the image is over 71px it will always render at 80% of its original value.
See below for a demo:
// get the img
let img = document.querySelector(".logo-img");
// retrieve it's height
let imgCSS = window.getComputedStyle(img);
let imgHeight = imgCSS.getPropertyValue("height");
imgHeight = parseInt(imgHeight);
// set the height to 80% of it's original value
let newHeight = imgHeight * 0.8;
// set the height of img element to the new height
img.style.height = newHeight + "px";
*, *::before, *::after {
box-sizing: border-box;
}
body {
font-family: "Open Sans";
margin: 0;
padding: 0;
font-size: 0.8em;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
}
li {
float: left;
}
li a {
text-decoration: none;
padding: 0 1.5em;
color: #333;
transition: color 400ms ease;
}
li a:hover {
color: #6dacd5;
}
.navWrapper {
position: fixed;
top: 0;
left: 0;
z-index: 3;
width: 100%;
}
.flex-wrapper {
display: flex;
flex-flow: row nowrap;
background-color: white;
border-bottom: 1px solid #c8c8dc;
}
.top-row-logo {
flex: 1;
align-self: center;
}
.logo-img {
margin-left: 3.2rem;
display: block;
}
.top-row-links, .login-links {
margin: auto 0;
}
.top-row-links {
flex: 1.5;
margin-right: 3.2rem;
}
.login-links {
float: right;
margin-right: 4rem;
}
.login-button {
display: inline-block;
color: #008fe1;
font-size: 0.9em;
font-family: "Roboto", sans-serif;
font-weight: 700;
text-align: center;
text-decoration: none;
text-transform: uppercase;
background-color: white;
padding: .8em 1.6em;
border: 2px solid #008fe1;
border-radius: 4px;
cursor: pointer;
transition: all 400ms ease;
}
.login-button:hover {
background-color: #008fe1;
color: #fff;
}
<div class="navWrapper">
<nav id="flex-wrapper" class="flex-wrapper">
<div class="top-row-logo" id="top-row-logo">
<img class="logo-img" src="https://img1.wsimg.com/isteam/ip/7bf494f1-7493-4549-b272-842b0d021577/logo/345e441d-0495-4f5b-bd62-f6413ac9b7a5.png/:/rs=h:71" alt="Sino Medical Institute">
</div>
<div class="top-row-links">
<ul class="navbar">
<li>
Home
</li>
<li>
About Us
</li>
<li>
Services
</li>
<li>
<a href="#">
Register
</a>
</li>
<li>
Contact Us
</li>
<li>
FAQ
</li>
</ul>
</div>
<div class="login-links">
<ul>
<li>
Login
</li>
</ul>
</div>
</nav>
</div>
use auto height...
.navWrapper {
position: fixed;
top: 0;
left: 0;
z-index: 3;
width: 100%;
height:auto;
}

Zindex issue with -webkit-overflow-scrolling: touch; in safari

I am having issue with z-index on header only for iphone and tried multiple ways and also took reference from here https://stackoverflow.com/questions/37696746/ios-not-respecting-z-index-with-webkit-overflow-scrolling. When we scroll horizontally, I want the icons to appear above shadow.
Here is the code:
.masthead-nav-container {
position: relative;
background: #161D25;
}
.masthead-nav {
display: flex;
justify-content: space-between;
align-items: center;
overflow: auto;
-webkit-overflow-scrolling: touch;
scroll-behavior: smooth;
white-space: nowrap;
height: 52px;
border-top: 1px solid #535B63;
}
.masthead-nav-topics-item:last-child {
margin-right: 96px;
}
.masthead-nav-container::after {
background: linear-gradient(to right, rgba(22, 29, 37, 0), #161D25);
content: "";
position: absolute;
right: 0;
top: 1px;
bottom: 0;
height: 100%;
width: 96px;
z-index: 1;
}
.masthead-nav-topics {
margin-left: 16px;
line-height: 1;
}
.masthead-nav-topics-item {
display: inline-block;
margin-right: 24px;
}
.masthead-nav-topics-anchor {
font-size: 14px;
line-height: 20px;
text-transform: uppercase;
color: #fbfbfb;
}
.masthead-nav-social {
position: relative;
line-height: 1;
z-index: 5;
}
.masthead-nav-social-item {
display: inline-flex;
margin-left: 8px;
}
.masthead-nav-social-anchor {
width: 24px;
height: 24px;
background: #72DA38;
}
.masthead-nav-social-item:last-child {
margin-right: 16px;
}
<div class="masthead-nav-container js-nano-container">
<nav class="masthead-nav ">
<ul class="masthead-nav-topics">
<li class="masthead-nav-topics-item"><a class="masthead-nav-topics-anchor" href="#">Análisis</a></li>
<li class="masthead-nav-topics-item"><a class="masthead-nav-topics-anchor" href="#">Xataka Selección</a></li>
<li class="masthead-nav-topics-item"><a class="masthead-nav-topics-anchor" href="#">Móviles</a></li>
<li class="masthead-nav-topics-item"><a class="masthead-nav-topics-anchor" href="#">Inteligencia Artificial</a></li>
<li class="masthead-nav-topics-item"><a class="masthead-nav-topics-anchor" href="#">Asistentes de voz</a></li>
</ul>
<ul class="masthead-nav-social">
<li class="masthead-nav-social-item"></li>
<li class="masthead-nav-social-item"></li>
<li class="masthead-nav-social-item"></li>
<li class="masthead-nav-social-item"></li>
</ul>
</nav>
</div>
Note: It is only appearing in iphone and ipad safari browser

float right is not working in my case , what should i do?

Hi all , As show in the picture , if i use float right , the phone image will be after the hamburger icon.
what should i do to position the phone icon before the hamburger icon except using margin it all the way ?
<div class="top_nav" style="position:fixed; width=100%;">
<div class="top_nav_menu top_nav_left_log_part">
<a href="index.html" style="padding:auto;">
<img id="img_nav_left_png" src="img/fujitsu.svg" alt="" style="height:80px; width=83px;padding-top:17px;padding-bottom:23px;">
</a>
</div>
<div id="top_nav_menu_middle_id" class="top_nav_menu top_nav_menu_middle">
<ul class="top_nav_ul">
<li class="top_nav_li nav_menu">Services</li>
<li class="top_nav_li nav_menu">Support</li>
<li class="top_nav_li nav_menu">Training</li>
<li class="top_nav_li nav_menu">Product</li>
<li class="top_nav_li nav_menu">Solutions</li>
<li class="top_nav_li nav_menu">Contact</li>
</ul>
</div>
<div class="top_nav_menu top_nav_contact_part">
<ul class="top_nav_ul">
<li id = "top_nav_phone_log_li" class="top_nav_li" >
<a href="tel://+6194549191" style="padding-top:25px;">
<img id="img_nav_phone_png" src="img/phone_icon.svg" alt="" style="height:100%; margin-left:20px; width:26px;height:30px;">
</a>
</li>
<li id = "top_nav_phone_number_li" class="top_nav_li ">+61 2 9454 9191</li>
</ul>
</div>
<div class="top_nav_menu top_nav_right_log_part">
<ul class="top_nav_ul">
<li class="top_nav_li top_nav_right_log">
<img id="img_nav_right_png" src="img/PostgreSQL.svg" alt="Contact-number" style="height:40px;width:175px;">
</li>
<li class="hamberger_icon">
☰
</li>
</ul>
</div>
</div>
Thanks
CSS code
.top_nav {
margin: 0px 0px 0px 0px;
height: 80px;
width: 100%;
position: fixed;
top: 0px;
background-color: #ffffff;
z-index: 1;
border-bottom-style: solid;
border-bottom-width: 4px;
border-bottom-color: #F7F9F8;
}
.top_nav_menu {
margin: 0px 0px 0px 0px;
/* border-style: solid;*/
border-color: red;
float: left;
height: 80px;
vertical-align: top;
}
.top_nav_left_log_part {
margin-left: 30px;
margin-right: 20px;
}
.top_nav_right_log_part {
float: right;
}
ul.top_nav_ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
/* background-color: #333;*/
}
li.top_nav_li {
float: left;
height: 80px;
/* border-style: solid;*/
}
li.top_nav_li a {
display: inline-block;
/* color: white;*/
text-align: center;
padding-top: 25px;
/* padding-left: 16px;*/
/* padding: 10px 16px;*/
text-decoration: none;
transition: 0.3s;
}
li.nav_menu:hover:not(.active) {
background-color: #eeeeee;
}
li.nav_menu_active {
border-bottom-color: #ff0000;
border-bottom-style: solid;
border-bottom-width: 4px;
}
li.top_nav_li a:hover:active {
/* background-color: red;;*/
}
li.nav_menu a {
font-size: 20px;
color: #322f31;
margin-left: 20px;
margin-right: 20px;
}
li#nav_menu_show {
display: none;
}
li#nav_menu_show a:hover:not(.active) {
background-color: red;
}
img#img_nav_left_png,
img#img_nav_right_png,
img#img_nav_phone_png {
display: block;
/* width: 25px; */
margin: auto;
}
li.top_nav_right_log {
float: right;
margin-right: 10px;
padding-top: 20px;
display: none;
}
ul.top_nav_ul li.icon {
display: none;
}
/*hamberger size*/
#hamberger {
font-size: 30px;
margin: 0;
}
.icon {
margin-top: 15px;
}
.number {
margin-left: 10px;
}
li.hamberger_icon {
float: right;
margin-right: 10px;
padding-top: 17px;
display: none;
}
#media screen and (max-width:1170px) {
/* .top_nav_contact_part{
display:none;
}*/
li.nav_menu a {
font-size: 20px;
color: #322f31;
margin-left: 10px;
margin-right: 10px;
}
.top_nav_left_log_part {
margin-left: 20px;
margin-right: 10px;
}
.top_nav_right_log {
margin-right: 0px;
}
id#img_nav_phone_png {
margin-left: 100px;
}
}
#media screen and (max-width:1160px) {
.top_nav_menu_middle {
width: 100%;
display: none;
position: fixed;
top: 80px;
}
li.nav_menu {
background-color: grey;
float: none;
}
li.top_nav_right_log {
display: none;
}
li.hamberger_icon {
font-size: 30px;
display: block;
float: right;
margin-right: 10px;
}
}
#media screen and (min-width:1165px) {
li.top_nav_right_log {
display: block;
}
li.nav_menu {
float: left;
}
/* .top_nav_menu_middle{
display: block;
}*/
}
.top_nav_menu_middle_display {
display: block;
}
/*Navi Responsive */
/* When the screen is less than 768 pixels wide, hide all list items, except for the first one ("Home"). Show the list item that contains the link to open and close the topnav (li.icon) */
#media screen and (max-width:800px) {
.top_nav_menu_middle{
display: none;
}
#top_nav_phone_number_li{
display:none;
}/*
.top_nav_contact_part{
: right;
}
*/
ul.top_nav_ul li.top_nav_right_log{
display: none;
}
ul.top_nav_ul li.hamberger_icon {
float: right;
display: block;
}
}
I recommend using Flexbox for this.
Your html would look something like this:
<div class="navigation-bar">
<div class="telephone"></div>
<div class="hamburger-menu-icon"><div>
</div>
Your CSS would look like this:
.navigation-bar {
display: flex;
flex-direction: row;
justify-content: end;
}
.telephone {
order: -1;
}
justify-content: end; would be kind of the same as float: right;
When you tell .telephone to have order: -1; you tell it to be in front of the other elements (hamburger-menu-icon).
Guide to flexbox:
https://css-tricks.com/snippets/css/a-guide-to-flexbox/
If you would like I could create a codepen. Let me know!
You could make a flex looking like this:
[phone symbol] [--------------flex-spacer--------------] [hamburger symbol]
HTML:
<div class="container">
<div class="symbol">
phone symbol
</div>
<div class="flex-spacer">
</div>
<div class="symbol">
hamburger symbol
</div>
</div>
CSS:
.container {
display: flex;
flex-direction: row;
}
.symbol {
flex-grow: 0;
flex-shrink: 1;
}
.flex-spacer {
flex-grow: 1;
}