Home › Forums › Support › How to Add the Block Element Hook Before the Main Content This topic has 12 replies, 2 voices, and was last updated 6 months, 3 weeks ago by Fernando. Viewing 13 posts - 1 through 13 (of 13 total) Author Posts September 6, 2022 at 10:31 pm #2335508 Ravi Saive Hi Support, I want to display a block element hook before the main content on the desktop only as shown in the image, but the created block is not showing properly… September 6, 2022 at 10:38 pm #2335510 Fernando Customer Support Hi Ravi, Can you provide the link to the site in question? You may use the Private Information field for this: https://docs.generatepress.com/?s=private+information September 6, 2022 at 11:44 pm #2335566 Ravi Saive I have added the site details in the private info field… September 7, 2022 at 12:53 am #2335622 Fernando Customer Support Where is it appearing if you set the hook to before_main_content? Can you apply that hook and I’ll see what’s occurring? September 7, 2022 at 11:39 pm #2336600 Ravi Saive Hi Fernando, I have added the element, but I want to show this element only to desktop users. Also, the element is not centered as per the main content area… September 8, 2022 at 1:08 am #2336665 Fernando Customer Support I see. Try adding this CSS: .generate-columns-container { justify-content: center; } As for the Element not showing on other devices not desktop, you can add hide-on-* classes to your blocks: https://docs.generatepress.com/article/responsive-display/#using-our-hide-on-classes September 8, 2022 at 1:12 am #2336670 Ravi Saive Hi, Still it is not centered correctly, also how to hide it on mobile and tablet? I want to show this element only to desktop users… September 8, 2022 at 1:15 am #2336671 Ravi Saive Hi, I added the following code to the element, now it is only showing to desktop users, but it is not centered… <div class="hide-on-mobile hide-on-tablet"> <img alt="Tecmint Statistics" src="https://www.tecmint.com/wp-content/uploads/2022/09/tecmint-report.png" /> </div> September 8, 2022 at 1:40 am #2336700 Fernando Customer Support Can you try disabling your caching/optimization plugins temporarily? We’ll have a closer look at the CSS in your site. September 8, 2022 at 1:46 am #2336709 Ravi Saive I have cleared the cache on the site after adding CSS… September 8, 2022 at 2:03 am #2336727 Fernando Customer Support Try adding my-element to the class list of your block as well, then remove the previous CSS. Add this instead: .my-element { display:flex; justify-content:center; width:100%; padding-left:20px; margin-bottom: 10px; } September 8, 2022 at 2:07 am #2336729 Ravi Saive Thanks, it worked…:) September 8, 2022 at 5:06 pm #2337466 Fernando Customer Support You’re welcome Ravi! Author Posts Viewing 13 posts - 1 through 13 (of 13 total) You must be logged in to reply to this topic. Log In Username: Password: Keep me signed in Log In