brian
brian

Reputation: 793

CSS bold not working

For the code below the bold is not working. If I comment out font:inherit; then it works as expected.

I don't understand why this is. I thought <p> would inherit from <body> and the bold would work. I see the exact same thing in Firefox, IE, Safari, and Opera.

What am I missing?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <link href='http://fonts.googleapis.com/css?family=Droid+Sans:400,700,bold' rel='stylesheet' type='text/css' />

        <style type="text/css">
            html, body, div, span, applet, object, iframe,
            h1, h2, h3, h4, h5, h6, p, blockquote, pre,
            a, abbr, acronym, address, big, cite, code,
            del, dfn, em, img, ins, kbd, q, s, samp,
            small, strike, strong, sub, sup, tt, var,
            b, u, i, center,
            dl, dt, dd, ol, ul, li,
            fieldset, form, label, legend,
            table, caption, tbody, tfoot, thead, tr, th, td,
            article, aside, canvas, details, embed, 
            figure, figcaption, footer, header, hgroup, 
            menu, nav, output, ruby, section, summary,
            time, mark, audio, video{
                    font:inherit;
            }

            body{
                font-family:'Droid Sans', sans-serif,Arial,Helvetica,'Trebuchet MS';
                font-size:14px;
            }
        </style>

    </head>

    <body>
        <p>this is a normal paragraph</p>
        <p><strong>this is bolded</strong></p>
    </body>

</html>

edit: by 'not working' I mean the bold font doesn't show up. The html has 2 paragraphs. The first par is normal and the second is bold. When I use the inherit, both lines have the same font weight.

Upvotes: 8

Views: 24858

Answers (2)

j08691
j08691

Reputation: 207900

Your strong element is inheriting from your p element which is inhereting from the body element. Since the default font-weight is normal, everything is getting that applied. Add the rule strong {font-weight:bold;}

Upvotes: 10

Marat Tanalin
Marat Tanalin

Reputation: 14123

According to font:inherit;, P inherits font-weight: normal from BODY, and STRONG inherits from P. It's correct.

If you don't want to reset font for STRONG, then remove it from selectors list before {font: inherit;}.

Upvotes: 5

Related Questions