Site logo

[Support request] A simple rectangular box that stands out

Home Forums Support [Support request] A simple rectangular box that stands out

Home Forums Support A simple rectangular box that stands out

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #2237222
    steven

    Hey,

    I wonder if you could help. I just want to create a simple rectangular box that will go around text to highlight it on my webpages.

    I definitely don’t want to use a plugin so I wondered if you guys have any code I can use to do this.

    I’ve installed Code Snippets, ready to add some code (I know you recommend it).

    For an example of what I am talking about, see this:

    Box

    #2237235
    Leo
    Staff
    Customer Support

    Hi there,

    Are you using GenerateBlocks already?

    If so you can just add borders to the container that’s containing the rest of the content:
    https://docs.generateblocks.com/article/container-overview/
    https://docs.generateblocks.com/article/container-overview/#spacing

    Let me know if this helps 🙂

    #2237273
    steven

    I am not using Generateblocks. If possible I would rather not install plugins.

    I intend to insert this box as an ad, using Ad inserter as opposed to adding it on a post by post basis.

    So, I need the code to do that. Can you help?

    #2237275
    steven

    By the way I installed Generate Blocks and I don’t see any options at all. No option to create blocks etc.

    I absolutely do not want to install the Gutenberg editor – I am using the classic editor.

    #2237345
    Fernando
    Customer Support

    Hi Steven,

    GenerateBlocks works with the Default WordPress Gutenberg Block Editor. It wouldn’t work with the Classic editor.

    You would need custom code to achieve as such with the classic editor. We generally suggest using the Block Editor as this is where WordPress is headed now, and most functionalities work with it.

    You can add the HTML through a Hook Element and make it appear in your Posts dynamically.

    Then, you can add CSS through Appearance > Customize > Additional CSS.

    You can try searching for codes in sites like these to achieve as such: https://codepen.io/search/pens?q=advertisement+box&cursor=ZD0xJm89MCZwPTI=

    This site may also help: https://www.thesitewizard.com/css/rectangular-box-border.shtml

    An sample of HTML code is:

    <div class="my-box">
    	<h2 class="test-title">
    		Test title
    	</h2>
    	<p class="test-par">
    		My description
    	</p>
    </div>

    CSS:

    .my-box {
        border: solid 4px black;
        padding: 50px;
        background-color: #fff
    }
    
    h2.test-title {
        color: rgb(0,0,0);
        font-weight:bold;
        font-size: 50px;
    }
    
    p.test-par {
        color: #ff0000;
    }

    Hope this helps!

    #2237650
    steven

    Thanks Fernando – I will give it a go!

    I guess I will have to submit to Gutenberg and blocks eventually, but it always messes up my clean pages when I try it.

    You can close this now.

    #2238619
    Fernando
    Customer Support

    You’re welcome Steven!

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.