2

I developped this template which works fine here : https://template-admin-dom.herokuapp.com/6#

As you can see, the text in the top navbar is not centered. enter image description here

It seems easy but I can't do it.

This text has this class :

.wrapper .section .top_navbar .navbartitle{
font-size: 28px;
color: #f4fbff;
text-align: center;}

and the html is :

 <span class="text-truncate navbartitle">Title to center</span>

Can you inspect the page and help me ? I do not understand why it does not work.

Dom
  • 2,984
  • 3
  • 34
  • 64

5 Answers5

2

you can try this :

.wrapper .section .top_navbar .navbartitle
    {
       font-size: 28px; 
       color: #f4fbff;
       text-align: center;
       width:100%;
    }
Anonymous
  • 539
  • 2
  • 6
2

It doesn't center because the parent container is a flex container. One way to center the title is to add margin: auto to the element that has the navbartitle class:

enter image description here

Juan Marco
  • 3,081
  • 2
  • 28
  • 32
0

CSS

.wrapper .section .top_navbar .navbartitle
{
font-size: 28px;
color: #f4fbff;
padding-left: 250px;
}

HTML

<span class="text-truncate navbartitle">Title to center</span>
BiswajitPaloi
  • 586
  • 4
  • 16
0

The issue is that the element won't take full width due to flex. Here's a way to have it behave as desired:

.wrapper .section .top_navbar .navbartitle {
  flex-grow: 1;
}
TheRemoteCoder
  • 172
  • 2
  • 12
0

It doesn't center because it's a span in a flex container.

try turning the span into a div, and add this:

div.text-truncate.navbartitle {
  flex-grow: 1;
}
Diklou
  • 21
  • 6