Why the h4 is not horizontally aligned with the first item of the menu?












1















I have a menu with some items and below I have a container that has the h4 "Recents" and a button "Btn", the "Btn" appears at right aligned horizontally with the last item, its correct. However, the "Recents" is not horizontally aligned with the first item "Item 1" of the menu. Do you know why?



Example: http://jsfiddle.net/fbnoymc2/



HTML:



<div class="container-flex">
<div class="menu-row row">
<div class="col">
<div class="container">
<ul class="categories_menu">
<li class="list-item--hidden">
<a href="javascript:void(0)" name="category" id="">Item 1</a>
</li>
<li class="list-item--hidden">
<a href="javascript:void(0)" name="category" id="">Item 2</a>
</li>
<li class="list-item--hidden">
<a href="javascript:void(0)" name="category" id="">Item 3</a>
</li>
<li class="list-item--hidden">
<a href="javascript:void(0)" name="category" id="">Item 4</a>
</li>
<li class="list-item--hidden">
<a href="javascript:void(0)" name="category" id="">Item 5</a>
</li>
<li class="list-item--hidden">
<a href="javascript:void(0)" name="category" id="">Item 6</a>
</li>
<li class="list-item--hidden">
<a href="javascript:void(0)" name="category" id="">Item 7</a>
</li>
<li><a data-toggle="modal" id="" data-target="" href="">More
<i class="fa fa-caret-down" aria-hidden="true"></i></a></li>
</ul>
</div>
</div>
</div>
</div>

<div class="container py-3">
<div class="row align-items-center">
<div class="col">
<h4 class="display-5 font-weight-bold text-dark">Latest</h4>
</div>
<div class="col text-right">
<a href="" class="btn btn-primary justify-content-end">Btn</a>
</div>
</div>
</div>


CSS:



.categories_menu {
display: -moz-box;
display: -ms-flexbox;
display: flex;
width: 100%;
-moz-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
transition: all 100ms ease-out;
}

.categories_menu li {
-moz-box-align: center;
-ms-flex-align: center;
align-items: center;
border-bottom: 5px solid transparent;
-moz-box-sizing: border-box;
box-sizing: border-box;
display: -moz-box;
display: -ms-flexbox;
display: flex;
-moz-box-flex: 1;
-ms-flex: 1 1 auto;
flex: 1 1 auto;
height: 59px;
-moz-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
padding: 10px 0 5px 0;
border-left: 1px solid #e5f0fa;
}


.categories_menu li:last-child {
border-right: 1px solid #e5f0fa;
}


.categories_menu a {
color: #414e5f;
font-size: 18px;
font-weight: bold;
border-bottom: 5px solid transparent;
text-decoration: none;
}


.menu-row {
border-bottom: 1px solid #e5f0fa;
}

.menu-row ul {
margin-bottom: 0;
}









