Shaughn Williams
Shaughn Williams

Reputation: 121

Formatting using innerHTML

Just a small problem, basically, the font styles I have set for these specific IDs are not working, and are being shown in the browser as the preset font for the page, here's the CSS code:

#para
    {
    font: #F00;
    }

Here is the JavaScript code:

document.getElementById("para").innerHTML="As you can see, the answer is";

I have placed the id into a paragraph tag in my HTML file, but the font styling isn't working

Upvotes: 0

Views: 983

Answers (1)

Amy
Amy

Reputation: 7466

To style the font color is to use the color property:

#para {
    color: #F00;
}

See this for more info: https://developer.mozilla.org/en-US/docs/CSS/font

Upvotes: 2

Related Questions