doro
doro

Reputation: 785

Is this possible in XHTML: tags in a title-attribute?

I got following code in an XHTML-document and every browser saysit is malformed :(

<a      class="tooltip" 
        title="Um nach einem <b>Datensatz zu suchen</b>, k&ouml;nnen Sie mehrere 
                Suchbegriffe auf einmal eingeben!<br />
                Um <b>Zeilen zu l&ouml;schen</b>, selektieren Sie diese bitte und 
                klicken dann auf <i>'Zeile(n) l&ouml;schen'</i>.<br />
                Um <b>einen Datansatz zu bearbeiten</b>, klicken Sie einfach zweimal 
                auf die Zelle und dann auf <i>'Done'</i>.<br />
                Um <b>eine Zeile hinzuzuf&uuml;gen</b>, klicken Sie auf <i>'Zeile 
                hinzuf&uuml;gen'</i>. Anschlie&szlig;end k&ouml;nnen Sie diese direkt
                editieren"
>
    <img src="img/info.png" width="35px" height="35px" id="fernglas" />
</a>

Now, is it malformed or not? If so, how could I make it right? Thnx in advance

... dg

Upvotes: 1

Views: 387

Answers (4)

user111013
user111013

Reputation:

You would have to entity encode the content within the title attribute. However the browser will not parse the attribute for HTML markup.

Upvotes: 2

AbstractProblemFactory
AbstractProblemFactory

Reputation: 9811

You could reach that effect by using JavaScript, just display div with position absolute etc ;)

Upvotes: 2

Traveling Tech Guy
Traveling Tech Guy

Reputation: 27811

I assume you're reading or rendering that title through a script?
If so, just replace every < with &lt; and every > with &gt; and unescape it later.

Upvotes: 1

Thomas Owens
Thomas Owens

Reputation: 116169

You can indeed use HTML character entities in the title attribute of a tag. However, you are trying to use HTML tags, which does not appear allowed. You won't be able to use things like bold and italics, but you will be able to add line breaks and some other simple formatting.

Upvotes: 3

Related Questions