close[x]


CSS

CSS-Home CSS-Environment CSS-Basic syntax CSS-Selector CSS-How To Add CSS CSS-Comment CSS-Color CSS-Background CSS-Font CSS-Text CSS-Boarder CSS-Margin CSS-Padding CSS-Height/Width CSS-Link CSS-Table CSS-Visibility CSS-Scrollable CSS-Float/Clear CSS-Line CSS-Align CSS-Dimension CSS-Event CSS-Pusedo class CSS-Position CSS-Transparency CSS-Dropdown CSS-Form CSS-List/Counter CSS-Website layout CSS-Text effect CSS-Image effect CSS-Button effect CSS-page number CSS-Box CSS-@media CSS-Multi device CSS-Multi device 1 CSS-Multi device 2



learncodehere.com




CSS - Fonts

CSS Font property is used to control the look of texts available in an HTML element. .

CSS Font property makes you to change the text size, color, style and more

You can set following font properties of an element −

  • font-family : This property is used to change the face of the font.
  • font-style : This property is used to make the font bold, italic or oblique.
  • font-variant : This property creates a small-caps effect.
  • font-weight : This property is used to increase or decrease the boldness and lightness of the font.
  • font-size : This property is used to increase or decrease the size of the font.
  • font color : This property is used to change the color of the text.

  • Example : CSS - Fonts

    <!DOCTYPE html>
    <html>
    <head>
    <style>

    p {
    font-weight : bold;
    font-family: Impact, Charcoal, sans-serif;
    font-size : 30px;
    }
    h3 {
    color : blue;
    }
    div {
    font-style : italic;
    font-variant: normal;
    }
    </style>
    </head>
    <body>
    <p>Code Always.</p>
    <h3>Code Always To Become Best Programmer.</h3>
    <div>
    This is a text inside a div element.
    So we can set a font for div element.
    </div>
    </body>
    </html>

    When the above code is compiled , it produces the following result.

    Result

    Code Always.

    Code Always To Become Best Programmer.

    This is a text inside a div element.
    So we can set a font for div element.

    You can set CSS Font properties inline, internal and external way of using CSS in your HTML page.