How to achieve an effect?

D

Dung Ping

Hello,

I like to achieve following on my web page:

When the visitor moves the cursor to a word on the page, a small square
will appear besides it. In the square the visitor will be able to see
explanation about the word. The size of the square depends on how
many words in it. This is exactly like what happens on MS Windows.
When moving the cursor to an icon, information about it will appear in
a square besides it.

With the html, this effect may be achieved with the title attribute
within img tag. But I like it to happen when the cursor moves over
text.

Thanks.
 
B

Beauregard T. Shagnasty

Dung said:

Good morning.
I like to achieve following on my web page:

When the visitor moves the cursor to a word on the page, a small
square will appear besides it. In the square the visitor will be able
to see explanation about the word. The size of the square depends
on how many words in it. This is exactly like what happens on MS
Windows. When moving the cursor to an icon, information about it will
appear in a square besides it.

With the html, this effect may be achieved with the title attribute
within img tag. But I like it to happen when the cursor moves over
text.

Will this suffice? If you want more than a hundred characters, you'll
have to resort to some JavaScript trickery, which of course won't work
for those with it disabled or unavailable.

CSS:
..tip { border-bottom: 1px dotted; }

HTML:
<p>A long, long time ago in a
<span class="tip" title="A galaxy is very large and you can't get to the
other side before supper">galaxy</span>
far, far away ...</p>
 
F

fuliopen

Beauregard said:
Good morning.


Will this suffice? If you want more than a hundred characters, you'll
have to resort to some JavaScript trickery, which of course won't work
for those with it disabled or unavailable.

CSS:
.tip { border-bottom: 1px dotted; }

HTML:
<p>A long, long time ago in a
<span class="tip" title="A galaxy is very large and you can't get to the
other side before supper">galaxy</span>
far, far away ...</p>

Thanks a lot. It works well. By the way, can the font in the
rectangle be changed, such as color or size?

Thanks again.
 
J

Jim Moe

Dung said:
With the html, this effect may be achieved with the title attribute
within img tag. But I like it to happen when the cursor moves over
text.
See the <dfn> element.
 
B

Beauregard T. Shagnasty

Thanks a lot. It works well. By the way, can the font in the
rectangle be changed, such as color or size?

The rectangle is normally referred to as a "tooltip" and is controlled
by the browser and the operating system. No way to change it that I know
about.
 
D

Dung Ping

Beauregard said:
The rectangle is normally referred to as a "tooltip" and is controlled
by the browser and the operating system. No way to change it that I know
about.

I want to apologize for the confusion that I may have caused by using
two different email names on this thread.

Thank all for help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top