# Thread: expand collapse content using CSS

1. Registered User
Join Date
Nov 2011
Posts
1

## expand collapse content using CSS

Hi, I'm new to the forum. I saw one of Ultimator's posts where he gives this code (see bellow) and I was wondering if it could have the three buttons by themselves, and when user clicks a button, the diplayed content appears underneath...

here's the code Ultimator posted:

--------------------------------------------
<script type="text/javascript">
function toggleMe(a){
var e=document.getElementById(a);
if(!e)return true;
if(e.style.display=="none"){
e.style.display="block"
}
else{
e.style.display="none"
}
return true;
}
</script>

<p id="para1">
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
</p>
<br>
<div id="para2">
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah</div>
<br>
<span id="para3">blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah</span>

--------------------------------------------

Thanks a lot

2. Use CSS to place the divs and buttons anywhere you like. The JS code only toggles the display.