ArK
ArK

Reputation: 21068

Max length of Title Attribute

What is the length limitation of HTML title attribute?

<span title="some big long piece of text and is there any limit to its size?" />

Edit:

My question is specific to title attribute not general

Upvotes: 49

Views: 70969

Answers (6)

Jonathan Basile
Jonathan Basile

Reputation: 679

I just tried this out for Chrome, Safari, and Firefox with HTML5:

Chrome limits to 1024.

Safari had no limit (I tried up to 3250)

Firefox also had no limit up to 3250. As @jukka mentioned, though, Firefox does not automatically insert linebreaks.

Upvotes: 21

Roman Newaza
Roman Newaza

Reputation: 11690

According W3C,

The title should ideally be less than 64 characters in length. That is, many applications will display document titles in window titles, menus, etc where there is only limited room. Whilst there is no limit on the length of a title (as it may be automatically generated from other data), information providers are warned that it may be truncated if long.

Check it out: The TITLE element in HTML

Upvotes: 0

Ashkan
Ashkan

Reputation: 636

Titles are limited to 512 total characters in internet explorer according to MSDN.

http://msdn.microsoft.com/en-us/library/ie/ms534683(v=vs.85).aspx

Upvotes: 41

Kevin Ji
Kevin Ji

Reputation: 10489

There is no length limitation in either HTML 4.01 or HTML5, although long tooltips are usually a sign that you should be placing that text elsewhere, possibly before or after. (I said "usually" because xkcd uses the tooltips effectively, though the description could still be put underneath the image with the same relative effect.)

Upvotes: 6

Jukka K. Korpela
Jukka K. Korpela

Reputation: 201568

There is no limit in the specifications, but when you go past 48 characters, browsers will treat it differently—IE breaks the text to two or more lines, whereas Firefox doesn’t. Firefox doesn’t honor explicit line breaks in source (this is, debatably, correct behavior).

So the practical conclusion is: if you need to ask, it’s too long, and you should use some other technique. The title attribute is normally used for the “tooltip” effect, and similar effects can be created (with better usability) using CSS (and possibly JavaScript).

Upvotes: 6

span
span

Reputation: 5624

The implementation in browsers differ but I think HTML 4.01 is 128 chars. I've seen limits from 80 chars up to 2000 being mentioned on the web.

Upvotes: 2

Related Questions