Forum Moderators: open

Message Too Old, No Replies

Putting div title on two lines

         

asdasddd

11:48 am on May 19, 2005 (gmt 0)

10+ Year Member



I want to show the title of the div in two lines, so I write a test like below. When I set title of the div in div tag, it doesn't work. But when I set the div's title through js, the title is shown in two lines properly. Why can't I show div's title in two lines by setting title in the div tag?

If I want to show div's title in two lines by setting title in the div tag, how can I do it?

Thanks!


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
</head>

<body>
<div id="dd"style="width:300px;height:300px;border:1px #00f solid;"title="jiuououu\nuiojij"></div>
<button onclick="document.getElementById('dd').title='first line\nsecond line';">click</button>
</body>
</html>

BlobFisk

12:12 pm on May 19, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There really is no sure fire way of doing this unfortunately. You can put the line break in the code:


<div id="dd" style="width:300px;height:300px;border:1px #00f solid;" title="jiuououu <!--Manual Line Break in Code
uiojij"></div>

This can produce the desired effect, but you may see some browser complaining, and I have a feeling that an HTML validator may throw an error on this.

Previously discussed here: [webmasterworld.com...]

asdasddd

12:25 pm on May 19, 2005 (gmt 0)

10+ Year Member



No, I have tried to act as this:
<div id="dd"style="width:300px;height:300px;border:1px #00f solid;"title="jiuououu <br /> uiojij"></div>

it doesn't work.

Thank's for your reply!

BlobFisk

12:37 pm on May 19, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Not a <br> but actually hit return in your source code!

Span

1:22 pm on May 19, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try this: <p title="carriage &#13; return">

BlobFisk

1:25 pm on May 19, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Span seems to have hit the nail on the head with the escape key!

asdasddd

12:51 am on May 20, 2005 (gmt 0)

10+ Year Member



Thank you very much, I got it.

Nice to see your replies, have a great day!