Responsive navigation bar not displaying properly

Hey there, I'm currently working on making my navigation bar responsive but I'm encountering some difficulties.

Here is the HTML and CSS code snippet I am using:

@media (max-width: 600px) {
    .toggle-btn {
        display: flex;
    }

    .logo {
        display: none;
    }

    header {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
    }

    .row ul {
        display: flex;
        flex-direction: column;
    }
}
<header>
    <div class="container">
        <a href="" class="toggle-btn">
            <span class="bar"></span>
            <span class="bar"></span>
            <span class="bar"></span>
        </a>
        <div class="row">
            <a href="index.html" class="logo"><img src="myLogo.png"></a>
            <nav>
                <ul>
                    <li><a href="#">Home</a></li>
                    <li><a href="#">Work</a></li>
                    <li><a href="#">About us</a></li>
                    <li><a href="#">Support</a></li>
                </ul>
            </nav>
        </div>  
    </div>
</header>

I have managed to make the list items display in a column, but now I want to get them centered on the page. I have tried various methods like justify-content: center;, justify-items: center;, and text-align: center; but haven't been successful. Can someone provide assistance with this issue?

Thank you in advance :)

Answer №1

justify-content: flex-start; could be changed to justify-content: center;

I recommend reading up on Flexbox by checking out some articles like this for a good starting point.

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

The CSS background image is not functioning

.menubar li { float: left; width: 115px; text-align: center; background-image: url(js/left_main_bg_image.gif); } Having issues with the background image not displaying properly in IE, Firefox, and Chrome. I've tried adding it to a tab ...

Is it possible to switch from a dropdown menu to radio buttons?

I am looking to change the dropdown menu in my search section into radio buttons. Currently, when I select something from the dropdown menu, the search fields are altered. Here is the code for the dropdown menu: <select id="qs_category" name="qs_catego ...

Toggle the visibility of all elements using jQuery by creating multiple buttons for each action

I have a group of 4 buttons that control the visibility of images on the page. Each button toggles between showing and hiding all images when clicked. When a button is clicked, it changes its text from "HIDE ALL" to "DISPLAY ALL." The issue I'm facin ...

Error encountered when attempting to upload CSV file through HTML form using POST method in Django framework

I have developed a straightforward application that has a single page where users can input a list of zip codes and receive a file containing zip codes within a specific radius of the original list. However, I am facing an issue with the function in my vi ...

Tips for implementing a sliding list feature with next and previous buttons:

Currently, I am utilizing a list attribute to display thumbnail images of a YouTube-generated playlist (gdata feed). However, my goal is to enclose the list within a div container and implement next and previous buttons to slide through the playlist images ...

Learn the functionality of element focus in javascript

I'm trying to wrap my head around how element focus functions. Here are my questions:- Are there any limitations to JavaScript focus? Does it have the same permissions when executed from website code versus the debug console? Additionally, doe ...

What could be causing the issue: Unable to locate or read the file: ./styles-variables?

I'm currently following a tutorial on how to create responsive layouts with Bootstrap 4 and Angular 6. You can find the tutorial here. I've reached a point where I need to import styles-variables.scss in my styles file, but I keep encountering t ...

Android: Substituting < p > and < br / > elements

My current situation involves receiving JSON data from a website and displaying it in a TextView. I have successfully achieved this, however, my boss requires the text to be plain with no paragraphs or empty lines. The text is retrieved from the website&a ...

What is the reason for having two scroll bars and how can I eliminate one of them?

Is there a way to remove one of the two vertical scrollbars on my webpage? Lorem ipsum is included for testing purposes. Apologies for the content being in another language. * { margin: 0; padding: 0; box-sizing: border-box; } html { overflow-x ...

Learn how to personalize the Bootstrap carousel by keeping certain text elements static while others change with each background image

I am a beginner when it comes to using Bootstrap and I am seeking some guidance on how to make the following design concept a reality. Our goal is to have a carousel featured on our homepage, where the company name (aligned to the left) remains visible at ...

What is the best way to animate a three.js object to the right using GSAP without obstructing the surrounding HTML text?

As a newcomer to web design, I seek forgiveness if my question appears basic. I am working on an animated object in three.js that I want to move to the left side of the screen using GSAP. Additionally, I have a text "Hello" on the left side of the screen. ...

Ways to focus on a specific div using JavaScript

I am attempting to create a 'snow' effect on the background of a particular div with a red border. Here is the code, but you can also view it here: <!-- language: lang-js --> var width = getWidth(); var height = getH ...

Embed a section of the webpage using an iframe

I am looking to feature a question from this website on another site using an iframe. However, I only want to display the question portion, not the entire page. <iframe src="http://qstn.mthmtcs.ir/index.php?qa=80" width="100%" height="100%" align="c ...

Refresh the content of an iframe (local HTML) by clicking on buttons

When a user clicks on a button, I am loading an HTML file into a DIV (iframe). The issue arises when the user clicks another button and wants to reload the iframe with a different HTML file. This is the current code snippet: <script type="text/javasc ...

Transferring data from a FreeMarker template page to a servlet controller

I am new to servlets and FreeMarker (.ftl) templates, so there may be some guesswork involved. I need to send a value from a webpage to my servlet. Here's what I have tried: FTL code: <form action="someAcction.spring" method="post"> <i ...

Upon reaching a specific milestone on the page, automatically scroll to the designated anchor point

Here's the deal: I plan to showcase 4 divs on my page. Each div will have a specific height (around 1500px) but will span the full width of the screen. To add some flair, each div will be a different color. My goal is for JavaScript to kick in once ...

How to utilize variables in Bootstrap 4?

After migrating from Bootstrap 3 to Bootstrap 4 and utilizing sass sources that I compile on the go, I encountered an issue with media switches. Specifically, for @media screen and (min-width: $screen-md-min) { padding: 40px 50px; } An error message ...

Ways to position two images in the center

A website has been created by me and now I am looking to center text on the two images in the header. Here is the relevant code snippet: <div class="header"> <img src="css/title578145459.png" class="headerImage left&qu ...

Updating the color of text inside columns using JQuery

I've been working on a webpage with three columns, each containing a group of squares representing different colors. When a user clicks on a color square in column 1, the text within that column changes to that color. The same goes for columns 2 and 3 ...

Unable to get spacing correct on loading page

My attempt at creating a loading page using CSS and HTML has hit a roadblock. I'm trying to show a loading bar that ranges from 0% to 100%. Despite my use of justify-content: space-between, I can't seem to get it right. I've searched through ...