Do I need javascript ?

C

Chris Leonard

Hi.

I'm building up a page which uses multiple divs to display information from
a menu. As each menu item is 'clicked' I want the corresponding div to
display.

I've done something similar with JavaScript a long time ago but being new to
CSS I wondered if it was possible without using JavaScript. I'm pretty sure
I nedd to use some js as I understand CSS only provides the format, it
doesn't "do" anything itself

Anyone offer me some smart advice please on a way forward.

Thanks in advance

Chris
 
E

Els

Chris said:
Hi.

I'm building up a page which uses multiple divs to display information from
a menu. As each menu item is 'clicked' I want the corresponding div to
display.

I've done something similar with JavaScript a long time ago but being new to
CSS I wondered if it was possible without using JavaScript. I'm pretty sure
I nedd to use some js as I understand CSS only provides the format, it
doesn't "do" anything itself

Anyone offer me some smart advice please on a way forward.

Not really smart advice, but why don't you make pages?
Clickin on a link brings out the next page, which displays
the corresponding div. As you make the pages otherwise
identical, it 'looks just like javascript' ;-)

If the div which is to be displayed is merely a 'tooltip' to
the menu, you can include it in the link with a <span>, and
have it display:none when not clicked, and display:block
when clicked, using a:hover span{}.
 
E

Els

Els said:
If the div which is to be displayed is merely a 'tooltip' to the menu,
you can include it in the link with a <span>, and have it display:none
when not clicked, and display:block when clicked, using a:hover span{}.

Oops, not true. It will display when hovered, not when clicked.
Not sure if it can be made to stay after clicking it, with
a:active maybe? And you probably want it to 'go away' when
the next link is clicked, as well... :-(
 
B

Beauregard T. Shagnasty

Quoth the raven named Els:
If the div which is to be displayed is merely a 'tooltip' to the
menu, you can include it in the link with a <span>, and have it
display:none when not clicked, and display:block when clicked,
using a:hover span{}.

Wouldn't it be easier to get the tooltip effect by using the title
attribute, instead a a span? Assuming that will help the OP, of
course, and I'm not quite certain what he is asking.

<div title="Bunch of text that pops up when div is hovered">Whatever
is in the div here...</div>
 

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

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top