Menu ▼

Previous Next

<style> :

<style> tag will be used to define the styles(css classes) whcich can be re used in the page.

Syntax :

<style type="text/css">

    .classname

    {

        define styles here....

    }

</style>


Example :

<html>

<head>

    <title>HTML Tutorial</title>

    <style type="text/css">

        .divred

        {

            background-color: Red;

            font-size: 18px;

            font-weight: bold;

            color: #fff;

            height: 100px;

            width: 500px;

        }

        .divgreen

        {

            background-color: Green;

            font-size: 15px;

            font-style: italic;

            color: #fff;

            height: 100px;

            width: 300px;

        }

    </style>

</head>

<body>

    <div class="divred">

        <q>divred</q> class applied for this div.

    </div><br />

    <div class="divgreen">

        <q>divgreen</q> class applied for this div.

    </div>

</body>

</html>


Output :
HTML Tutorial
divred class applied for this div.

divgreen class applied for this div.
Previous Next




Search dotnetlearners.com