HOME
          About US
          Contact Us

ID Selector CSS

Chapter 14.1 - ID Selector CSS: (Page 2/5)


(Cotinued from previous page)

Chapter 14 : CSS Id, Class Elements and Pseudo Elements A CSS segment generally has two parts:
i) Selector: This is HTML element, for which we want the style

ii) Declarations: This is the definition of the style for selector. This has got further two parts

a) Property: Property of declaration e.g. color, size, location etc. All the property ends with a symbol ':'

b) Value: This is property value e.g. Red, 10 px etc. All the value ends with a symbol ';'.

NOTE: The command are written within '{' and '}'. The command follow the same pattern for Body, Paragraph, Text, Headings, Divisions etc. i.e.

A typical example is (If you want to define the back ground color as 'Red')

For Body:
body {background-color:ID Selector CSSff0000;}

For Heading it will be:
h1{background-color:ID Selector CSSff0000;}

for division:
div {background-color:ID Selector CSSff0000;}
and so on ...
(In above examples body, h1 and div are 'selector' ; background-color is 'property' ; ID Selector CSSff0000 is value)



14.1- id Selector (ID Selector CSS): The id selector is used to specify a style for a single division / element. In CSS it is defines by a symbol 'ID Selector CSS'.

(In our exercise refer file style.css. The center, left etc. are all 'id selector')
ID Selector CSScenter { width: 800px; height: 60px;
position: absolute; left: 100px; top: 100px; }


Here 'center' is id selector, 'width' is property and '800px' is value. In HTML this style will be used between <div id='center'> and </div> tag. NOTE: Always start an 'id' name with Alphabet.

(Cont......... to next page (Pg-3))

ID Selector CSS © funandhobby.com (ID Selector CSS)