Forum Moderators: not2easy

Message Too Old, No Replies

Hide/Show text with CSS

         

Miles_J

10:38 am on Feb 10, 2006 (gmt 0)

10+ Year Member




Hi, im currently designing a site for a friend. Currently his site has a huge list of links down the left hand side of the page which i was hoping to catagorise in order to make it look neater. I want to be able to click a link on the left which would make subcatagories visible in the Nav bar. I know its possible to hide/show text without having to reload the page, im just not sure how to do it :(

Can it be done with CSS? as i dont really want to use JavaScript.

Thanx for any advice.

Iguana

10:48 am on Feb 10, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sorry - you need to use Javascript.

xfinx

11:14 am on Feb 10, 2006 (gmt 0)

10+ Year Member



You can use this:

display: none; #to hide an item and give it no position;
visibility: hidden; #to hide an item but leave it on its place;
with: diplay: block/inline/auto(?) or visibility visible you can make it visible..

but the switch has to me made in js, this can be done without reloading a page..

function hideElement(i) {
var e = document.getElementById(i);
if (e) {
e.style.visibility = 'hidden';
}
}

function showElement(i) {
var e = document.getElementById(i);
if (e) {
e.style.visibility = 'visible';
}
}

use it on a link, <a href="javascript:hideElement(the id of the element you want to hide">hide ding</a>

Miles_J

4:16 pm on Feb 10, 2006 (gmt 0)

10+ Year Member



ok cool, thanks :)