centering text in li inside of ul in a div





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















hi i want to my text be in the center of the li inside of the ul in a div
but no matter what do i do i can't get it fixed



i can't find the problem



this is my html code



<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initil-scall=1.0">
<title>Template</title>
<link rel="stylesheet" href="test.css" type="text/css">
</head>
<body>
<div id="menu">
<header>
<nav>
<div id="qw" class="navigation">
<ul>
<li><a href="#">خانه</a></li>
<li><a href="#">خدمات</a></li>
<li><a href="#">درباره ما</a></li>
<li><a href="#">تماس با ما</a></li>
<li><a href="#">اموزش ها</a></li>
</ul>
</div>
</nav>
</header>
</div>
</body>
</html>


and this is my css code



body {
background: url("images (1).jpg") no-repeat center center fixed;
-webkit-background-size: cover;
-o-background-size: cover;
-moz-background-size: cover;
background-size: cover;
-ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoder(src='images.jpg', sizingMethod='scale')";
}

header nav {
width: 100%;
height: 60px;
top: 0;
right: 0;
line-height: 55px;
border-bottom: #9f4f89;
position: fixed;
z-index: 999999;
background: #d39fb7;
}
header nav #qw {
background: transparent url("") no-repeat left 5px;
}

header nav #qw ul {
list-style: none;
text-align: center;
}

header nav #qw li {
height: 2em;
float: right;
padding: auto;

}

header nav #qw ul li {
display: inline-block;
float: right;

}

header nav #qw ul li a {
padding: 32px 32px 7px 7px;
font-size: 20px;
margin: auto;
text-decoration: none;
text-align: center;
border-left: 1px solid #fff;
color: #ffffff;
}


with this code the text are in the left bottom of the elements but i want them to be in the center of the element










share|improve this question


















  • 1





    remove` float:right` from li tag

    – Manish Patel
    Nov 16 '18 at 12:18


















0















hi i want to my text be in the center of the li inside of the ul in a div
but no matter what do i do i can't get it fixed



i can't find the problem



this is my html code



<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initil-scall=1.0">
<title>Template</title>
<link rel="stylesheet" href="test.css" type="text/css">
</head>
<body>
<div id="menu">
<header>
<nav>
<div id="qw" class="navigation">
<ul>
<li><a href="#">خانه</a></li>
<li><a href="#">خدمات</a></li>
<li><a href="#">درباره ما</a></li>
<li><a href="#">تماس با ما</a></li>
<li><a href="#">اموزش ها</a></li>
</ul>
</div>
</nav>
</header>
</div>
</body>
</html>


and this is my css code



body {
background: url("images (1).jpg") no-repeat center center fixed;
-webkit-background-size: cover;
-o-background-size: cover;
-moz-background-size: cover;
background-size: cover;
-ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoder(src='images.jpg', sizingMethod='scale')";
}

header nav {
width: 100%;
height: 60px;
top: 0;
right: 0;
line-height: 55px;
border-bottom: #9f4f89;
position: fixed;
z-index: 999999;
background: #d39fb7;
}
header nav #qw {
background: transparent url("") no-repeat left 5px;
}

header nav #qw ul {
list-style: none;
text-align: center;
}

header nav #qw li {
height: 2em;
float: right;
padding: auto;

}

header nav #qw ul li {
display: inline-block;
float: right;

}

header nav #qw ul li a {
padding: 32px 32px 7px 7px;
font-size: 20px;
margin: auto;
text-decoration: none;
text-align: center;
border-left: 1px solid #fff;
color: #ffffff;
}


with this code the text are in the left bottom of the elements but i want them to be in the center of the element










share|improve this question


















  • 1





    remove` float:right` from li tag

    – Manish Patel
    Nov 16 '18 at 12:18














0












0








0








hi i want to my text be in the center of the li inside of the ul in a div
but no matter what do i do i can't get it fixed



i can't find the problem



this is my html code



