Margin bigger even though same css is being used












1















https://www.opheliajewellery.co.uk/about/



On this page there's a margin on the bottom and right of each div in the middle, The top and middle have the right size between eachother but the bottom and middle has a slightly larger gap,



After using the inspector I can't seem to find the cause, It's not actually a margin, it's just white space.



It works find on my localhost, but as soon as I put the code into wordpress it does this.



Here's some of the css and the html.



.ophelia-shortDiv{
width: 37%;
margin-bottom: 1%;
display: inline-block;

}

.ophelia-aboutText{
margin-top: 15%;
margin-bottom: 15%;
margin-left: 10%;
margin-right: 10%;
}

.ophelia-wideDiv{
width: 62%;
margin-bottom: 1%;
min-height: 345px;
display: inline-block;
}

.cover{
background-size: cover;
}

.ophelia-leftDiv{
float: left;
margin-right: 1%;
}

.ophelia-color1{
background-color: #e7e7e7;
}

.ophelia-color2{
background-color: #c5c6cd;
}

.ophelia-color3{
background-color: #ced6d8;
}

.ophelia-aboutMain{
margin-bottom: 5%;
margin-top: 5%;
}


<div class="ophelia-aboutMain">
<div class="ophelia-wideDiv ophelia-leftDiv" style="background: url(https://www.opheliajewellery.co.uk/wp/wp-content/uploads/About-ImageOne.jpg) no-repeat; background-size:cover"></div>

<div class="ophelia-shortDiv ophelia-color1">
<div class="ophelia-aboutText">
<p>
...
</p>
<p>
...
</p>
</div>
</div>

<div class="ophelia-wideDiv" style="background: url(https://www.opheliajewellery.co.uk/wp/wp-content/uploads/About-ImageOne.jpg) no-repeat; background-size:cover"></div>

<div class="ophelia-shortDiv ophelia-color1 ophelia-leftDiv">
<div class="ophelia-aboutText">
<p>
...
</p>
<p>
...
</p>
</div>
</div>

<div class="ophelia-wideDiv ophelia-leftDiv" style="background: url(https://www.opheliajewellery.co.uk/wp/wp-content/uploads/About-ImageThree.jpg) no-repeat; background-size:cover"></div>

<div class="ophelia-shortDiv ophelia-color3">
<div class="ophelia-aboutText">
<p>
...
</p>
<p>
...
</p>
</div>
</div>
</div>


Changing 'inline-block' to 'inline-flex' on the divs fixed the problem.



There is a fiddle below to show an example of the problem










share|improve this question




















  • 1





    Please create a Minimal, Complete, and Verifiable example in the question itself - this site is meant to be a repository for future visitors, once you fix your error on the site, the link will be no use and future visitors cannot see the original problem

    – Pete
    Nov 21 '18 at 16:04











  • Check your markup and make sure there's no spaces in between those two elements. If that's not an option use something other than display: inline-block

    – I haz kode
    Nov 21 '18 at 16:13











  • Possible duplicate of How do I remove the space between inline-block elements?

    – Yandy_Viera
    Nov 21 '18 at 16:21











  • he is not talking about the margin between inline-block elements. it's not a duplicate. he means the margin between rows. You could have just checked his link before flagging the question as duplicate.

    – Alvaro Menéndez
    Nov 21 '18 at 16:30











  • It is a duplicate. line-height is not the answer. Change them to inline-flex and you'll see that line-height does not remove the space completely... just makes it smaller due to smaller line-height.

    – I haz kode
    Nov 21 '18 at 16:36


















1















https://www.opheliajewellery.co.uk/about/



On this page there's a margin on the bottom and right of each div in the middle, The top and middle have the right size between eachother but the bottom and middle has a slightly larger gap,



After using the inspector I can't seem to find the cause, It's not actually a margin, it's just white space.



It works find on my localhost, but as soon as I put the code into wordpress it does this.



Here's some of the css and the html.



.ophelia-shortDiv{
width: 37%;
margin-bottom: 1%;
display: inline-block;

}

