0

I have a quick question regarding some code i have here:

h1 {
    font - size: 65 px;
    color: orange;
    text - align: center;
    height: 20 px;
    font: Times;
}

h2 {
    text - align: center;
    font: Times;
}

ul {
    width: 1230 px;
    list - style - type: none;
    overflow: hidden;
    background - color: #C2C6DD;
    justify - content: center;
}

the h1 and h2 is the title of the webpage, which is centered. However th ul (navigation bar) is not centered I have tried many different tings like align-items, text-align, it always goes to the left of the page. Anybody can help to why?

enter image description here

Rob
  • 14,746
  • 28
  • 47
  • 65

3 Answers3

0

You try this code:

 ul{
  list-style-type:none;
  display:flex;
  justify-content: center;
  width: 100%;
  overflow: hidden;
  background-color: #C2C6DD;
  text-align: center;
}
Chandra Kumar
  • 4,127
  • 1
  • 17
  • 25
0

Try adding margin: 0 auto; to the ul:

ul {
    width: 1230px;
    list-style-type: none;
    overflow: hidden;
    background-color: #C2C6DD;
    margin: 0 auto;
}
nGAGE
  • 177
  • 1
  • 11
0

Try this out:

ul {
    width: 1230 px;
    list - style - type: none;
    overflow: hidden;
    background - color: #C2C6DD;
    justify - content: center;
    margin: 0 auto;
    text-align: center;
}