Set background color through CSS for text only with line breaks
HTML
<div id="myDiv">
<p>
Test Div
</p>
</div>
CSS
div
{
/* Light grey background for contrast in this example */
background-color: lightgrey;
}
JavaScript
alert(document.getElementById("myDiv").style.backgroundColor);