Character Entities in HTML ka use reserved HTML characters ko safely display karne ke liye kiya jata hai. Kuch characters HTML me special meaning rakhte hain, isliye unhe direct use karne ki jagah character entities ka use kiya jata hai.
Example:
-
<(less than) =< -
>(greater than) =>
Is tarah Character Entities in HTML browser ko batate hain ki yeh characters text ke roop me display hone chahiye, tag ke roop me nahi.
HTML Character Entities
Kuch characters HTML me reserved characters hote hain. Agar aap apne HTML text me less than < ya greater than > sign use karte ho, to browser unhe HTML tags samajh sakta hai.
Is problem ko solve karne ke liye Character Entities in HTML use ki jaati hain.
Reserved HTML characters ko display karne ke liye entity names ya entity numbers use kiye jaate hain.
Entity Name Format
Entity Number Format
Example:
Less than sign < display karne ke liye likhna padta hai: < ya <
Non-breaking Space
Character Entities in HTML ka ek common example non-breaking space hai.
Non-breaking space ka matlab hai aisa space jo next line me break nahi hota.
Agar do words non-breaking space se separate honge, to wo next line me split nahi honge.
Example:
-
§ 10
-
10 km/h
-
10 PM
Yeh cases me words ko ek saath rakhna important hota hai.
Extra Spaces Preserve Karna
Normally browser multiple spaces ko ignore kar deta hai.
Agar aap text me 10 spaces likhoge, to browser unhe single space me convert kar dega.
Agar aapko actual multiple spaces show karni hain, to Character Entities in HTML ka use karke add kar sakte ho.
Example:
Isse multiple spaces properly display honge.
Non-breaking Hyphen
Ek aur useful entity hai non-breaking hyphen.
Yeh aisa hyphen define karta hai jo next line me break nahi hota.
Example:
Isse text line change hone par bhi word break nahi hota.
Is tarah Character Entities in HTML developers ko reserved characters ko safely display karne aur text formatting control karne me help karti hain. Character entities ka use karke HTML content clear, readable aur properly formatted banaya ja sakta hai.