<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initil-scall=1.0">
<title>Template</title>
<link rel="stylesheet" href="test.css" type="text/css">
</head>
<body>
<div id="menu">
<header>
<nav>
<div id="qw" class="navigation">
<ul>
<li><a href="#">خانه</a></li>
<li><a href="#">خدمات</a></li>
<li><a href="#">درباره ما</a></li>
<li><a href="#">تماس با ما</a></li>
<li><a href="#">اموزش ها</a></li>
</ul>
</div>
</nav>
</header>
</div>
</body>
</html>


and this is my css code



body {
background: url("images (1).jpg") no-repeat center center fixed;
-webkit-background-size: cover;
-o-background-size: cover;
-moz-background-size: cover;
background-size: cover;
-ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoder(src='images.jpg', sizingMethod='scale')";
}

header nav {
width: 100%;
height: 60px;
top: 0;
right: 0;
line-height: 55px;
border-bottom: #9f4f89;
position: fixed;
z-index: 999999;
background: #d39fb7;
}
header nav #qw {
background: transparent url("") no-repeat left 5px;
}

header nav #qw ul {
list-style: none;
text-align: center;
}

header nav #qw li {
height: 2em;
float: right;
padding: auto;

}

header nav #qw ul li {
display: inline-block;
float: right;

}

header nav #qw ul li a {
padding: 32px 32px 7px 7px;
font-size: 20px;
margin: auto;
text-decoration: none;
text-align: center;
border-left: 1px solid #fff;
color: #ffffff;
}


with this code the text are in the left bottom of the elements but i want them to be in the center of the element










share|improve this question














hi i want to my text be in the center of the li inside of the ul in a div
but no matter what do i do i can't get it fixed



i can't find the problem



this is my html code



<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initil-scall=1.0">
<title>Template</title>
<link rel="stylesheet" href="test.css" type="text/css">
</head>
<body>
<div id="menu">
<header>
<nav>
<div id="qw" class="navigation">
<ul>
<li><a href="#">خانه</a></li>
<li><a href="#">خدمات</a></li>
<li><a href="#">درباره ما</a></li>
<li><a href="#">تماس با ما</a></li>
<li><a href="#">اموزش ها</a></li>
</ul>
</div>
</nav>
</header>
</div>
</body>
</html>


and this is my css code



body {
background: url("images (1).jpg") no-repeat center center fixed;
-webkit-background-size: cover;
-o-background-size: cover;
-moz-background-size: cover;
background-size: cover;
-ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoder(src='images.jpg', sizingMethod='scale')";
}

header nav {
width: 100%;
height: 60px;
top: 0;
right: 0;
line-height: 55px;
border-bottom: #9f4f89;
position: fixed;
z-index: 999999;
background: #d39fb7;
}
header nav #qw {
background: transparent url("") no-repeat left 5px;
}

header nav #qw ul {
list-style: none;
text-align: center;
}

header nav #qw li {
height: 2em;
float: right;
padding: auto;

}

header nav #qw ul li {
display: inline-block;
float: right;

}

header nav #qw ul li a {
padding: 32px 32px 7px 7px;
font-size: 20px;
margin: auto;
text-decoration: none;
text-align: center;
border-left: 1px solid #fff;
color: #ffffff;
}


with this code the text are in the left bottom of the elements but i want them to be in the center of the element







html css html-lists






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 16 '18 at 12:16









Atefeh HeshmatiAtefeh Heshmati

62




62








  • 1





    remove` float:right` from li tag

    – Manish Patel
    Nov 16 '18 at 12:18














  • 1





    remove` float:right` from li tag

    – Manish Patel
    Nov 16 '18 at 12:18








1




1





remove` float:right` from li tag

– Manish Patel
Nov 16 '18 at 12:18





remove` float:right` from li tag

– Manish Patel
Nov 16 '18 at 12:18












2 Answers
2






active

oldest

votes


















0














