Pages

Thursday, April 15, 2010

Workshop 2: CSS-Class Id and Class


CSS Id and Class
           The Id is used to specify a style for a single, unique element.
          The id selector uses the id attribute of the HTML element, and is defined with”#".
Example
#para1
{
text-align:center;
color:red;
}
The class sector is most often used on several elements.
The class selector uses the HTML class attribute, and is defined with a "."
Example
.center
 {
text-align:center;
}
The example is about p element with the class = “center”, will gives you central-aligned.
p.center
{
text-align:center;
}
Reference

http://www.w3schools.com/css/default.asp

6 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. It's a little bit like JAVA and C language.
    Nice examples ^-^

    ReplyDelete
  3. I understand that the difference between ID and class is that an ID selector can be called only once in a document, while a class selector can be called multiple times in a document.
    This is very useful blog entry. Well Done Vaibhavi!

    ReplyDelete
  4. @Dong: I know the basic of JAVA i dont know much, but i will learn it and put more on my blog later.

    ReplyDelete
  5. This comment has been removed by the author.

    ReplyDelete
  6. @Dong: Ya its like JAVA and C language!!!

    ReplyDelete