In Association with Amazon.in   Flipkart

Wednesday, June 12, 2013

CSS Id Style Examples

CSS Id and Class atributes to HTML tags:

The id CSS Style:

The id CSS is used to specify a style for a single, unique element.
The id attribute of the HTML element in CSS is defined with a "#".
The style rule below will be applied to the element with id="p1":

<style>
#p1
{
text-align:center;
color:green;
background-color:yellow;
}
</style>

<body>
  <p id="p1">
The id CSS is used to specify a style for a single, unique element.
The id attribute of the HTML element in CSS is defined with a "#".
The style rule below will be applied to the element with id="p1"
  </p>
</body>

CSS External Style Sheet Example

You can Link CSS Files with <link> Tag in the <head> Section as Follows:

CSS File Name: site-styles.css

<style type="text/css">
     h2 { color:#564; background-color:#EEF; }
</style>

HTML File Name: home.html

<html>
         <head>
            <title>Site Title</title>
               <link href="site-styles.css" rel="stylesheet" type="text/css" />
         </head>

        <body>
             <h2>Welcome To CSS</h2>
                <p>CSS External Styles Linking In Html File</p>
       </body
</html>

OutPut:

Welcome To CSS

CSS External Styles Linking In Html File


Related Posts Plugin for WordPress, Blogger...