Alt and title attributes of different elements

alt attribute

  In <img> tag, for example, to explain the alt attribute predetermined image instead of text. With the src attribute must exist for the same property.

< IMG the src = 'xxx.png' Alt = 'a test image' />

  When the image is loaded fails, replace the picture with alt attribute value is displayed on the browser.

  • alt attribute value is a string that can contain up to 1024 characters , including spaces and punctuation. The string must be enclosed in quotation marks. This alt text can contain entity references for special characters, but it must not contain other types of marks, especially not allowed to have any style tags.
  • When the user moves the mouse to the img element, Internet Explorer displays the value of an alt attribute. This behavior is not correct . All other browsers are closer to the norm, as long as when the image can not be displayed, will display an alternative text.

The title attribute

  title attribute typically used with <form> and <a> tag is an optional tag. Is a reminder text element (tooltip text). Usually mouse over the current element there will be a prompt text appears.

  

<element title='value' />

 

 


 

 

Having a title attribute, that there is a tag <title> title tag. All browsers support <title> tag, and a <head> tag must contain.

<title> element defines the title of the document .

The browser will use a special way to the title, and it is usually placed in the browser window's title bar or status bar on. Similarly, when a document is added to the list of users or links favorites or bookmarks list, the title will become the default name of the linked document.

 

  

Guess you like

Origin www.cnblogs.com/pingzi-wq/p/11409511.html