- This topic has 10 replies, 2 voices, and was last updated 4 years, 9 months ago by Leo.
-
AuthorPosts
-
July 4, 2019 at 1:54 am #948590Devesh
Is there any way in generate press to have a different background color for a particular paragraph in the blog post like in this page-https://www.kitchenarena.in/best-washing-machine/
July 4, 2019 at 8:26 am #948959LeoStaffCustomer SupportHi there,
Nothing built-in for this but you can just use simple HTML inline style:
https://www.w3schools.com/html/html_styles.aspLet me know if this helps π
July 4, 2019 at 9:28 am #949037DeveshI am afraid I still don’t get how to apply this HTML to a particular paragraph.
Can you share some specific details on how do I execute this in generatepress?Also, it would be great if Generate Press can introduce this as a feature, as some other themes do provide this as a default option. It really gives a good effect and better readability.
I also tried this with Gutenberg block by formatting the background color of the para block. But that seems to disturb the block’s text alignment as well and there seems to be no option to restore the alignment for such para.
July 4, 2019 at 9:45 am #949058LeoStaffCustomer SupportThis would be the HTML:
<p style="background-color:#000;">Different background color for paragraphs</p>
This isn’t something we would add to GP as it rarely gets requested and can be accomplished with some very simple HTML.
Let me know if this helps π
July 4, 2019 at 11:13 am #949138DeveshWhile this adds background color, the formatting is not clean (as shared in my earlier link) and text almost touches the border. Check this page.
I am a bit surprised that this cannot be added as a feature, while this is not difficult for you to add.
It is tedious to change the html code of each para block, add the color code and also the formatting is not clean, which may require further changes.July 4, 2019 at 11:25 am #949144LeoStaffCustomer SupportIt’s certainly not difficult for us to add, but keep in mind that we only want to add features that are useful for majority of users so we keep the theme and plugin as light as possible.
If we do add features like this, then we would need to introduce extra controls such as text color, background color, padding option, mobile padding option, text alignment options etc and you can see how the list goes on and on.
Would it be better if we use a class instead?
<p class="special-background">Different background color for paragraphs</p>
Then target it with CSS:
p.special-background { background-color: #000; padding: 20px; border: 1px solid #fff; }
July 4, 2019 at 11:31 am #949151LeoStaffCustomer SupportYou can add custom class within block editor as well:
https://www.screencast.com/t/t4yqMzuDTThe CSS should still apply.
July 4, 2019 at 11:46 am #949164DeveshOk. Thanks.
If I understand correctly, the CSS can be added at the web page level. And the HTML code for para class to be added to each para where I want to use a different background color.Please confirm if this is correct. Also, can I also add a border to this para?
July 4, 2019 at 11:50 am #949169LeoStaffCustomer SupportI would recommend adding that CSS to a global editor so you can use the class everywhere:
https://docs.generatepress.com/article/adding-css/Then if you are using the block editor, simply add the content inside a paragraph block and add
special-background
in here when you want to apply special style:
https://www.screencast.com/t/t4yqMzuDTI’ve edited the CSS above to include border.
July 4, 2019 at 12:03 pm #949190DeveshCool, Thanks! This was useful to know.
July 4, 2019 at 12:09 pm #949203LeoStaffCustomer SupportNo problem π
-
AuthorPosts
- You must be logged in to reply to this topic.