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

ericg

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

jaunt

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>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to set the font family I want in css?

How can i get list of font family(or Name of Font) in matplotlib

xvt terminal - how can I set the font size in a linux?

How can I set/change the font size of UIBarButtonItem's Title

Set font family and size of equations in flextable

can the font family and size be altered for a createmenu statement?

How to set column colors, title colors , font size , font family in external css file for highcharts?

How can I conditionally set the font size of an element, only if the parents font size is not explicitly set (i.e. font-size is 'inherit')?

How can I get the font size and font name of a UILabel?

How can I change the cmd font and font size with a command?

How can I change the font (family) for the labels in Chart.JS?

What is the default font family in HTML and how can I check this?

How can I get the fonts family and font styles in javafx?

How can i change the font-family of SweetAllert.js?

How can I change the size of the Dash font?

How can I increase the font size in WebStorm?

How can i configure font size in gitk?

How can I change the font size differently?

how to change font size of label without changing font family in xcode

How to set font family but retain fallback stack?

How to set default font family in React Native?

Can I define multiple Font-Family names for the same font?

How can I determine which font file is being used, not just the font family?

How can I determine which font in font-family my browser has matched?

Bootstrap 4: How Can I Set $font-size-base for Different Monitor Sizes using Responsive Font Sizing?

How can I chnage the relative size of the text inside font-awesome icon?

Change font family and font size to print

Change Font Family and Font Size using HtmlAgilitPack

How to set font size on NSAttributedString