Archive for April 15th, 2008

What is the difference between ID and CLASS?

Tuesday, April 15th, 2008

ID identifies and sets style to one and only one occurrence of an element while class can be attached to any number of elements. By singling out one occurrence of an element the unique value can be declared to said element.
CSS
#eva1 {background: red; color: white}
.eva2 {background: red; color: white}
HTML - ID
<P ID=eva1>Paragraph 1 - ONLY THIS occurrence of the element P (or single occurrence of some other element) can be identified as eva1</P>
<P ID=eva1>Paragraph 2 - This occurrence of the element P CANNOT be identified as eva1</P>
HTML - CLASS
<P class=eva2>Paragraph 1 - This occurrence of the element P can be classified as eva2</P>
<P class=eva2>Paragraph 2 - And so can this, as well as occurrences of any other element, </P>

Posted by Mahesh ( Tryangled )

What does \ABCD (and \ABCDE) mean?

Tuesday, April 15th, 2008

CSS allows Unicode characters to be entered by number. For example, if a CLASS value in some Russian document contains Cyrillic letters EL PE (Unicode numbers 041B and 041F) and you want to write a style rule for that class, you can put that letter into the style sheet by writing:
.41B41F {font-style: italic;}
This works on all keyboards, so you don’t need a Cyrillic keyboard to write CLASS names in Russian or another language that uses that script.
The digits and letters after the backslash (\) are a hexadecimal number. Hexadecimal numbers are made from ordinary digits and the letters A to F (or a to f). Unicode numbers consist of four such digits.
If the number starts with a 0, you may omit it. The above could also be written as:
.\41B\41F {font-style: italic;}
But be careful if the next letter after the three digits is also a digit or a letter a to f! This is OK: .\41B-\41F, since the dash (-) cannot be mistaken for a hexadecimal digit, but .\41B9\41F is only two letters, not three.
Four digits is the maximum, however, so if you write:
.41B941F {font-style: italic;}

Posted by Mahesh ( Tryangled )

How do I draw a box with CSS?

Tuesday, April 15th, 2008

To draw a box of a fixed shape all you need to do is specify the width and height of the area.You can then add padding and border to your box which will surround your content.
This code has produced green box
<style type=”text/css” media=”screen”>

.box {
background:#829900;
color:#fff; padding: 5px;
height: 340px;
width: 340px;
margin-top: 5px;
margin-right: auto;
margin-bottom: 5px;
margin-left: auto;
}
</style>

<div class=”box”>
</div>
f you don’t know the size of the content you can always set the width and height to auto so that the box expands and shrinks as required.

Posted by Mahesh ( Tryangled )