How to set font size and font size inside div?

This is my full html test:

<!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 and font-size attributes are ignored.

page result

Why? Why is the font used? What do I need to do to specify the font size and font size?

thanks

+4
source share
2 answers

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

<!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>
+12
source

Add a semicolon to the next line to fix the problem.

font-family:    Arial, Helvetica, sans-serif;
+3
source

Source: https://habr.com/ru/post/1607015/


All Articles