.ophelia-aboutText{
margin-top: 15%;
margin-bottom: 15%;
margin-left: 10%;
margin-right: 10%;
}

.ophelia-wideDiv{
width: 62%;
margin-bottom: 1%;
min-height: 345px;
display: inline-block;
}

.cover{
background-size: cover;
}

.ophelia-leftDiv{
float: left;
margin-right: 1%;
}

.ophelia-color1{
background-color: #e7e7e7;
}

.ophelia-color2{
background-color: #c5c6cd;
}

.ophelia-color3{
background-color: #ced6d8;
}

.ophelia-aboutMain{
margin-bottom: 5%;
margin-top: 5%;
}


<div class="ophelia-aboutMain">
<div class="ophelia-wideDiv ophelia-leftDiv" style="background: url(https://www.opheliajewellery.co.uk/wp/wp-content/uploads/About-ImageOne.jpg) no-repeat; background-size:cover"></div>

<div class="ophelia-shortDiv ophelia-color1">
<div class="ophelia-aboutText">
<p>
...
</p>
<p>
...
</p>
</div>
</div>

<div class="ophelia-wideDiv" style="background: url(https://www.opheliajewellery.co.uk/wp/wp-content/uploads/About-ImageOne.jpg) no-repeat; background-size:cover"></div>

<div class="ophelia-shortDiv ophelia-color1 ophelia-leftDiv">
<div class="ophelia-aboutText">
<p>
...
</p>
<p>
...
</p>
</div>
</div>

<div class="ophelia-wideDiv ophelia-leftDiv" style="background: url(https://www.opheliajewellery.co.uk/wp/wp-content/uploads/About-ImageThree.jpg) no-repeat; background-size:cover"></div>

<div class="ophelia-shortDiv ophelia-color3">
<div class="ophelia-aboutText">
<p>
...
</p>
<p>
...
</p>
</div>
</div>
</div>


Changing 'inline-block' to 'inline-flex' on the divs fixed the problem.



There is a fiddle below to show an example of the problem










share|improve this question




















  • 1





    Please create a Minimal, Complete, and Verifiable example in the question itself - this site is meant to be a repository for future visitors, once you fix your error on the site, the link will be no use and future visitors cannot see the original problem

    – Pete
    Nov 21 '18 at 16:04











  • Check your markup and make sure there's no spaces in between those two elements. If that's not an option use something other than display: inline-block

    – I haz kode
    Nov 21 '18 at 16:13











  • Possible duplicate of How do I remove the space between inline-block elements?

    – Yandy_Viera
    Nov 21 '18 at 16:21











  • he is not talking about the margin between inline-block elements. it's not a duplicate. he means the margin between rows. You could have just checked his link before flagging the question as duplicate.

    – Alvaro Menéndez
    Nov 21 '18 at 16:30











  • It is a duplicate. line-height is not the answer. Change them to inline-flex and you'll see that line-height does not remove the space completely... just makes it smaller due to smaller line-height.

    – I haz kode
    Nov 21 '18 at 16:36
















1












1








1








https://www.opheliajewellery.co.uk/about/



On this page there's a margin on the bottom and right of each div in the middle, The top and middle have the right size between eachother but the bottom and middle has a slightly larger gap,



After using the inspector I can't seem to find the cause, It's not actually a margin, it's just white space.



It works find on my localhost, but as soon as I put the code into wordpress it does this.



Here's some of the css and the html.



.ophelia-shortDiv{
width: 37%;
margin-bottom: 1%;
display: inline-block;

}

.ophelia-aboutText{
margin-top: 15%;
margin-bottom: 15%;
margin-left: 10%;
margin-right: 10%;
}

.ophelia-wideDiv{
width: 62%;
margin-bottom: 1%;
min-height: 345px;
display: inline-block;
}

.cover{
background-size: cover;
}

.ophelia-leftDiv{
float: left;
margin-right: 1%;
}

.ophelia-color1{
background-color: #e7e7e7;
}

