Friday, 29 July 2011

In CSS what would be the effects of and differences between the following:




1    #dvHeader UL LI A { color:red }
2    .dvHeader UL LI A { color:red }
3    #dvHeader A { color:red }
4    #dvHeader > A { color:red }


# is used as an id selector hence,
#dvHeader would match an Anchor elements in an un-numbered list's list Item, and of class dvHeader (className of dvHeader) [and set the InnerHTML (text ) contained within any one of these tags to the color red].

. is used for a style class definition hence,
.dvHeader would by used to assign the specified attributes (in this case the color red) to the Anchor element of a List Item of an un-numbered list
of class .dvHeader.

#dvHeader > A {color:red} would be used to match an anchor with the id value of #dvHeader and set its highlight color to red

No comments:

Post a Comment