views:

92

answers:

4

hey everyone,

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

+3  A: 

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.

Thomas Owens
thnx, I'll try that :)
doro
+2  A: 

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

Will Hughes
I believe if you use entities, such as you can obtain things like new lines. However, I don't think there's a way to obtain bold text, and other markup.
Thomas Owens
Ah, yes, you're correct. Forgot about CR/LF. :)
Will Hughes
+1  A: 

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.

Traveling Tech Guy
+2  A: 

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

Rin