Jump to content

How to make navigation top menu align to center ?


Recommended Posts

in css use these styles:

#nav li, #nav a {text-align:center!important; display:inline-block; float:none;}
#nav li {text-align:center!important;}

effect

zWefH7U.png

Hi vekia,

 

A doubt... the file is this one : /prestahop/theme/mytheme/css/global.css? 

 

And should we look and modify  or add this all:

#nav li, #nav a {text-align:center!important; display:inline-block; float:none;}

#nav li {text-align:center!important;}

 

Thanks again for you help.

Link to comment
Share on other sites

you can paste it (code that i suggested to use) in global.css file at the end of the file

 Hi!

 

I did it , but not working. (clear cache)

 

I placed in this file /prestahop/theme/mytheme/css/global.css at the end of this file your code:

 

#nav li, #nav a {
text-align:center!important; 
display:inline-block; 
float:none;
}
 
#nav li {
text-align:center!important;
}

 

any suggestion, please?

 

(presta 1.6, theme default)

Link to comment
Share on other sites

Hi apislerr,

 

Go to /themes/classicshop/css/classic/fish_menu.css

 

Under /* All Levels */ /* Style consistent throughout all nav levels */, 

 

change the #nav li

 

From: #nav li { position:relative; text-align:left; }

 

To: #nav li {display: inline-block; position:relative; text-align: center; }

 

And under /* 0 Level */,

 

change the #nav li

 

From: #nav li { float: left; padding-right: 2px; }

 

To: #nav li { padding-right: 2px; }

 

 

Atomic Penguins

Link to comment
Share on other sites

Hi Guid,

 

Go to /themes/default-bootstrap/css/modules/blocktopmenu/css/superfish-modified.css

 

Change the .sf-menu

 

From:

.sf-menu {

  position: relative;
  padding: 0;
  width: 100%;
  border-bottom: 3px solid #e9e9e9;
  background: #f6f6f6; }
 
To:
.sf-menu {
  text-align: center;
  padding: 0;
  width: 100%;
  border-bottom: 3px solid #e9e9e9;
  background: #f6f6f6; }

 

And under .sf-menu > li, delete float: left; and add in display:inline-block;

 

 

Atomic Penguins

  • Like 5
  • Thanks 1
Link to comment
Share on other sites

Hi Guid,

 

Go to /themes/default-bootstrap/css/modules/blocktopmenu/css/superfish-modified.css

 

Change the .sf-menu

 

From:

.sf-menu {

  position: relative;
  padding: 0;
  width: 100%;
  border-bottom: 3px solid #e9e9e9;
  background: #f6f6f6; }
 
To:
.sf-menu {
  text-align: center;
  padding: 0;
  width: 100%;
  border-bottom: 3px solid #e9e9e9;
  background: #f6f6f6; }

 

And under .sf-menu > li, delete float: left; and add in display:inline-block;

 

 

Atomic Penguins

 

Hi Atomic Penguins! 
 
Thanks a lot for your help, you SOLVED it! :D
...but i would like on smaller devices to keep the top menu like the original, i mean tabs on differents rows ( at least on phone devices)... could you help me about this please.
 
(I can't paste the image here?)
 
Thanks for helping.
Link to comment
Share on other sites

Hi Atomic! Thanks for quick answer!

 

Well, no, i didn't change any css code for the media query.

I just change my  /themes/default-bootstrap/css/modules/blocktopmenu/css/superfish-modified.css like you said so.

I double check.

 

After that, my top menu looks like your image on smaller devices!?

 

Link to comment
Share on other sites

Hi Guid,

 

I will assume that you have followed the steps on centering the menu in my past post.

 

Now for smaller devices:

 

Open the superfish-modified.css

 

Under .sf-menu > li, you can see a media query. It looks like this:

 

@media (max-width: 767px) {
    .sf-menu > li {
      float: none;
 /*float: left;*/
      position: relative;
      border-right: none; }
 
Remove all floats and add this code -> display: block;
 
 
Atomic Penguins
  • Like 1
Link to comment
Share on other sites

 

Hi Guid,

 

I will assume that you have followed the steps on centering the menu in my past post.

 

Now for smaller devices:

 

Open the superfish-modified.css

 

Under .sf-menu > li, you can see a media query. It looks like this:

 

@media (max-width: 767px) {
    .sf-menu > li {
      float: none;
 /*float: left;*/
      position: relative;
      border-right: none; }
 
Remove all floats and add this code -> display: block;
 
 
Atomic Penguins

 

 

 

Hi Atomic! Thanks again for quick answer! I followed yours steps on centering the top menu and...

 

YOU SOLVED IT!  :D

 

After that, my top menu looks ok on smaller devices!

 

You rock! Thanks a lot!

Link to comment
Share on other sites

  • 4 months later...

Hi Atomic, 

 

I tried your solution to center the top menu! it works great!

But then the sub menu text (in drop down) is also centered, how can I keep that aligned on the left (or in my case on the right as I use an RTL language)?

 

Thanks

Faty

Link to comment
Share on other sites

×
×
  • Create New...