.ophelia-color2{
background-color: #c5c6cd;
}

.ophelia-color3{
background-color: #ced6d8;
}

.ophelia-aboutMain{
margin-bottom: 5%;
margin-top: 5%;
}


<div class="ophelia-aboutMain">
<div class="ophelia-wideDiv ophelia-leftDiv" style="background: url(https://www.opheliajewellery.co.uk/wp/wp-content/uploads/About-ImageOne.jpg) no-repeat; background-size:cover"></div>

<div class="ophelia-shortDiv ophelia-color1">
<div class="ophelia-aboutText">
<p>
...
</p>
<p>
...
</p>
</div>
</div>

<div class="ophelia-wideDiv" style="background: url(https://www.opheliajewellery.co.uk/wp/wp-content/uploads/About-ImageOne.jpg) no-repeat; background-size:cover"></div>

<div class="ophelia-shortDiv ophelia-color1 ophelia-leftDiv">
<div class="ophelia-aboutText">
<p>
...
</p>
<p>
...
</p>
</div>
</div>

<div class="ophelia-wideDiv ophelia-leftDiv" style="background: url(https://www.opheliajewellery.co.uk/wp/wp-content/uploads/About-ImageThree.jpg) no-repeat; background-size:cover"></div>

<div class="ophelia-shortDiv ophelia-color3">
<div class="ophelia-aboutText">
<p>
...
</p>
<p>
...
</p>
</div>
</div>
</div>


Changing 'inline-block' to 'inline-flex' on the divs fixed the problem.



There is a fiddle below to show an example of the problem










share|improve this question
















https://www.opheliajewellery.co.uk/about/



On this page there's a margin on the bottom and right of each div in the middle, The top and middle have the right size between eachother but the bottom and middle has a slightly larger gap,



After using the inspector I can't seem to find the cause, It's not actually a margin, it's just white space.



It works find on my localhost, but as soon as I put the code into wordpress it does this.



Here's some of the css and the html.



.ophelia-shortDiv{
width: 37%;
margin-bottom: 1%;
display: inline-block;

}

.ophelia-aboutText{
margin-top: 15%;
margin-bottom: 15%;
margin-left: 10%;
margin-right: 10%;
}

.ophelia-wideDiv{
width: 62%;
margin-bottom: 1%;
min-height: 345px;
display: inline-block;
}

.cover{
background-size: cover;
}

.ophelia-leftDiv{
float: left;
margin-right: 1%;
}

.ophelia-color1{
background-color: #e7e7e7;
}

.ophelia-color2{
background-color: #c5c6cd;
}

.ophelia-color3{
background-color: #ced6d8;
}

.ophelia-aboutMain{
margin-bottom: 5%;
margin-top: 5%;
}


<div class="ophelia-aboutMain">
<div class="ophelia-wideDiv ophelia-leftDiv" style="background: url(https://www.opheliajewellery.co.uk/wp/wp-content/uploads/About-ImageOne.jpg) no-repeat; background-size:cover"></div>

<div class="ophelia-shortDiv ophelia-color1">
<div class="ophelia-aboutText">
<p>
...
</p>
<p>
...
</p>
</div>
</div>

<div class="ophelia-wideDiv" style="background: url(https://www.opheliajewellery.co.uk/wp/wp-content/uploads/About-ImageOne.jpg) no-repeat; background-size:cover"></div>

<div class="ophelia-shortDiv ophelia-color1 ophelia-leftDiv">
<div class="ophelia-aboutText">
<p>
...
</p>
<p>
...
</p>
</div>
</div>

<div class="ophelia-wideDiv ophelia-leftDiv" style="background: url(https://www.opheliajewellery.co.uk/wp/wp-content/uploads/About-ImageThree.jpg) no-repeat; background-size:cover"></div>

<div class="ophelia-shortDiv ophelia-color3">
<div class="ophelia-aboutText">
<p>
...
</p>
<p>
...
</p>
</div>
</div>
</div>


Changing 'inline-block' to 'inline-flex' on the divs fixed the problem.



