Why won't my list align horizontally center

前端 未结 4 429
长发绾君心
长发绾君心 2021-01-28 04:32

I\'m working on a basic nav bar project, and I\'ve trying to get this list to align center. I\'ve tried using align-content and text-align, but my bar

4条回答
  •  广开言路
    2021-01-28 05:16

    Add the /* the follwoing lines */ to .banner

    margin-right:auto; margin-left:auto;

    Check the answer below:

    @import url(http://fonts.googleapis.com/css?family=Quicksand:300);
    
    #bannercontent{
    
    
    }
    
    
    
    #bannercontent {
      font-family: 'Quicksand:300';
      font-size: 25px;
     
     
    }
    .banner {
      list-style-type: none;
      margin: 0;
      padding: 0;
      background-color: grey;
      width: 560px;
      height: 40px;
      vertical-align: middle;
      
       /* the follwoing lines */
        margin-right:auto;
      margin-left:auto;
    }
    .links {
      text-decoration: none;
    }
    .links:hover {
      color: white;
    }
    .bannerlinks {
      display: inline;
      margin-right: 20px;
      border: 12px;
      border-color: black;
      background-position: 50% 50%;
    }

提交回复
热议问题