Centering navigation tabs for a more cohesive design

Having trouble aligning the navigation tabs to the center on this navigation bar. Any assistance would be greatly appreciated as I've exhausted all my options.

----HTML----

<!doctype html>
<html lang=''>
<head>
   <meta charset='utf-8'>
   <meta http-equiv="X-UA-Compatible" content="IE=edge">
   <meta name="viewport" content="width=device-width, initial-scale=1">
   <link rel="stylesheet" href="styles.css">
   <script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
   <script src="script.js"></script>
   <title>CSS MenuMaker</title>
</head>
<body>

<div id='cssmenu'>
<ul>
   <li class='active'><a href='#'>Home</a></li>
   <li><a href='#'>Products</a></li>
   <li><a href='#'>Company</a></li>
   <li><a href='#'>Contact</a></li>
</ul>
</div>

</body>
<html>

----CSS----

   @import url(http://fonts.googleapis.com/css?family=Raleway);
#cssmenu,
#cssmenu ul,
#cssmenu ul li,
#cssmenu ul li a,
#cssmenu #menu-button {
  margin: 0;
  padding: 0;
  border: 0;
  list-style: none;
  line-height: 1;
  display: block;
  position: relative;
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}
#cssmenu:after,
#cssmenu > ul:after {
...

...

----JavaScript----

(function($) {

  $.fn.menumaker = function(options) {

      var cssmenu = $(this), settings = $.extend({
        title: "Menu",
        format: "dropdown",
        breakpoint: 768,
        sticky: false
      }, options);

      return this.each(function() {
        ...
        ...
      });
  };
})(jQuery);

(function($){
$(document).ready(function(){

$(document).ready(function() {
  $("#cssmenu").menumaker({
    title: "Menu",
    format: "dropdown"
  });

  $("#cssmenu a").each(function() {
    var linkTitle = $(this).text();
    $(this).attr('data-title', linkTitle);
  });
});

});
})(jQuery);

Answer №1

The problem lies in the presence of a class named "align-center"

#cssmenu.align-center > ul {
  font-size: 0;
   text-align: center;
}
#cssmenu.align-center > ul > li {
  display: inline-block;
  float:none;
}

However, it appears that this class is not being utilized. To rectify the issue, you simply need to add class="align-center" to your <div id="cssmenu">. This should be reflected as

<div id="cssmenu" class="align-center">
, save the changes and refresh the page. You can observe the desired outcome by visiting this link.

If this solution proved helpful, kindly mark this answer as checked. Thanks! :)

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

Help me retrieve Blob data from an image URL using JavaScript

I've come up with a solution, but it's taking too long. Let me share what I have so far. //------------ Image URL to Base64 -------------// function convertImgToBase64(url, callback, outputFormat){ var img = new Image(); img ...

Does TypeGraphQl have the capability to automatically format SQL queries?

I am utilizing TypeORM in conjunction with TypeGraphQL. I am curious about the SQL query result that TypeGraphQL provides. For instance, if I have a User Table with numerous columns and a simple resolver like this: @Resolver() class UserResolver { @Q ...

I am facing an issue where an AJAX post to Express is not returning any data to req.query. I have tried various solutions but nothing seems to

I have encountered an issue with my setup where the body is empty when sending data through ajax. In Chrome's network tab, I can see the post and content with the correct payload: {"EventName":"asd","PrivacyLevel":1,"TypeInt":1,"ExpectedDate":"asd"," ...

How can you call a function in ExpressJS that is located in a different file?

I am having trouble with my UserController and database configuration file db.js. I am trying to make a function in the UserController access a function in db.js. In my UserController, I have included var db = require('../config/db'); and within ...

Best practices for implementing APIs

As someone who is relatively new to working with API in web development, I am currently building a web application using Python/Django that relies on ajax jsonp requests to the giantbomb API. Through this process, I have realized the importance of improvin ...

Iterate through the JSON information and present it in a table located within a modal

I'm encountering an issue with looping through a JSON object and displaying specific values in a table. The table includes a view button for each row, which, when clicked by the user, triggers the appearance of a modal. Although I can successfully dis ...

React does not recognize .map as a function

I'm currently developing a small application that retrieves data from a JSON file containing game scores. However, I've run into an issue where I'm getting the following error: games.map is not a function. I checked a similar post on Stack O ...

Flyer - Chart "dimmed" and unselectable when dimensions are specified as a proportion

I am currently working on displaying a map within a container. I have successfully been able to display the map by setting its size to a specified number of pixels. However, my goal is to have the height of the map adapt to the size of the container dynami ...

When using jQuery to select elements of a specific class, make sure to exclude the element that triggered the

A dynamic number of divs are generated from a data source. Each div contains an image button and another div with text. While the actual scenario is more complex, we can present a simplified version: <div id="main"> <div id="content_block_1" ...

Outdated syntax for req.param in Express is now deprecated

I encountered an error on Node.js while working with some JavaScript code. The error message says: express deprecated req.param(name): Use req.params, req.body, Below is the relevant code snippet: response.render('pages/' + displayPage, { ...

Having trouble getting the carousel slider to function properly on meteor?

I am currently working on my portfolio page using Meteor, and I want to include a carousel slider gallery. The problem I'm facing is that while the first gallery works fine, the second one does not load correctly and just displays a list of pictures. ...

encountered an error when attempting to utilize the Google Index API in JavaScript

Greetings everyone, I am interested in creating a script that updates the new URLs of my website using the Google Indexing API from http://localhost:8000/test.html. I have added http://localhost:8000 to Authorized JavaScript origins in the client ID, but I ...

Using TypeScript to spread props in React

Here is some code snippet that I've been working with: type WrapperProps = { wrapperProp: string }; const Wrapper: React.FC<WrapperProps> = ({ children }) => <div>{children}</div>; type MyCmpnntProps = { myCmpnntProp: string }; ...

What is the best way to check the CSS attributes of a React component with react-testing-library?

I understand the philosophy behind the react-testing-library, but I am having difficulty implementing it with CSS properties. For instance, consider a basic toggle component that changes its background color when clicked: import React, { useState } from ...

Selecting multiple options in an input

I've been searching for the error but can't seem to find it. I checked multiple examples and they all seem to have it the same way. However, I keep getting the following error message: Warning: Invalid argument supplied for foreach() in whatev ...

What is the process for including an additional bar in a Google bar chart?

Trying to enhance my google bar chart by adding an extra horizontal bar, but facing challenges in integrating it smoothly with the existing chart. JS Code <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> ...

Increase values on the global React context state using the map function

Can anyone assist me with incrementing a value using the map function in React's context API? To better illustrate, let's consider the following example: Suppose we have items: const [items, setItems] = useContext(ItemsContext) These items are J ...

The background of an HTML button does not appear in IE8

My buttons are not showing up in IE8. I tried adding background: transparent url('..'), but it didn't help. Here is the code: .wpcf7 input.wpcf7-submit { background: url("/wp-content/themes/ASC/images/<?=ICL_LANGUAGE_CODE;?>_submi ...

In need of finding child elements that have a specific directive in AngularJS?

As I create an AngularJS directive that is restricted to an attribute, my goal is to manipulate specific child elements of the element. Currently, I am selecting the elements I need to work with using this method: var subMenus = angular.element(element.c ...

Encountering difficulties in importing TailwindCSS

Having trouble importing TailwindCSS and applying CSS? Here's how it's included in my package.json: "devDependencies": { "autoprefixer": "^10.2.4", "css-loader": "^5.1.1", "postc ...