There is a fiddle below to show an example of the problem







html css wordpress margin






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 21 '18 at 16:47







Theory

















asked Nov 21 '18 at 16:00









TheoryTheory

114




114








  • 1





    Please create a Minimal, Complete, and Verifiable example in the question itself - this site is meant to be a repository for future visitors, once you fix your error on the site, the link will be no use and future visitors cannot see the original problem

    – Pete
    Nov 21 '18 at 16:04











  • Check your markup and make sure there's no spaces in between those two elements. If that's not an option use something other than display: inline-block

    – I haz kode
    Nov 21 '18 at 16:13











  • Possible duplicate of How do I remove the space between inline-block elements?

    – Yandy_Viera
    Nov 21 '18 at 16:21











  • he is not talking about the margin between inline-block elements. it's not a duplicate. he means the margin between rows. You could have just checked his link before flagging the question as duplicate.

    – Alvaro Menéndez
    Nov 21 '18 at 16:30











  • It is a duplicate. line-height is not the answer. Change them to inline-flex and you'll see that line-height does not remove the space completely... just makes it smaller due to smaller line-height.

    – I haz kode
    Nov 21 '18 at 16:36
















  • 1





    Please create a Minimal, Complete, and Verifiable example in the question itself - this site is meant to be a repository for future visitors, once you fix your error on the site, the link will be no use and future visitors cannot see the original problem

    – Pete
    Nov 21 '18 at 16:04











  • Check your markup and make sure there's no spaces in between those two elements. If that's not an option use something other than display: inline-block

    – I haz kode
    Nov 21 '18 at 16:13











  • Possible duplicate of How do I remove the space between inline-block elements?

    – Yandy_Viera
    Nov 21 '18 at 16:21











  • he is not talking about the margin between inline-block elements. it's not a duplicate. he means the margin between rows. You could have just checked his link before flagging the question as duplicate.

    – Alvaro Menéndez
    Nov 21 '18 at 16:30











  • It is a duplicate. line-height is not the answer. Change them to inline-flex and you'll see that line-height does not remove the space completely... just makes it smaller due to smaller line-height.

    – I haz kode
    Nov 21 '18 at 16:36










1




1





Please create a Minimal, Complete, and Verifiable example in the question itself - this site is meant to be a repository for future visitors, once you fix your error on the site, the link will be no use and future visitors cannot see the original problem

– Pete
Nov 21 '18 at 16:04





Please create a Minimal, Complete, and Verifiable example in the question itself - this site is meant to be a repository for future visitors, once you fix your error on the site, the link will be no use and future visitors cannot see the original problem

– Pete
Nov 21 '18 at 16:04













Check your markup and make sure there's no spaces in between those two elements. If that's not an option use something other than display: inline-block

– I haz kode
Nov 21 '18 at 16:13





Check your markup and make sure there's no spaces in between those two elements. If that's not an option use something other than display: inline-block

– I haz kode
Nov 21 '18 at 16:13













Possible duplicate of How do I remove the space between inline-block elements?

– Yandy_Viera
Nov 21 '18 at 16:21





Possible duplicate of How do I remove the space between inline-block elements?

– Yandy_Viera
Nov 21 '18 at 16:21













he is not talking about the margin between inline-block elements. it's not a duplicate. he means the margin between rows. You could have just checked his link before flagging the question as duplicate.

– Alvaro Menéndez
Nov 21 '18 at 16:30





he is not talking about the margin between inline-block elements. it's not a duplicate. he means the margin between rows. You could have just checked his link before flagging the question as duplicate.

– Alvaro Menéndez
Nov 21 '18 at 16:30













It is a duplicate. line-height is not the answer. Change them to inline-flex and you'll see that line-height does not remove the space completely... just makes it smaller due to smaller line-height.

– I haz kode
Nov 21 '18 at 16:36







It is a duplicate. line-height is not the answer. Change them to inline-flex and you'll see that line-height does not remove the space completely... just makes it smaller due to smaller line-height.

– I haz kode
Nov 21 '18 at 16:36














