You are here: Re: Best way to dynamically change background color of a span or div? « HTML « IT news, forums, messages
Re: Best way to dynamically change background color of a span or div?

Posted by Ben C on 10/24/95 12:00

On 2006-09-29, Boonish <boog@felch.com> wrote:
> I have a page with a series of questions as links on the left, and
> paragraphs of answers in a column to the right. What I'd like to have
> happen is when the user clicks on a question to the left, the answer to
> the right changes it's background color slightly to draw attention.
>
> What's the easiest way of going about this? TIA.

You can use the :active pseudo

e.g.:

..question:active .answer
{
background-color: yellow;
}

<div class="question">
What's the difference between a duck?
<div class="answer">
One of its legs is both the same
</div>
</div>

You could use <dl>, <dt>, <dd> etc for the questions and answers, and
style them appropriately.

This might mean changing how your content's organized a bit. If the
answers are highly dissociated from the questions in the document
structure, it might be easier to use JS and "onclick" events.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация