Aligning the Navigation Bar in the Middle

I am having trouble centering my navigation bar and making it horizontal on my online CV. Currently, it is vertical and positioned to the left of the page. Additionally, I would like to know how I can implement a flexbox or grid layout for my navigation bar.

#toolbar h3 {
    font-weight: bolder;
    font-style: italic;
    font-family: Baskerville;
    border: black;
    border-bottom-width: 100px;
    display: inline-flex;
    flex-direction: row;
    font-size: xx-large;
    text-transform: capitalize;
}

.nav{
    border:5px solid black;
    margin:0;
    padding:0;
    list-style-type: none;
   display: inline-block;
    flex-direction: column;
    color: black;
}


.nav li{
   display:flex;
    color: black;
    float: left;
}

.nav a{
    display:inline-block;
    padding:10px;
}

#toolbar{
    background-color: silver;
    overflow: hidden;
}
#toolbar a:hover {
    background-color: red;
    color: black;

}
<div id="toolbar">
    <p>
    <ul class="nav">
    <li><a href="#startAbout"><h3> About Me</h3></a></li>
    <li><a href="#startAcademic"><h3> Academic Profile</h3></a></li>
    <li><a href="#startExperience"><h3> Past Experience</h3></a></li>
</ul>
    </p>
</div> 

Answer №1

I've noticed that your navigation bar is text-based rather than image-based. I encountered a similar issue while working on a recent project's website. My suggestion would be as follows:

  1. Instead of utilizing unordered lists, consolidate all elements into a single H3 tag. This will help in properly aligning the text.

  2. Assign a class or ID to this h3 element. If you anticipate using this navigation bar elsewhere, consider using a class. The name can be anything you prefer; for illustration purposes, let's go with navText.

  3. Now, incorporate the following code snippet into your CSS stylesheet:

    .navText { text-align: center; }

This approach should resolve the issue! In case it doesn't, consider utilizing the align CSS property and set it to center.

Wishing you a fantastic day ahead!

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

What is the best way to delete and add elements in a looped array using Javascript

i have a form similar to this one. https://i.sstatic.net/V7ivb.png how can I replace this form each time the country changes, by removing it and then appending it again from a looping array. If there is only one set of data, display an "Add Form" Button; ...

Capturing an image in a desired size with html2canvas and saving

I am looking to modify my code in order to generate an image with dimensions of 1080x1080px instead of the current size of 537x537px. How can I achieve this, and ensure that the downloaded image is also in high screenshot quality? <div class="for ...

The issue of Jquery .click event handler failing to work for class selector specifically in CHROME

Is there a way to achieve the same opacity effect on click as on mouseover? I've tried various selectors without success. Any help on this issue would be greatly appreciated. Thank you in advance! .container { position: absolute; background:url(&a ...

What is the most effective way to combine cells within an HTML table?

I am struggling with merging cells in the first row of a table. I would really appreciate some guidance on how to resolve this issue. Thank you. Here is the code snippet: <!DOCTYPE html> <html> <head> <style> </style> < ...

Creating a carousel of cards using JavaScript, CSS, and HTML

Here is a visual reference of what I'm attempting to achieve: https://i.stack.imgur.com/EoQYV.png I've been working on creating a carousel with cards, but I'm struggling to synchronize the button indicators with card advancement when clicke ...

Utilizing JavaScript values instead of relying on HTML values - a step-by-step guide

I am facing a challenge with 3 buttons that I have created: <button id="b1">0</button> <button id="b2">0</button> <button id="b3">0</button> Instead of retrieving the value from the HT ...

What is the best way to ensure that all rows in flexbox have the same number and dimensions as the first row?

My objective with flexbox was to evenly distribute the text across the width of the page. When I say 'evenly distributed', I mean: If there are 3 sections, the center of the text in each section should be at fifths of the webpage width. This is ...

What occurs when Click events are triggered on an <object> element?

I have set up a div, and inside that container, I embedded an SVG image using object (which I plan to manipulate later...). <div id="click-me"> some random Text <object data="some.svg" /> </div> Next, I added event listeners for t ...

Guide on how to turn off a checkbox "toggle switch" using JavaScript

Being relatively new to CSS and HTML, I recently experimented with creating a checkbox toggle switch using this resource. I now have a specific requirement to disable this toggle switch upon clicking a different button labeled 'Reset', making it ...

Serializing Form Data with Checkbox Array

I am currently utilizing JQuery to submit a form using the form.serialize method. However, within the same form, there is an array of checkboxes that are dynamically created by a PHP function. Here is the structure of the form: <form class="form" id="f ...

The min-vh-50 class in Bootstrap CSS is not working as anticipated

I need to create two rows containing buttons in each row (10 buttons each). My goal is to center these two rows on the page while ensuring they are not too close together. To achieve this, I used the min-vh-50 class on both rows to align them in the upper ...

How can I use jQuery to set up form validation for an input textfield?

Check out this code snippet: <form data-test="loginForm-container" novalidate="" method="POST" enctype="multipart/form-data"> <div class="css-o5d3v1 e1ovefus2"> <div data-test="guestForm-email-wrapper" class="e1ovefus1 css-yjv4po e1eu3s ...

Complex UL structure with nested LI items and both column and inline styling

I'm facing a challenge that seems insurmountable - I can't even begin to tackle it, so I don't have a polished solution to present. All I have is the source code and my goal. My task is to create a three-level UL structure. The top level sh ...

Is there a way to set the same href link for the active class in the navbar using bootstrap-vue?

I am currently utilizing this navbar. It works fine when the href links are unique, but I encounter an issue when two pages share the same link - the active class is applied to both list items with that link in the manner I have written. Vue.component(& ...

I am having trouble with my 'SELECT DISTINCT' command, it's not functioning correctly

When I attempted to populate my drop down menu with values from the database using 'Select DISTINCT', it only retrieved some of the data instead of all of it. Below is my PHP code: <? $sqlretrive = mysql_query("Select DISTINCT type from ...

CSS styling for the dropdown list in the content/option section

Can someone help me with a simple question I've been researching for hours without success? I'm trying to figure out how to style the content/option/popup of a dropdownlist on the right side of the 'open button' like in this screenshot ...

Avoid flickering of images by properly handling the object URL when setting the image source in an asynchronous pipe

Implementing a JWT authorized endpoint for images has made it impossible to directly link to image urls in HTML. To work around this issue, we have created an async pipe that loads the image with proper authorization (handled by an HTTP interceptor, not s ...

Ensuring User Input Integrity with JavaScript Prompt Validation

I need help with validating input from a Javascript prompt() in an external js file using HTML code. I know how to call the Javascript function and write the validation logic, but I'm unsure how to handle the prompt and user input in HTML. Do I need ...

Customize DataTables selector by modifying its frame, font, and alignment

I'm experiencing issues with customizing the page selector in DataTables. Although I managed to change the background color to black, the frame around it remains blue. The font color of unselected pages and the "Next" button also do not reflect the c ...

Minimizing the menu bar while scrolling down (bootstrap3)

Could anyone help me with creating a navigation-bar effect similar to the one seen on ? I want the bar to shrink and the logo to change after scrolling down my page. My website is built using bootstrap 3. Is there a simple way to achieve this effect with ...