0

I am using the standard out of the box HTML Editor component but I am not able to give background color to the HTML text. The Code I used is:

h3 {
    background-color: green;
}

<div id="body" bgcolor="black">

    <br><br><br><br><br>
    <h3 style="color:red;" align="Center" size="10px" >Heading 1</h1>
    <p style="color:black;" align="Center" size="11px" bgcolor="red">First paragraph </p>
    <h3 style="color:red;" align="Center" size="10px">Heading 2.</h1>
    <p style="color:black;" align="Center" size="11px">Paragraph 2</p>
    <br><br><br><br><br><br><br>
</div>

The preview looked like this:

enter image description here

I would also like to know if there is a way to add background color to the entire section including the area with no text.

1
  • ` is the formatting character, not ', but its meant for inline code, ie, a single line of code. For blocks of code, highlight your code, then click the {} icon to indent it four spaces & render it as code. Commented May 1, 2018 at 15:16

1 Answer 1

1

The way you are trying to add CSS is kinda flawed. You have to define the CSS tags in style attribute for them to work.

Colours working

You can use Inline Styles Like I did. As you cannot use **<Style>** tag in HTML section.

 <div id="body2" style="background-color: green;">

    <br><br><br><br><br>
    <h3 style="color:red;" align="Center" size="10px" >Heading 1</h1>
    <p style="color:black;" align="Center" size="11px" bgcolor="red">First paragraph </p>
    <h3 style="color:red;" align="Center" size="10px">Heading 2.</h1>
    <p style="color:black;" align="Center" size="11px">Paragraph 2</p>
    <br><br><br><br><br><br><br>
</div>

Or in Community builder you have to edit the Theme->DropDown->Edit CSS, It will update the whole Community's CSS.(Can be a bit messy).

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .