The menu header is experiencing issues with alignment

I've been tackling the alignment of elements in my menu header, but for some reason, they're not lining up horizontally as intended. Instead, they are stacked below each other. Here's the link to my jsfiddle

Here's a snippet of my HTML code:

<div class="topnav">
    <img src="https://s4.postimg.org/ojd13poal/northman_wordmark_CMYK.png">
    <nav>
        <ul>
            <li class="dropdown">
                <a href="#"><b>INSURANCE</b> <i class="fa fa-angle-down"></i></a>
                <ul class="dropdown-content">
                    <li><a href="#"><i>INDIVIDUAL</i></a>
                    </li>
                    <li><a href="#"><i>CORPORATE</i></a>
                    </li>
                </ul>
            </li>
            <li class="our-story">OUR STORY</li>
            <li class="login-signup">Log In | Sign up</li>
            <li class="get-covered">GET <strong style="font-style:italic">COVERED</strong>
            </li>
        </ul>
    </nav>
</div>

And this is how I styled it using CSS:

@font-face {
    font-family: AvantGarde Demi;
    src: url(AvantGarde Demi.woff);
}
@font-face {
    font-family: AvantGarde;
    src: url(AvantGarde.woff);
}
@font-face {
    font-family: ITC Avant Garde Gothic;
    src: url(ITC Avant Garde Gothic.woff);
}
.topnav {
    background-color: #333;
    overflow: hidden;
    padding: 0 10px;
}
.topnav > img,
nav {
    display: inline-block;
    vertical-align: middle;
}
/* Other CSS styles... */

I'm looking to align everything in the menu header horizontally on one line. For reference, please check out this image, which gives an idea of the desired layout on a black background.

Answer №1

Include this in your stylesheet:

header > section > div {
  display:flex;
}

Answer №2

You have the option to utilize display:flex.

@font-face {
    font-family: AvantGarde Demi;
    src: url(AvantGarde Demi.woff);
}
@font-face {
    font-family: AvantGarde;
    src: url(AvantGarde.woff);
}
@font-face {
    font-family: ITC Avant Garde Gothic;
    src: url(ITC Avant Garde Gothic.woff);
}
.topnav {
    background-color: #333;
    overflow: hidden;
    padding: 0 10px;
    display: flex;
    align-items: center;
}
.topnav > img,
nav {
    display: block;
}
nav > ul {
    margin: 0;
    display: flex;
    align-items: center;
}
.topnav .dropdown {
}
.topnav a {
    color: white;
    display: block;
    font-size: 17px;
    text-decoration: none;
}
.topnav .dropdown > a {
    padding: 20px 16px;
}
.topnav .dropdown-content li > a {
    padding: 10px 16px;
}
.topnav ul > li > ul {
    background-color: #f76c38;
    display: none;
    padding: 0;
    position: absolute;
    width: 200px;
}
.topnav ul > li > ul > li {
    display: block;
    text-align: left;
}
body {
    border: 0;
    height: 100%;
    margin: 0;
    min-height: 100%;
    overflow-x: hidden;
}
.fa-6 {
    font-size: 1.5em;
}
.login {
    color: white;
    display: inline;
    font-family: AvantGarde;
    font-size: 11.433px;
    letter-spacing: .25em;
    padding-left: 15px;
}
.login a {
    color: white;
    text-decoration: none;
}
.login a:hover {
    color: #fe5b1f;
    text-decoration: none;
}
.container {
    width: 100% !important;
}

