Press "Enter" to skip to content

Id Base CSS Examples in CSS

Last updated on October 5, 2019

Definition :

  • it is a process of applying css code on the id’s for the components then it is called as id base css.
  • Id for the components need to be unique.

Program :

<html>

     <style type=”text/css”>

                    #First

                                {

                                   color:red;

                                   width: 100px;

                                   height: 100px;

                                   background-color: green;

                                   border-radius: 5px;

                                   text-align: center;

                                   font-size: 25px;

                                }

                </style>

                <body>

                    <p> Hello </p>

                                <p id=”First”> HI </p>

                                <p> A </p>

                                <p> B </p>

                                <p> C </p>

                </body>

</html>

Multiple id’s to based the program :

Program :

<html>

     <style type=”text/css”>

                    #First,#Second

                                {

                                   color:red;

                                   width: 100px;

                                   height: 100px;

                                   background-color: green;

                                   border-radius: 5px;

                                   text-align: center;

                                   font-size: 25px;

                                }

                </style>

                <body>

                    <p> Hello </p>

                                <p id=”First”> HI </p>

                                <p> A </p>

                                <p id=”Second”> B </p>

                                <p> C </p>

                </body>

</html>

Be First to Comment

    Leave a Reply

    Your email address will not be published. Required fields are marked *