On Wed, Apr 13, 2011 at 1:17 PM, Aaron Gray <[email protected]>wrote:
> Hi,
>
> I cannot remember how to do this or what it is called.
>
> But I am looking for some CSS that allows a number of "menu" or selector
> links that change the displayed 'div' on the main page, displaying say a
> different image.
>
> Basically I want a single web page that has a number of links that select
> the pages contents via CSS rather than JavaScript.
>
> Many thanks in advance,
>
> Aaron
> ______________________________________________________________________
>
>
If you want to be able to click on an element (say <a>link</a>) and have it
effect change in another element on the page (a <div></div> perhaps) you are
out of luck without JavaScript? This is not possible with CSS particularly
because there is no "on click" available to CSS. You can use ":hover" but
you will be limited to affecting either an element inside of the element you
are hovring on, or using some sort of selector.
For instance:
a.linkOne:hover + div {border: 1px #000 solid;}
would put a border around any div *immediately" following the link in
question.
But if you have a list of links at the top of the page and a bunch of
content divs down the page (a FAQ, for instance), you will not be able to
target specific containers by hovering or clicking the links without JS.
Depending on the markup, you might be able to do something with nth child
selectors:
http://www.w3.org/TR/2009/PR-css3-selectors-20091215/#nth-child-pseudo
Tim
--
[email protected]
______________________________________________________________________
css-discuss [[email protected]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/