Removefloat:right from li tag and add display:inline-block in a tag






body {
background: url("images (1).jpg") no-repeat center center fixed;
-webkit-background-size: cover;
-o-background-size: cover;
-moz-background-size: cover;
background-size: cover;
-ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoder(src='images.jpg', sizingMethod='scale')";
}

header nav {
width: 100%;
height: 60px;
top: 0;
right: 0;
line-height: 55px;
border-bottom: #9f4f89;
position: fixed;
z-index: 999999;
background: #d39fb7;
}
header nav #qw {
background: transparent url("") no-repeat left 5px;
}

header nav #qw ul {
list-style: none;
text-align: center;
}

header nav #qw li {
height: 2em;
padding: auto;

}

header nav #qw ul li {
display: inline-block;
text-align: center;
}

header nav #qw ul li a {
padding: 0 20px;
font-size: 20px;
margin: auto;
text-decoration: none;
text-align: center;
border-left: 1px solid #fff;
color: #ffffff;
display: inline-block;
}

<div id="menu">
<header>
<nav>
<div id="qw" class="navigation">
<ul>
<li><a href="#">خانه</a></li>
<li><a href="#">خدمات</a></li>
<li><a href="#">درباره ما</a></li>
<li><a href="#">تماس با ما</a></li>
<li><a href="#">اموزش ها</a></li>
</ul>
</div>
</nav>
</header>
</div>