share|improve this question



























    1















    I have a menu with some items and below I have a container that has the h4 "Recents" and a button "Btn", the "Btn" appears at right aligned horizontally with the last item, its correct. However, the "Recents" is not horizontally aligned with the first item "Item 1" of the menu. Do you know why?



    Example: http://jsfiddle.net/fbnoymc2/



    HTML:



    <div class="container-flex">
    <div class="menu-row row">
    <div class="col">
    <div class="container">
    <ul class="categories_menu">
    <li class="list-item--hidden">
    <a href="javascript:void(0)" name="category" id="">Item 1</a>
    </li>
    <li class="list-item--hidden">
    <a href="javascript:void(0)" name="category" id="">Item 2</a>
    </li>
    <li class="list-item--hidden">
    <a href="javascript:void(0)" name="category" id="">Item 3</a>
    </li>
    <li class="list-item--hidden">
    <a href="javascript:void(0)" name="category" id="">Item 4</a>
    </li>
    <li class="list-item--hidden">
    <a href="javascript:void(0)" name="category" id="">Item 5</a>
    </li>
    <li class="list-item--hidden">
    <a href="javascript:void(0)" name="category" id="">Item 6</a>
    </li>
    <li class="list-item--hidden">
    <a href="javascript:void(0)" name="category" id="">Item 7</a>
    </li>
    <li><a data-toggle="modal" id="" data-target="" href="">More
    <i class="fa fa-caret-down" aria-hidden="true"></i></a></li>
    </ul>
    </div>
    </div>
    </div>
    </div>

    <div class="container py-3">
    <div class="row align-items-center">
    <div class="col">
    <h4 class="display-5 font-weight-bold text-dark">Latest</h4>
    </div>
    <div class="col text-right">
    <a href="" class="btn btn-primary justify-content-end">Btn</a>
    </div>
    </div>
    </div>


    CSS:



    .categories_menu {
    display: -moz-box;
    display: -ms-flexbox;
    display: flex;
    width: 100%;
    -moz-box-pack: justify;
    -ms-flex-pack: justify;
    justify-content: space-between;
    transition: all 100ms ease-out;
    }

    .categories_menu li {
    -moz-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    border-bottom: 5px solid transparent;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
    display: -moz-box;
    display: -ms-flexbox;
    display: flex;
    -moz-box-flex: 1;
    -ms-flex: 1 1 auto;
    flex: 1 1 auto;
    height: 59px;
    -moz-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    padding: 10px 0 5px 0;
    border-left: 1px solid #e5f0fa;
    }


    .categories_menu li:last-child {
    border-right: 1px solid #e5f0fa;
    }


    .categories_menu a {
    color: #414e5f;
    font-size: 18px;
    font-weight: bold;
    border-bottom: 5px solid transparent;
    text-decoration: none;
    }


    .menu-row {
    border-bottom: 1px solid #e5f0fa;
    }

    .menu-row ul {
    margin-bottom: 0;
    }









    share|improve this question

























      1












      1








      1








      I have a menu with some items and below I have a container that has the h4 "Recents" and a button "Btn", the "Btn" appears at right aligned horizontally with the last item, its correct. However, the "Recents" is not horizontally aligned with the first item "Item 1" of the menu. Do you know why?



      Example: http://jsfiddle.net/fbnoymc2/



      HTML:



      <div class="container-flex">
      <div class="menu-row row">
      <div class="col">
      <div class="container">
      <ul class="categories_menu">
      <li class="list-item--hidden">
      <a href="javascript:void(0)" name="category" id="">Item 1</a>
      </li>
      <li class="list-item--hidden">
      <a href="javascript:void(0)" name="category" id="">Item 2</a>
      </li>
      <li class="list-item--hidden">
      <a href="javascript:void(0)" name="category" id="">Item 3</a>
      </li>
      <li class="list-item--hidden">
      <a href="javascript:void(0)" name="category" id="">Item 4</a>
      </li>
      <li class="list-item--hidden">
      <a href="javascript:void(0)" name="category" id="">Item 5</a>
      </li>
      <li class="list-item--hidden">
      <a href="javascript:void(0)" name="category" id="">Item 6</a>
      </li>
      <li class="list-item--hidden">
      <a href="javascript:void(0)" name="category" id="">Item 7</a>
      </li>
      <li><a data-toggle="modal" id="" data-target="" href="">More
      <i class="fa fa-caret-down" aria-hidden="true"></i></a></li>
      </ul>
      </div>
      </div>
      </div>
      </div>

      <div class="container py-3">
      <div class="row align-items-center">
      <div class="col">
      <h4 class="display-5 font-weight-bold text-dark">Latest</h4>
      </div>
      <div class="col text-right">
      <a href="" class="btn btn-primary justify-content-end">Btn</a>
      </div>
      </div>
      </div>


      CSS:



      .categories_menu {
      display: -moz-box;
      display: -ms-flexbox;
      display: flex;
      width: 100%;
      -moz-box-pack: justify;
      -ms-flex-pack: justify;
      justify-content: space-between;
      transition: all 100ms ease-out;
      }

      .categories_menu li {
      -moz-box-align: center;
      -ms-flex-align: center;
      align-items: center;
      border-bottom: 5px solid transparent;
      -moz-box-sizing: border-box;
      box-sizing: border-box;
      display: -moz-box;
      display: -ms-flexbox;
      display: flex;
      -moz-box-flex: 1;
      -ms-flex: 1 1 auto;
      flex: 1 1 auto;
      height: 59px;
      -moz-box-pack: center;
      -ms-flex-pack: center;
      justify-content: center;
      padding: 10px 0 5px 0;
      border-left: 1px solid #e5f0fa;
      }


      .categories_menu li:last-child {
      border-right: 1px solid #e5f0fa;
      }


      .categories_menu a {
      color: #414e5f;
      font-size: 18px;
      font-weight: bold;
      border-bottom: 5px solid transparent;
      text-decoration: none;
      }


      .menu-row {
      border-bottom: 1px solid #e5f0fa;
      }

      .menu-row ul {
      margin-bottom: 0;
      }









      share|improve this question














      I have a menu with some items and below I have a container that has the h4 "Recents" and a button "Btn", the "Btn" appears at right aligned horizontally with the last item, its correct. However, the "Recents" is not horizontally aligned with the first item "Item 1" of the menu. Do you know why?



      Example: http://jsfiddle.net/fbnoymc2/



      HTML:



      <div class="container-flex">
      <div class="menu-row row">
      <div class="col">
      <div class="container">
      <ul class="categories_menu">
      <li class="list-item--hidden">
      <a href="javascript:void(0)" name="category" id="">Item 1</a>
      </li>
      <li class="list-item--hidden">
      <a href="javascript:void(0)" name="category" id="">Item 2</a>
      </li>
      <li class="list-item--hidden">
      <a href="javascript:void(0)" name="category" id="">Item 3</a>
      </li>
      <li class="list-item--hidden">
      <a href="javascript:void(0)" name="category" id="">Item 4</a>
      </li>
      <li class="list-item--hidden">
      <a href="javascript:void(0)" name="category" id="">Item 5</a>
      </li>
      <li class="list-item--hidden">
      <a href="javascript:void(0)" name="category" id="">Item 6</a>
      </li>
      <li class="list-item--hidden">
      <a href="javascript:void(0)" name="category" id="">Item 7</a>
      </li>
      <li><a data-toggle="modal" id="" data-target="" href="">More
      <i class="fa fa-caret-down" aria-hidden="true"></i></a></li>
      </ul>
      </div>
      </div>
      </div>
      </div>

      <div class="container py-3">
      <div class="row align-items-center">
      <div class="col">
      <h4 class="display-5 font-weight-bold text-dark">Latest</h4>
      </div>
      <div class="col text-right">
      <a href="" class="btn btn-primary justify-content-end">Btn</a>
      </div>
      </div>
      </div>


      CSS:



      .categories_menu {
      display: -moz-box;
      display: -ms-flexbox;
      display: flex;
      width: 100%;
      -moz-box-pack: justify;
      -ms-flex-pack: justify;
      justify-content: space-between;
      transition: all 100ms ease-out;
      }

      .categories_menu li {
      -moz-box-align: center;
      -ms-flex-align: center;
      align-items: center;
      border-bottom: 5px solid transparent;
      -moz-box-sizing: border-box;
      box-sizing: border-box;
      display: -moz-box;
      display: -ms-flexbox;
      display: flex;
      -moz-box-flex: 1;
      -ms-flex: 1 1 auto;
      flex: 1 1 auto;
      height: 59px;
      -moz-box-pack: center;
      -ms-flex-pack: center;
      justify-content: center;
      padding: 10px 0 5px 0;
      border-left: 1px solid #e5f0fa;
      }


      .categories_menu li:last-child {
      border-right: 1px solid #e5f0fa;
      }


      .categories_menu a {
      color: #414e5f;
      font-size: 18px;
      font-weight: bold;
      border-bottom: 5px solid transparent;
      text-decoration: none;
      }


      .menu-row {
      border-bottom: 1px solid #e5f0fa;
      }

      .menu-row ul {
      margin-bottom: 0;
      }






      css twitter-bootstrap






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 21 '18 at 16:20









      user10676579user10676579

      685




      685
























          2 Answers
          2






          active

          oldest

          votes


















          0














          You need to reset the menu list styles to remove any default padding and margin they start with - add the following to the categories_menu:



          .categories_menu {
          padding:0;
          margin:0;
          }




          Updated fiddle






          share|improve this answer































            0














            You have by default padding-inline-start: 40px; in ul, menu, dir in your user agent stylesheet you can add padding-left: 0; to .categories_menu.



            .categories_menu {
            padding-left: 0; //add this rule
            }


            My recommendation is to use or create a default reset.css. A CSS Reset (or “Reset CSS”) is a short, often compressed (minified) set of CSS rules that resets the styling of all HTML elements to a consistent baseline.



            In case you didn’t know, every browser has its own default ‘user agent’ stylesheet, that it uses to make unstyled websites appear more legible. For example, most browsers by default make links blue and visited links purple, give tables a certain amount of border and padding, apply variable font-sizes to H1, H2, H3 etc. and a certain amount of padding to almost everything.



            Working fiddle






            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%2f53416364%2fwhy-the-h4-is-not-horizontally-aligned-with-the-first-item-of-the-menu%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














              You need to reset the menu list styles to remove any default padding and margin they start with - add the following to the categories_menu:



              .categories_menu {
              padding:0;
              margin:0;
              }




              Updated fiddle






              share|improve this answer




























                0














                You need to reset the menu list styles to remove any default padding and margin they start with - add the following to the categories_menu:



                .categories_menu {
                padding:0;
                margin:0;
                }




                Updated fiddle






                share|improve this answer


























                  0












                  0








                  0







                  You need to reset the menu list styles to remove any default padding and margin they start with - add the following to the categories_menu:



                  .categories_menu {
                  padding:0;
                  margin:0;
                  }




                  Updated fiddle






                  share|improve this answer













                  You need to reset the menu list styles to remove any default padding and margin they start with - add the following to the categories_menu:



                  .categories_menu {
                  padding:0;
                  margin:0;
                  }




                  Updated fiddle







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 21 '18 at 16:26









                  PetePete

                  41.9k1879120




                  41.9k1879120

























                      0














                      You have by default padding-inline-start: 40px; in ul, menu, dir in your user agent stylesheet you can add padding-left: 0; to .categories_menu.



                      .categories_menu {
                      padding-left: 0; //add this rule
                      }


                      My recommendation is to use or create a default reset.css. A CSS Reset (or “Reset CSS”) is a short, often compressed (minified) set of CSS rules that resets the styling of all HTML elements to a consistent baseline.



                      In case you didn’t know, every browser has its own default ‘user agent’ stylesheet, that it uses to make unstyled websites appear more legible. For example, most browsers by default make links blue and visited links purple, give tables a certain amount of border and padding, apply variable font-sizes to H1, H2, H3 etc. and a certain amount of padding to almost everything.



                      Working fiddle






                      share|improve this answer






























                        0














                        You have by default padding-inline-start: 40px; in ul, menu, dir in your user agent stylesheet you can add padding-left: 0; to .categories_menu.



                        .categories_menu {
                        padding-left: 0; //add this rule
                        }


                        My recommendation is to use or create a default reset.css. A CSS Reset (or “Reset CSS”) is a short, often compressed (minified) set of CSS rules that resets the styling of all HTML elements to a consistent baseline.



                        In case you didn’t know, every browser has its own default ‘user agent’ stylesheet, that it uses to make unstyled websites appear more legible. For example, most browsers by default make links blue and visited links purple, give tables a certain amount of border and padding, apply variable font-sizes to H1, H2, H3 etc. and a certain amount of padding to almost everything.



                        Working fiddle






                        share|improve this answer




























                          0












                          0








                          0







                          You have by default padding-inline-start: 40px; in ul, menu, dir in your user agent stylesheet you can add padding-left: 0; to .categories_menu.



                          .categories_menu {
                          padding-left: 0; //add this rule
                          }


                          My recommendation is to use or create a default reset.css. A CSS Reset (or “Reset CSS”) is a short, often compressed (minified) set of CSS rules that resets the styling of all HTML elements to a consistent baseline.



                          In case you didn’t know, every browser has its own default ‘user agent’ stylesheet, that it uses to make unstyled websites appear more legible. For example, most browsers by default make links blue and visited links purple, give tables a certain amount of border and padding, apply variable font-sizes to H1, H2, H3 etc. and a certain amount of padding to almost everything.



                          Working fiddle






                          share|improve this answer















                          You have by default padding-inline-start: 40px; in ul, menu, dir in your user agent stylesheet you can add padding-left: 0; to .categories_menu.



                          .categories_menu {
                          padding-left: 0; //add this rule
                          }


                          My recommendation is to use or create a default reset.css. A CSS Reset (or “Reset CSS”) is a short, often compressed (minified) set of CSS rules that resets the styling of all HTML elements to a consistent baseline.



                          In case you didn’t know, every browser has its own default ‘user agent’ stylesheet, that it uses to make unstyled websites appear more legible. For example, most browsers by default make links blue and visited links purple, give tables a certain amount of border and padding, apply variable font-sizes to H1, H2, H3 etc. and a certain amount of padding to almost everything.



                          Working fiddle







                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited Nov 21 '18 at 16:41

























                          answered Nov 21 '18 at 16:29









                          Yandy_VieraYandy_Viera

                          3,50531238




                          3,50531238






























                              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%2f53416364%2fwhy-the-h4-is-not-horizontally-aligned-with-the-first-item-of-the-menu%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

                              Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

                              ComboBox Display Member on multiple fields

                              Is it possible to collect Nectar points via Trainline?