2 Answers
2






active

oldest

votes


















0














Your gap between your elements is caused by this css rule you have:



.kleanity-body, .kleanity-body p, .kleanity-line-height, .gdlr-core-line-height {
line-height: 1.7;
}


Your are applying line-height to many different elements including the body of your html.



remove this rule and apply the line-height only where you need it.






share|improve this answer































    0














    I put this into a fiddle, and indeed the margin issue is there. This has nothing to do with any styles applied to body, since it appears without any other context (though changes there might well have the desired effect).



    I am not sure what is causing this, but it seems that if the image above is removed, the issue disappears, and also if the middle image has float:right - so I suspect this is something to do with the float:left in your ophelia-leftDiv class.






    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%2f53415971%2fmargin-bigger-even-though-same-css-is-being-used%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














      Your gap between your elements is caused by this css rule you have:



      .kleanity-body, .kleanity-body p, .kleanity-line-height, .gdlr-core-line-height {
      line-height: 1.7;
      }


      Your are applying line-height to many different elements including the body of your html.



      remove this rule and apply the line-height only where you need it.






      share|improve this answer




























        0














        Your gap between your elements is caused by this css rule you have:



        .kleanity-body, .kleanity-body p, .kleanity-line-height, .gdlr-core-line-height {
        line-height: 1.7;
        }


        Your are applying line-height to many different elements including the body of your html.



        remove this rule and apply the line-height only where you need it.






        share|improve this answer


























          0












          0








          0







          Your gap between your elements is caused by this css rule you have:



          .kleanity-body, .kleanity-body p, .kleanity-line-height, .gdlr-core-line-height {
          line-height: 1.7;
          }


          Your are applying line-height to many different elements including the body of your html.



          remove this rule and apply the line-height only where you need it.






          share|improve this answer













          Your gap between your elements is caused by this css rule you have:



          .kleanity-body, .kleanity-body p, .kleanity-line-height, .gdlr-core-line-height {
          line-height: 1.7;
          }


          Your are applying line-height to many different elements including the body of your html.



          remove this rule and apply the line-height only where you need it.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 21 '18 at 16:27









          Alvaro MenéndezAlvaro Menéndez

          5,65322046




          5,65322046

























              0














              I put this into a fiddle, and indeed the margin issue is there. This has nothing to do with any styles applied to body, since it appears without any other context (though changes there might well have the desired effect).



              I am not sure what is causing this, but it seems that if the image above is removed, the issue disappears, and also if the middle image has float:right - so I suspect this is something to do with the float:left in your ophelia-leftDiv class.






              share|improve this answer




























                0














                I put this into a fiddle, and indeed the margin issue is there. This has nothing to do with any styles applied to body, since it appears without any other context (though changes there might well have the desired effect).



                I am not sure what is causing this, but it seems that if the image above is removed, the issue disappears, and also if the middle image has float:right - so I suspect this is something to do with the float:left in your ophelia-leftDiv class.






                share|improve this answer


























                  0












                  0








                  0







                  I put this into a fiddle, and indeed the margin issue is there. This has nothing to do with any styles applied to body, since it appears without any other context (though changes there might well have the desired effect).



                  I am not sure what is causing this, but it seems that if the image above is removed, the issue disappears, and also if the middle image has float:right - so I suspect this is something to do with the float:left in your ophelia-leftDiv class.






                  share|improve this answer













                  I put this into a fiddle, and indeed the margin issue is there. This has nothing to do with any styles applied to body, since it appears without any other context (though changes there might well have the desired effect).



                  I am not sure what is causing this, but it seems that if the image above is removed, the issue disappears, and also if the middle image has float:right - so I suspect this is something to do with the float:left in your ophelia-leftDiv class.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 21 '18 at 16:41









                  brandonmackbrandonmack

                  215




                  215






























                      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%2f53415971%2fmargin-bigger-even-though-same-css-is-being-used%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

                      How to send String Array data to Server using php in android

                      Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

                      Is anime1.com a legal site for watching anime?