Character Entities

In order to display special symbols like <, >, &, “having some predefined meaning we use character entities because that cannot display directly in web pages. Entities are represented with entity name. These are starts with an ampersand (&) symbol and ends with semi colon (;). There are two ways.

Syntax1: &entityname;

Eg:1) 20 < 30  Þ  20 & lt ; 30     
                           
(or) 

 Syntax2: &entitynumber;  
                                              
Eg: 2) 20 & # 60 30 Þ 20 < 30

To display ‘< ‘sign in html page we must write & lt; or &#60 because it treats it as. Instruction.

Entities are case sensitive, we can use only lower case letters to write entities.

Eg:Good---Morning.     [Non breaking space-nbsp]
Good &nbsp;&nbsp;&nbsp; Morning.

The most common character entities are:

Result
Description
Entity name
Entity number
1. Space
Non breaking space
& nbsp ;
& = &
& # 160 ;
2. <
Less than
& lt ;
& # 60 ;
3. >
Greater than
& gt ;
& # 62 ;
4. &
ampresend
& amp ;
& # 38 ;
5. “
(double quote quotation  mark)
& quote ;
& # 34 ;

Eg: u & i sing“Happy Birthday “ song.
       u &amp; I sing  &quote; Happy Birthday &quote; song.  

Related

Web Technology 7618657712711972368

Post a Comment

emo-but-icon

item