0

I am trying to do something I think is pretty easy but clearly making a pigs ears of it. Here is my fiddle

I have a button and a label on display. I want to centre the label in the middle of the div, so horizontally and vertically centred.

I can centre it horizontally but not vertically. So I have tried a few things but nothing seems to centre the label vertically, even the vertical-align I use below. Not really sure why though?

.headerLbl {
   text-align: center;
   font-weight: bold;
   color: white;
   font-size: 14pt; 
   display: block;
   vertical-align: central;
}
Jesse
  • 3,522
  • 6
  • 25
  • 40
mHelpMe
  • 6,336
  • 24
  • 75
  • 150

1 Answers1

1

You need to add following styles into your code:

.menu {  
  background-color: #9FACEC;    /* Medium blue */
  position: fixed;
  width: 100%;
  margin: 0;
  z-index: 1;
  display:flex;
  justify-content: center;
}

.headerLbl {
   align-self: center;
   width: 90%;
   text-align: center;
}

It shouldn't. Notice the width with label.

Charu Maheshwari
  • 1,583
  • 1
  • 8
  • 9