I've been trying to position the contact info on a website to the right of the navigation bar. The left of the nav bar has the logo and website title. The logo and title are sitting fine on the left because that's just how they naturally positioned themselves, but I can't get the contact info to the right no matter what I do.
Here's the HTML coding
<nav>
<label class="logo"><img src="logo.png" width="100px"/></label>
<div class="title">Title</div>
<div class="contactinfo">Info</div>
</nav>
I made them divs so that they could be manipulated
nav {
background: whitesmoke;
height: 125px;
width: 100%;
display: flex;
line-height: 125px;
}
.title {
font-family: Impact, Haettenschweiler, 'Arial Narrow Bold', sans-serif;
color:rgb(35, 61, 96);
font-size: 40px;
}
.contactinfo {
font-family: sans-serif, bold;
color:rgb(35, 61, 96);
display: inline-flex;
justify-content: flex-end;
}
label.logo {
padding: 10px;
}
I made the nav bar flex so that I could position it, but it didn't work. I also tried assigning a width to the contact info, but it caused the title to break. I ended up getting the contact info positioned correctly by making the position fixed, but when I shrunk the browser down, the title and contact info overlapped instead of being responsive. Overall, I'm so confused on how I can make the text responsive while being aligned correctly. Any suggestions?
This is the code I used when the texts overlapped.
nav {
background: whitesmoke;
height: 125px;
width: 100%;
display: flex;
line-height: 125px;
}
.title {
line-height: 125px;
font-family: Impact, Haettenschweiler, 'Arial Narrow Bold', sans-serif;
color:rgb(35, 61, 96);
font-size: 40px;
}
.contactinfo {
font-family: sans-serif, bold;
color:rgb(35, 61, 96);
padding-right: 10px;
display: inline-block;
line-height: 125px;
position: absolute;
right: 0;
}
label.logo {
padding: 10px;
float: left;
}