- This topic has 6 replies, 3 voices, and was last updated 3 years, 10 months ago by
Fernando.
-
AuthorPosts
-
May 29, 2022 at 12:54 pm #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:
May 29, 2022 at 1:22 pm #2237235Leo
StaffCustomer SupportHi 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/#spacingLet me know if this helps 🙂
May 29, 2022 at 3:38 pm #2237273steven
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?
May 29, 2022 at 3:48 pm #2237275steven
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.
May 29, 2022 at 6:37 pm #2237345Fernando 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!
May 30, 2022 at 1:50 am #2237650steven
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.
May 30, 2022 at 4:57 pm #2238619Fernando Customer Support
You’re welcome Steven!
-
AuthorPosts
- You must be logged in to reply to this topic.