li.get-covered {
    margin-top: 15px;
    padding-bottom: 10px !important;
    padding-top: 10px !important;
}
li.our-story {
    color: white;
    font-family: AvantGarde;
    letter-spacing: .30em;
}
li.login-signup {
    color: white;
    font-family: Adelle PE;
    font-size: 12px;
    font-style: italic;
    letter-spacing: .30em;
}
li.get-covered {
    border-color: #EF7440;
    border-style: solid;
    color: white;
    font-family: Adelle PE;
    letter-spacing: .30em;
}
li.get-covered:hover {
    background-color: #EF7440;
}
li.insurance {
    color: white;
    font-family: AvantGarde;
    letter-spacing: .30em;
    margin-left: 80px;
    margin-right: 80px;
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Running a Node JS application concurrently with an Express API connected to MongoDB

Here's my current project plan: I've created a small Node app that fetches data about the stock market from an API and then stores the data in a Mongo DB (which is already up and running). My next step is to create an API that will allow other se ...

Could you explain the contrast among "yarn serve," "yarn start," and "yarn build"?

Although both "yarn serve" and "yarn start" can launch my Vue project, I'm unsure of the differences between them. I've heard that "yarn build" is for packaging, but why don't I use it at work? Usually, I just upload my code to git and let ...

Exploring SubjectBehavior within my UserService and Profile Component

Within my ShareService, I have the following code snippet: isLogin$:BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false); <==== default value is false CheckUser = this.isLogin$.asObservable(); public isLogin (bool){ ...

Exploring the ‘ref’ feature in React alongside Material-UI

In my attempt to access input data through React's "ref" attribute on a TextField in Material-UI, I've encountered some difficulties. It doesn't seem straightforward to achieve this using the 'inputRef' or 'inputProps' me ...

Modifying two distinct charts according to the choices made in two independent dropdown menus

In my current project, I am facing a challenge with integrating two separate dropdowns containing UFC fighter names. The goal is to display a plot showing the KD (Knockdown) data for the selected fighters over time when their names are chosen from both dro ...

The information seems to not be getting transferred to the req.body variables from the HTML form

Within my server-side settings using knex and express, I have defined the following function: // POST: Create new users app.post('/add-user', (req, res) => { const {firstName, lastName, emailAdd, gender, dob, password} = req.body; cons ...

Implementing JQuery's load event for image loading

I am looking to dynamically resize the parent container of an image to match the same size as the image itself once it has loaded. Currently, I have been using the following code: $(window).load(function(){ $('.image-principale').each(funct ...

Using D3 to create SVG elements in Next.js, the mouseenter event only triggers once

I'm currently developing a React Component that utilizes D3, however, I am facing an issue where the SVG circles are only triggered once. import React, { useEffect, useRef, useState } from 'react'; import * as d3 from 'd3'; import ...

Retrieve a JSON object from a JSON array using a specific key

I am facing a situation where I have a json array containing multiple json objects. Let's take the example of a course object with the following structure: {"name": "Math", "unit": "3"} The json array looks something like this: [{"name": "Math", "u ...

Newcomers: Introduction to PHP password security

As someone who is new to PHP password hashing and coding, I recently created a simple login form that requires a username and password. After successfully submitting the form, the password is stored in a database by using $_POST['password']. Howe ...

Transform a string into an object using AngularJS $parse function

Imagine having a server that sends back a response in the form of: { multiply:function(x,y) { return x*y; }, divide:function(x,y) { return x/y; } } Can this be converted into a functional method? I attempted to convert ...

The casperjs evaluate function isn't able to provide me with the necessary data I

Having trouble getting my function to return data correctly. I am trying to retrieve the value of this input box. <input type="text" value="<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0b6e736a667b6764646025686466">[em ...

Merge the aoData array from DataTables with the serialized form data

I am currently working with jQuery data tables and am trying to merge the aoData with form serialize data using jQuery. fnServerData: function(sSource, aoData, fnCallback,oSettings) { aoData.concat( $("#frm").serializeArray()); ...

Unique calculation for rotational movement

I am currently developing a unique compass application. Although the project is progressing well, I am facing a significant challenge with one aspect: My code calculates degree angles within the range of -360 and 360: -318°, -29°, 223°, -163°, ... ...

"Update your Chart.js to version 3.7.1 to eliminate the vertical scale displaying values on the left

https://i.sstatic.net/7CzRg.png Is there a way to disable the scale with additional marks from 0 to 45000 as shown in the screenshot? I've attempted various solutions, including updating chartjs to the latest version, but I'm specifically intere ...

What is the best way to destructure an array enclosed within the Promise keyword in JavaScript?

Currently, I am attempting to extract information from a PSQL table using the following code: async function requestData() { var selectQuery = `SELECT "fName", "lName", "phoneNumber", "eMail" FROM public."Use ...

Enhancing leaflet popup functionality by incorporating ng-click into the onEachFeature function

After creating a map and connecting it with my geojson api, I encountered an issue when trying to link each marker popup with ng-click. Simply adding HTML like this did not work as expected: layer.bindPopup("<button ng-click='()'>+feature. ...

NodeJS MySQL failing to retrieve the most updated data post-write

I'm struggling to solve an issue where after performing data operations (create, update, delete) and then querying for the data afterwards, I receive the previous version of the data rather than the updated version. For example: Let's say I hav ...

Unable to use OrbitControls with Node 12's ES6 import functionality

Currently, I am working with Node 12 (experimental-modules) and using npm for three.js. However, I'm facing issues with Imports when trying to include OrbitControls.js in my project. My index.js file is set as "script: module". Unfortunately, none of ...

The HTML source code in the browser varies from the output obtained through Python requests

I've noticed a discrepancy between the HTML source code displayed in my browser and the code I receive when using Python's requests.get function. You can see the image depicting this issue at the following link: Any thoughts on why this might be ...