Hii! Im new here and im confused


#1

Im getting a message that special character should be escaped
So,Please help me


#2

Im also confused with ALT attribute
When is it used?


#3

There are some characters that are reserved in HTML (i.e. they have a special meaning). For example, the left and right angle brackets (< and >). If they weren't, then the web browser might get confused between what were HTML elements and what was purely content, in your HTML code.

To get around this, you can use an escape character in your code instead of the normal character. For example, if you want to use a left angle bracket (<) in your content, you could use &lt;, and for a right angle bracket, you could use &gt;.

Notice how each alternative for a character (also known as an entity reference) begins with an ampersand (&). This usage means that the ampersand itself is a reserved character, and the entity reference for an ampersand is &amp;. This is probably the most likely cause of your error message.

HTML5 and modern web browsers are now very lenient about when you need to escape characters, so this practice is starting to fade into history. However, if you're working with old code you'll probably come across it, so it's good to know. Also, a validator (a tool used for checking whether your code is valid according to the latest language specification) may throw out a similar error.

And one more thing : you can use entity references to quickly produce characters that you might not be able to find on your keyboard. For example, &copy; will produce the copyright symbol, and &euro; will produce the Euro currency sign :slight_smile:


#4

The alt attribute is used to provide a textual description of an image so a visitor can read it if they cannot see the image. This might be because they have very slow internet access and their connection has timed-out, or the image is no longer available.

The textual description is also read when the visitor is actually another computer program :slight_smile: such as a search engine spider like Googlebot or a screen reader application used by people with visual impairments.

It is down to you to decide how long or short the description needs to be. It all depends on how important the information is that you are trying to convey with the image. Some images will be purely decoration, in which case you can just leave the quotes empty, e.g. alt="".