Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I set the font-family & font-size inside of a div?

This is my complete test html:

<!DOCTYPE>
<html>
    <head>
        <title>DIV Font</title>

        <style>
            .my_text
            {
                font-family:    Arial, Helvetica, sans-serif
                font-size:      40px;
                font-weight:    bold;
            }
        </style>
    </head>

    <body>
        <div class="my_text">some text</div>
    </body>
</html>

The font-family & font-size attributes are being ignored.

page result

Why? Why is font-weight used? What do I need to do so I can specify the font-family & font-size?

Thank you

like image 320
ericg Avatar asked Sep 11 '15 19:09

ericg


2 Answers

You need a semicolon after font-family: Arial, Helvetica, sans-serif. This will make your updated code the following:

<!DOCTYPE>
<html>
    <head>
        <title>DIV Font</title>

        <style>
            .my_text
            {
                font-family:    Arial, Helvetica, sans-serif;
                font-size:      40px;
                font-weight:    bold;
            }
        </style>
    </head>

    <body>
        <div class="my_text">some text</div>
    </body>
</html>
like image 174
jaunt Avatar answered Oct 16 '22 14:10

jaunt


Append a semicolon to the following line to fix the issue.

font-family:    Arial, Helvetica, sans-serif;
like image 4
Anthony Rojas Avatar answered Oct 16 '22 15:10

Anthony Rojas