Sticky banner to run alongside blog content












0















I'm trying to add a banner ad to run along the left side of my blog post.



However my attempts so far have resulted in it appearing above the content pushing the blog post content down the page.



Live link: https://www.moneynest.co.uk/pension-crisis-uk/



Added into head:



<div id=”LeftFloatAds”><a href="https://www.pensionbee.com" target="_blank"><img src="https://www.moneynest.co.uk/wp-content/uploads/2018/12/160x600b.png" alt="PensionBee sidebar ad"></a></div>


Added into CSS



@media only screen and (min-width: 1400px) and (max-width:500px) {
#LeftFloatAds{

left: 0px;

position: fixed;

text-align: center;

top: 200px;

}

}


FYI I followed this guide.










share|improve this question



























    0















    I'm trying to add a banner ad to run along the left side of my blog post.



    However my attempts so far have resulted in it appearing above the content pushing the blog post content down the page.



    Live link: https://www.moneynest.co.uk/pension-crisis-uk/



    Added into head:



    <div id=”LeftFloatAds”><a href="https://www.pensionbee.com" target="_blank"><img src="https://www.moneynest.co.uk/wp-content/uploads/2018/12/160x600b.png" alt="PensionBee sidebar ad"></a></div>


    Added into CSS



    @media only screen and (min-width: 1400px) and (max-width:500px) {
    #LeftFloatAds{

    left: 0px;

    position: fixed;

    text-align: center;

    top: 200px;

    }

    }


    FYI I followed this guide.










    share|improve this question

























      0












      0








      0








      I'm trying to add a banner ad to run along the left side of my blog post.



      However my attempts so far have resulted in it appearing above the content pushing the blog post content down the page.



      Live link: https://www.moneynest.co.uk/pension-crisis-uk/



      Added into head:



      <div id=”LeftFloatAds”><a href="https://www.pensionbee.com" target="_blank"><img src="https://www.moneynest.co.uk/wp-content/uploads/2018/12/160x600b.png" alt="PensionBee sidebar ad"></a></div>


      Added into CSS



      @media only screen and (min-width: 1400px) and (max-width:500px) {
      #LeftFloatAds{

      left: 0px;

      position: fixed;

      text-align: center;

      top: 200px;

      }

      }


      FYI I followed this guide.










      share|improve this question














      I'm trying to add a banner ad to run along the left side of my blog post.



      However my attempts so far have resulted in it appearing above the content pushing the blog post content down the page.



      Live link: https://www.moneynest.co.uk/pension-crisis-uk/



      Added into head:



      <div id=”LeftFloatAds”><a href="https://www.pensionbee.com" target="_blank"><img src="https://www.moneynest.co.uk/wp-content/uploads/2018/12/160x600b.png" alt="PensionBee sidebar ad"></a></div>


      Added into CSS



      @media only screen and (min-width: 1400px) and (max-width:500px) {
      #LeftFloatAds{

      left: 0px;

      position: fixed;

      text-align: center;

      top: 200px;

      }

      }


      FYI I followed this guide.







      html css wordpress






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 3 at 19:42









      Sam JefferiesSam Jefferies

      198115




      198115
























          2 Answers
          2






          active

          oldest

          votes


















          1















          1. First of all, replace the position of ... move it inside your main content wrapper.

          2. Then apply this css,


          As you want to show this only on wider screen then use this,



          @media only screen and (min-width: 1400px) {
          #LeftFloatAds {
          position: fixed;
          display: block;
          overflow: hidden;
          left: 0;
          top: 200px;
          }
          }


          This will hide the banner on the screen smaller than 1400 pixels.



          @media only screen and (max-width: 1399px) {
          #LeftFloatAds {
          display: none;
          }
          }





          share|improve this answer
























          • Thanks Deepak, I made this a lot more complicated than I needed to. I simply inserted the image into my blog post content (which put it inside my main content wrapper) and then used a fixed positioning to move it to the left.

            – Sam Jefferies
            Jan 7 at 12:50











          • Yes, you were wrapping it outside your main wrapper. The best place will be right after your body opening tag or your main container class.

            – Deepak Singh
            Jan 8 at 22:30



















          0














          First, be careful with the div id quotes.



          <div id=”LeftFloatAds”> should be <div id="LeftFloatAds">



          Then, with that media query you are giving those properties to the element only when the screen is at least 1400px but less than 500px, which is impossible. Try it like this:



          @media only screen and (min-width: 500px) and (max-width:1400px)






          share|improve this answer
























          • Yes, if you don't use regular single or double quotes (" or ') then the quotes will become part of the name of the div, so when selecting the div with css it will look like this: #”LeftFloatAds” (which is not recommendable)

            – Giselle Craig
            Jan 3 at 20:15












          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%2f54028789%2fsticky-banner-to-run-alongside-blog-content%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









          1















          1. First of all, replace the position of ... move it inside your main content wrapper.

          2. Then apply this css,


          As you want to show this only on wider screen then use this,



          @media only screen and (min-width: 1400px) {
          #LeftFloatAds {
          position: fixed;
          display: block;
          overflow: hidden;
          left: 0;
          top: 200px;
          }
          }


          This will hide the banner on the screen smaller than 1400 pixels.



          @media only screen and (max-width: 1399px) {
          #LeftFloatAds {
          display: none;
          }
          }





          share|improve this answer
























          • Thanks Deepak, I made this a lot more complicated than I needed to. I simply inserted the image into my blog post content (which put it inside my main content wrapper) and then used a fixed positioning to move it to the left.

            – Sam Jefferies
            Jan 7 at 12:50











          • Yes, you were wrapping it outside your main wrapper. The best place will be right after your body opening tag or your main container class.

            – Deepak Singh
            Jan 8 at 22:30
















          1















          1. First of all, replace the position of ... move it inside your main content wrapper.

          2. Then apply this css,


          As you want to show this only on wider screen then use this,



          @media only screen and (min-width: 1400px) {
          #LeftFloatAds {
          position: fixed;
          display: block;
          overflow: hidden;
          left: 0;
          top: 200px;
          }
          }


          This will hide the banner on the screen smaller than 1400 pixels.



          @media only screen and (max-width: 1399px) {
          #LeftFloatAds {
          display: none;
          }
          }





          share|improve this answer
























          • Thanks Deepak, I made this a lot more complicated than I needed to. I simply inserted the image into my blog post content (which put it inside my main content wrapper) and then used a fixed positioning to move it to the left.

            – Sam Jefferies
            Jan 7 at 12:50











          • Yes, you were wrapping it outside your main wrapper. The best place will be right after your body opening tag or your main container class.

            – Deepak Singh
            Jan 8 at 22:30














          1












          1








          1








          1. First of all, replace the position of ... move it inside your main content wrapper.

          2. Then apply this css,


          As you want to show this only on wider screen then use this,



          @media only screen and (min-width: 1400px) {
          #LeftFloatAds {
          position: fixed;
          display: block;
          overflow: hidden;
          left: 0;
          top: 200px;
          }
          }


          This will hide the banner on the screen smaller than 1400 pixels.



          @media only screen and (max-width: 1399px) {
          #LeftFloatAds {
          display: none;
          }
          }





          share|improve this answer














          1. First of all, replace the position of ... move it inside your main content wrapper.

          2. Then apply this css,


          As you want to show this only on wider screen then use this,



          @media only screen and (min-width: 1400px) {
          #LeftFloatAds {
          position: fixed;
          display: block;
          overflow: hidden;
          left: 0;
          top: 200px;
          }
          }


          This will hide the banner on the screen smaller than 1400 pixels.



          @media only screen and (max-width: 1399px) {
          #LeftFloatAds {
          display: none;
          }
          }






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 3 at 20:03









          Deepak SinghDeepak Singh

          408




          408













          • Thanks Deepak, I made this a lot more complicated than I needed to. I simply inserted the image into my blog post content (which put it inside my main content wrapper) and then used a fixed positioning to move it to the left.

            – Sam Jefferies
            Jan 7 at 12:50











          • Yes, you were wrapping it outside your main wrapper. The best place will be right after your body opening tag or your main container class.

            – Deepak Singh
            Jan 8 at 22:30



















          • Thanks Deepak, I made this a lot more complicated than I needed to. I simply inserted the image into my blog post content (which put it inside my main content wrapper) and then used a fixed positioning to move it to the left.

            – Sam Jefferies
            Jan 7 at 12:50











          • Yes, you were wrapping it outside your main wrapper. The best place will be right after your body opening tag or your main container class.

            – Deepak Singh
            Jan 8 at 22:30

















          Thanks Deepak, I made this a lot more complicated than I needed to. I simply inserted the image into my blog post content (which put it inside my main content wrapper) and then used a fixed positioning to move it to the left.

          – Sam Jefferies
          Jan 7 at 12:50





          Thanks Deepak, I made this a lot more complicated than I needed to. I simply inserted the image into my blog post content (which put it inside my main content wrapper) and then used a fixed positioning to move it to the left.

          – Sam Jefferies
          Jan 7 at 12:50













          Yes, you were wrapping it outside your main wrapper. The best place will be right after your body opening tag or your main container class.

          – Deepak Singh
          Jan 8 at 22:30





          Yes, you were wrapping it outside your main wrapper. The best place will be right after your body opening tag or your main container class.

          – Deepak Singh
          Jan 8 at 22:30













          0














          First, be careful with the div id quotes.



          <div id=”LeftFloatAds”> should be <div id="LeftFloatAds">



          Then, with that media query you are giving those properties to the element only when the screen is at least 1400px but less than 500px, which is impossible. Try it like this:



          @media only screen and (min-width: 500px) and (max-width:1400px)






          share|improve this answer
























          • Yes, if you don't use regular single or double quotes (" or ') then the quotes will become part of the name of the div, so when selecting the div with css it will look like this: #”LeftFloatAds” (which is not recommendable)

            – Giselle Craig
            Jan 3 at 20:15
















          0














          First, be careful with the div id quotes.



          <div id=”LeftFloatAds”> should be <div id="LeftFloatAds">



          Then, with that media query you are giving those properties to the element only when the screen is at least 1400px but less than 500px, which is impossible. Try it like this:



          @media only screen and (min-width: 500px) and (max-width:1400px)






          share|improve this answer
























          • Yes, if you don't use regular single or double quotes (" or ') then the quotes will become part of the name of the div, so when selecting the div with css it will look like this: #”LeftFloatAds” (which is not recommendable)

            – Giselle Craig
            Jan 3 at 20:15














          0












          0








          0







          First, be careful with the div id quotes.



          <div id=”LeftFloatAds”> should be <div id="LeftFloatAds">



          Then, with that media query you are giving those properties to the element only when the screen is at least 1400px but less than 500px, which is impossible. Try it like this:



          @media only screen and (min-width: 500px) and (max-width:1400px)






          share|improve this answer













          First, be careful with the div id quotes.



          <div id=”LeftFloatAds”> should be <div id="LeftFloatAds">



          Then, with that media query you are giving those properties to the element only when the screen is at least 1400px but less than 500px, which is impossible. Try it like this:



          @media only screen and (min-width: 500px) and (max-width:1400px)







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 3 at 19:58









          Giselle CraigGiselle Craig

          11




          11













          • Yes, if you don't use regular single or double quotes (" or ') then the quotes will become part of the name of the div, so when selecting the div with css it will look like this: #”LeftFloatAds” (which is not recommendable)

            – Giselle Craig
            Jan 3 at 20:15



















          • Yes, if you don't use regular single or double quotes (" or ') then the quotes will become part of the name of the div, so when selecting the div with css it will look like this: #”LeftFloatAds” (which is not recommendable)

            – Giselle Craig
            Jan 3 at 20:15

















          Yes, if you don't use regular single or double quotes (" or ') then the quotes will become part of the name of the div, so when selecting the div with css it will look like this: #”LeftFloatAds” (which is not recommendable)

          – Giselle Craig
          Jan 3 at 20:15





          Yes, if you don't use regular single or double quotes (" or ') then the quotes will become part of the name of the div, so when selecting the div with css it will look like this: #”LeftFloatAds” (which is not recommendable)

          – Giselle Craig
          Jan 3 at 20:15


















          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%2f54028789%2fsticky-banner-to-run-alongside-blog-content%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

          Monofisismo

          Angular Downloading a file using contenturl with Basic Authentication

          Olmecas