share|improve this answer































    0














    The padding you've set up for your links:



    header nav #qw ul li a {
    padding: 32px 32px 7px 7px;
    /* everything else that's already wrriten */
    }


    is causing the problem, since the order of the padding setting goes:



    padding: top right bottom left;


    so to properly center the text inside of the li, you should change the padding to:



    header nav #qw ul li a {
    padding: 32px 32px 7px 32px;
    /* everything else that's already wrriten */
    }


    or, if you wanted the top and bottom padding to be the same, and the left and right padding to be the same, then:



    header nav #qw ul li a {
    padding: 7px 32px 7px 32px;
    /* everything else that's already wrriten */
    }


    This would fix your problem.



    P.S. you could also remove float: right; from:



    header nav #qw ul li {
    display: inline;
    float: right; /* <- this part is not needed. */
    }





    share|improve this answer
























      Your Answer






      StackExchange.ifUsing("editor", function () {
      StackExchange.using("externalEditor", function () {
      StackExchange.using("snippets", function () {
      StackExchange.snippets.init();
      });
      });
      }, "code-snippets");

      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "1"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53337752%2fcentering-text-in-li-inside-of-ul-in-a-div%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0














      Removefloat:right from li tag and add display:inline-block in a tag






      body {
      background: url("images (1).jpg") no-repeat center center fixed;
      -webkit-background-size: cover;
      -o-background-size: cover;
      -moz-background-size: cover;
      background-size: cover;
      -ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoder(src='images.jpg', sizingMethod='scale')";
      }

      header nav {
      width: 100%;
      height: 60px;
      top: 0;
      right: 0;
      line-height: 55px;
      border-bottom: #9f4f89;
      position: fixed;
      z-index: 999999;
      background: #d39fb7;
      }
      header nav #qw {
      background: transparent url("") no-repeat left 5px;
      }

      header nav #qw ul {
      list-style: none;
      text-align: center;
      }

      header nav #qw li {
      height: 2em;
      padding: auto;

      }

      header nav #qw ul li {
      display: inline-block;
      text-align: center;
      }

      header nav #qw ul li a {
      padding: 0 20px;
      font-size: 20px;
      margin: auto;
      text-decoration: none;
      text-align: center;
      border-left: 1px solid #fff;
      color: #ffffff;
      display: inline-block;
      }

      <div id="menu">
      <header>
      <nav>
      <div id="qw" class="navigation">
      <ul>
      <li><a href="#">خانه</a></li>
      <li><a href="#">خدمات</a></li>
      <li><a href="#">درباره ما</a></li>
      <li><a href="#">تماس با ما</a></li>
      <li><a href="#">اموزش ها</a></li>
      </ul>
      </div>
      </nav>
      </header>
      </div>








      share|improve this answer




























        0














        Removefloat:right from li tag and add display:inline-block in a tag






        body {
        background: url("images (1).jpg") no-repeat center center fixed;
        -webkit-background-size: cover;
        -o-background-size: cover;
        -moz-background-size: cover;
        background-size: cover;
        -ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoder(src='images.jpg', sizingMethod='scale')";
        }

        header nav {
        width: 100%;
        height: 60px;
        top: 0;
        right: 0;
        line-height: 55px;
        border-bottom: #9f4f89;
        position: fixed;
        z-index: 999999;
        background: #d39fb7;
        }
        header nav #qw {
        background: transparent url("") no-repeat left 5px;
        }

        header nav #qw ul {
        list-style: none;
        text-align: center;
        }

        header nav #qw li {
        height: 2em;
        padding: auto;

        }

        header nav #qw ul li {
        display: inline-block;
        text-align: center;
        }

        header nav #qw ul li a {
        padding: 0 20px;
        font-size: 20px;
        margin: auto;
        text-decoration: none;
        text-align: center;
        border-left: 1px solid #fff;
        color: #ffffff;
        display: inline-block;
        }

        <div id="menu">
        <header>
        <nav>
        <div id="qw" class="navigation">
        <ul>
        <li><a href="#">خانه</a></li>
        <li><a href="#">خدمات</a></li>
        <li><a href="#">درباره ما</a></li>
        <li><a href="#">تماس با ما</a></li>
        <li><a href="#">اموزش ها</a></li>
        </ul>
        </div>
        </nav>
        </header>
        </div>








        share|improve this answer


























          0












          0








          0







          Removefloat:right from li tag and add display:inline-block in a tag






          body {
          background: url("images (1).jpg") no-repeat center center fixed;
          -webkit-background-size: cover;
          -o-background-size: cover;
          -moz-background-size: cover;
          background-size: cover;
          -ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoder(src='images.jpg', sizingMethod='scale')";
          }

          header nav {
          width: 100%;
          height: 60px;
          top: 0;
          right: 0;
          line-height: 55px;
          border-bottom: #9f4f89;
          position: fixed;
          z-index: 999999;
          background: #d39fb7;
          }
          header nav #qw {
          background: transparent url("") no-repeat left 5px;
          }

          header nav #qw ul {
          list-style: none;
          text-align: center;
          }

          header nav #qw li {
          height: 2em;
          padding: auto;

          }

          header nav #qw ul li {
          display: inline-block;
          text-align: center;
          }

          header nav #qw ul li a {
          padding: 0 20px;
          font-size: 20px;
          margin: auto;
          text-decoration: none;
          text-align: center;
          border-left: 1px solid #fff;
          color: #ffffff;
          display: inline-block;
          }

          <div id="menu">
          <header>
          <nav>
          <div id="qw" class="navigation">
          <ul>
          <li><a href="#">خانه</a></li>
          <li><a href="#">خدمات</a></li>
          <li><a href="#">درباره ما</a></li>
          <li><a href="#">تماس با ما</a></li>
          <li><a href="#">اموزش ها</a></li>
          </ul>
          </div>
          </nav>
          </header>
          </div>








          share|improve this answer













          Removefloat:right from li tag and add display:inline-block in a tag






          body {
          background: url("images (1).jpg") no-repeat center center fixed;
          -webkit-background-size: cover;
          -o-background-size: cover;
          -moz-background-size: cover;
          background-size: cover;
          -ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoder(src='images.jpg', sizingMethod='scale')";
          }

          header nav {
          width: 100%;
          height: 60px;
          top: 0;
          right: 0;
          line-height: 55px;
          border-bottom: #9f4f89;
          position: fixed;
          z-index: 999999;
          background: #d39fb7;
          }
          header nav #qw {
          background: transparent url("") no-repeat left 5px;
          }

          header nav #qw ul {
          list-style: none;
          text-align: center;
          }

          header nav #qw li {
          height: 2em;
          padding: auto;

          }

          header nav #qw ul li {
          display: inline-block;
          text-align: center;
          }

          header nav #qw ul li a {
          padding: 0 20px;
          font-size: 20px;
          margin: auto;
          text-decoration: none;
          text-align: center;
          border-left: 1px solid #fff;
          color: #ffffff;
          display: inline-block;
          }

          <div id="menu">
          <header>
          <nav>
          <div id="qw" class="navigation">
          <ul>
          <li><a href="#">خانه</a></li>
          <li><a href="#">خدمات</a></li>
          <li><a href="#">درباره ما</a></li>
          <li><a href="#">تماس با ما</a></li>
          <li><a href="#">اموزش ها</a></li>
          </ul>
          </div>
          </nav>
          </header>
          </div>








          body {
          background: url("images (1).jpg") no-repeat center center fixed;
          -webkit-background-size: cover;
          -o-background-size: cover;
          -moz-background-size: cover;
          background-size: cover;
          -ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoder(src='images.jpg', sizingMethod='scale')";
          }

          header nav {
          width: 100%;
          height: 60px;
          top: 0;
          right: 0;
          line-height: 55px;
          border-bottom: #9f4f89;
          position: fixed;
          z-index: 999999;
          background: #d39fb7;
          }
          header nav #qw {
          background: transparent url("") no-repeat left 5px;
          }

          header nav #qw ul {
          list-style: none;
          text-align: center;
          }

          header nav #qw li {
          height: 2em;
          padding: auto;

          }

          header nav #qw ul li {
          display: inline-block;
          text-align: center;
          }

          header nav #qw ul li a {
          padding: 0 20px;
          font-size: 20px;
          margin: auto;
          text-decoration: none;
          text-align: center;
          border-left: 1px solid #fff;
          color: #ffffff;
          display: inline-block;
          }

          <div id="menu">
          <header>
          <nav>
          <div id="qw" class="navigation">
          <ul>
          <li><a href="#">خانه</a></li>
          <li><a href="#">خدمات</a></li>
          <li><a href="#">درباره ما</a></li>
          <li><a href="#">تماس با ما</a></li>
          <li><a href="#">اموزش ها</a></li>
          </ul>
          </div>
          </nav>
          </header>
          </div>





          body {
          background: url("images (1).jpg") no-repeat center center fixed;
          -webkit-background-size: cover;
          -o-background-size: cover;
          -moz-background-size: cover;
          background-size: cover;
          -ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoder(src='images.jpg', sizingMethod='scale')";
          }

          header nav {
          width: 100%;
          height: 60px;
          top: 0;
          right: 0;
          line-height: 55px;
          border-bottom: #9f4f89;
          position: fixed;
          z-index: 999999;
          background: #d39fb7;
          }
          header nav #qw {
          background: transparent url("") no-repeat left 5px;
          }

          header nav #qw ul {
          list-style: none;
          text-align: center;
          }

          header nav #qw li {
          height: 2em;
          padding: auto;

          }

          header nav #qw ul li {
          display: inline-block;
          text-align: center;
          }

          header nav #qw ul li a {
          padding: 0 20px;
          font-size: 20px;
          margin: auto;
          text-decoration: none;
          text-align: center;
          border-left: 1px solid #fff;
          color: #ffffff;
          display: inline-block;
          }

          <div id="menu">
          <header>
          <nav>
          <div id="qw" class="navigation">
          <ul>
          <li><a href="#">خانه</a></li>
          <li><a href="#">خدمات</a></li>
          <li><a href="#">درباره ما</a></li>
          <li><a href="#">تماس با ما</a></li>
          <li><a href="#">اموزش ها</a></li>
          </ul>
          </div>
          </nav>
          </header>
          </div>






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 16 '18 at 12:20









          Manish PatelManish Patel

          3,2691721




          3,2691721

























              0














              The padding you've set up for your links:



              header nav #qw ul li a {
              padding: 32px 32px 7px 7px;
              /* everything else that's already wrriten */
              }


              is causing the problem, since the order of the padding setting goes:



              padding: top right bottom left;


              so to properly center the text inside of the li, you should change the padding to:



              header nav #qw ul li a {
              padding: 32px 32px 7px 32px;
              /* everything else that's already wrriten */
              }


              or, if you wanted the top and bottom padding to be the same, and the left and right padding to be the same, then:



              header nav #qw ul li a {
              padding: 7px 32px 7px 32px;
              /* everything else that's already wrriten */
              }


              This would fix your problem.



              P.S. you could also remove float: right; from:



              header nav #qw ul li {
              display: inline;
              float: right; /* <- this part is not needed. */
              }





              share|improve this answer




























                0














                The padding you've set up for your links:



                header nav #qw ul li a {
                padding: 32px 32px 7px 7px;
                /* everything else that's already wrriten */
                }


                is causing the problem, since the order of the padding setting goes:



                padding: top right bottom left;


                so to properly center the text inside of the li, you should change the padding to:



                header nav #qw ul li a {
                padding: 32px 32px 7px 32px;
                /* everything else that's already wrriten */
                }


                or, if you wanted the top and bottom padding to be the same, and the left and right padding to be the same, then:



                header nav #qw ul li a {
                padding: 7px 32px 7px 32px;
                /* everything else that's already wrriten */
                }


                This would fix your problem.



                P.S. you could also remove float: right; from:



                header nav #qw ul li {
                display: inline;
                float: right; /* <- this part is not needed. */
                }





                share|improve this answer


























                  0












                  0








                  0







                  The padding you've set up for your links:



                  header nav #qw ul li a {
                  padding: 32px 32px 7px 7px;
                  /* everything else that's already wrriten */
                  }


                  is causing the problem, since the order of the padding setting goes:



                  padding: top right bottom left;


                  so to properly center the text inside of the li, you should change the padding to:



                  header nav #qw ul li a {
                  padding: 32px 32px 7px 32px;
                  /* everything else that's already wrriten */
                  }


                  or, if you wanted the top and bottom padding to be the same, and the left and right padding to be the same, then:



                  header nav #qw ul li a {
                  padding: 7px 32px 7px 32px;
                  /* everything else that's already wrriten */
                  }


                  This would fix your problem.



                  P.S. you could also remove float: right; from:



                  header nav #qw ul li {
                  display: inline;
                  float: right; /* <- this part is not needed. */
                  }





                  share|improve this answer













                  The padding you've set up for your links:



                  header nav #qw ul li a {
                  padding: 32px 32px 7px 7px;
                  /* everything else that's already wrriten */
                  }


                  is causing the problem, since the order of the padding setting goes:



                  padding: top right bottom left;


                  so to properly center the text inside of the li, you should change the padding to:



                  header nav #qw ul li a {
                  padding: 32px 32px 7px 32px;
                  /* everything else that's already wrriten */
                  }


                  or, if you wanted the top and bottom padding to be the same, and the left and right padding to be the same, then:



                  header nav #qw ul li a {
                  padding: 7px 32px 7px 32px;
                  /* everything else that's already wrriten */
                  }


                  This would fix your problem.



                  P.S. you could also remove float: right; from:



                  header nav #qw ul li {
                  display: inline;
                  float: right; /* <- this part is not needed. */
                  }






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 16 '18 at 13:40









                  Miles RayneMiles Rayne

                  246




                  246






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53337752%2fcentering-text-in-li-inside-of-ul-in-a-div%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      List item for chat from Array inside array React Native

                      Thiostrepton

                      Caerphilly