background-color: CSS Style Tip

Highlight eBook Text using background-color

Add background color to ebooks using HTML / CSS code

The CSS code can be added to your external or internal stylesheet. Works with iPad, Kindle Fire, Nook Color; does not display on older Kindles (1,2,3).

background-color: Define the color. See HTML Colors from W3Schools.com

padding: Adding padding adds a space between the text and the edge of the color background. I am using 1em, but you can increase or decrease to your design tastes.

margin-top and margin-bottom: This adds space between the background color and the text above and below.

CSS Code

div.background {

background-color:#ffff00;

padding: 1em 1em 1em 1em;

margin-top:1em;

margin-bottom:1em;

}

HTML Application

<div class=”background”>
<p>Text you want in color</p>
</div>

Leave a Reply