AMH
AMH

Reputation: 6451

add style to <p>

I want to change the font of the <p> tag in HTML so I tried:

<p style="font-family:'Myriad Pro','sans-serif'; font-size:10.0pt; color:#BE2D0F; ">

But it doesn't work, any suggestion how to do that? I need to change the font to this font color, font, and font type.

Upvotes: 3

Views: 18794

Answers (3)

Maxpm
Maxpm

Reputation: 25582

That code is correct.

See: http://jsfiddle.net/bcEKb/

Note that this only sets the style for that single <p> tag. To set the style of EVERY <p> tag, you need to use a separate stylesheet or put it in <head> like so:

<html>
    <head>
        <style type = "text/css">
            p
            {
                font-family: "Myriad Pro", "sans-serif";
                font-size: 10pt;
                color: #BE2D0F;
            }
        </style>
    </head>
    <body>
        <p>This paragraph has the style applied.</p>
        <p>So does this one.</p>
    </body>
</html>

See: http://jsfiddle.net/G6TKe/

Upvotes: 4

Tony Savage
Tony Savage

Reputation: 37

If you have a external CSS file, ensure that you put a class for p if you want it to be used on EVERY paragraph, if its just the one paragraph then just put the code inline (as you have done and it works)

Upvotes: 0

Brett Walker
Brett Walker

Reputation: 3576

Try specifying the font names without the single quotes.

Upvotes: -1

Related Questions