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

Explain Different Types of Functions in JavaScript

A function is a piece of code to perform a specific task. Functions are basically of two types: ®pre defined (or) built in functions ® user defined functions Pre defined functio...

What are Scoping Rules? Why are they so Important in all Programming Languages?

Scoping is an important concept in programming. Scope determines how a variable can be accessed. In java script variables can be either local (or) global. Global:-  Global scop...

Explain Java Script Statement. Describe each of the Loop Constructs that Java Script Provides

Programs are composed of two things. ­® data ® code which manipulates the data Program instructions are grouped into units called statements. If else: Whenever we want to ...

Post a Comment

emo-but-icon
:noprob:
:smile:
:shy:
:trope:
:sneered:
:happy:
:escort:
:rapt:
:love:
:heart:
:angry:
:hate:
:sad:
:sigh:
:disappointed:
:cry:
:fear:
:surprise:
:unbelieve:
:shit:
:like:
:dislike:
:clap:
:cuff:
:fist:
:ok:
:file:
:link:
:place:
:contact:

item