Advanced Java and Web Technologies for JNTUK
Blog providing beginner tutorials on different web technologies like HTML, CSS, Javascript, PHP, MYSQL, XML, Java Beans, Servlets, JSP and AJAX

28/01/2014 Categories: CSS. No Comments on Anatomy of a CSS rule

A style sheet contains several rules (CSS rules). A CSS rule is made of two elements: a selector and one or more declarations enclosed in braces ({}). The syntax for a CSS rule is shown below:



Syntax of a CSS style rule can be understood clearly by looking at the figure below:




The selector specifies the HTML element to which the presentation effects should be applied and the declaration contains two parts: property-name and property-value.


A HTML element can have several presentational properties and corresponding property values. An example for applying green colour to a paragraph element is shown below:



Related Links:

Note: Do you have a question on this article or have a suggestion to make this article better? You can ask or suggest us by filling in the below form. After commenting, your comment will be held for moderation and will be published in 24-48 hrs.

Leave a Reply

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

Scroll Up