CSS Styling for AJAX Accordion Control

Some simple CSS styling rules for an AJAX Accordion Control

The AJAX Accordian Panel is a great little too that comes as part of the AJAX Toolkit. It saves a lot of space while still allowing you to condense a lot of information into a single page.
Before using this, it may we worth checking up on the following. AJAX Toolkit
The control requires you to download and add to Visual Studio, I won't go into that in this article though.

The control is made of the following parts. Your content for each goes in between the Content Tags.

HTML

<asp:Accordion ID="Accordion1" runat="server" CssClass="accordion"
 ContentCssClass="accordionContent" HeaderCssClass="accordionHeader"
 HeaderSelectedCssClass="accordionHeaderSelected">
 <Panes>
 <asp:AccordionPane ID="PaneOne" runat="server" CssClass="accordion">
 <Header>Pane1</Header>
 <Content>
 </Content>
 </asp:AccordionPane>
 <asp:AccordionPane ID="PaneTwo" runat="server" CssClass="accordion">
 <Header>Pane2</Header>
 <Content>
 </Content>
 </asp:AccordionPane>
 </Panes>
</asp:Accordion>
This is the code I have used to style the accordian pane on my login page, by using the CSS you only need to set the style once, and that is setting the style as CssClass="accordion". You can also see there are three other sections set above.
A breakdown of the code as follows;
accordian is the outer container, all I am setting here are the border radius and widths.

CSS

.accordion
{
width98%;
marginauto;
border-radius5px;
moz-border-radius5px;
border1px solid #6C5A39;
background-color#DED3BE;
}
Accordian header is the style for all un selected headers.

CSS

.accordionHeader
{
border-radius5px;
moz-border-radius5px;
background-color#DED3BE;
font-weightbold;
text-aligncenter;
padding0px 0px 2px 0px;
}
This is the selected header, by setting this as a different colour the user can easily identify what tab they have selected.

CSS

.accordionHeaderSelected
{
border-top-right-radius5px;
border-top-left-radius5px;
moz-border-top-right-radius5px;
moz-border-top-left-radius5px;
border-bottom1px solid #6C5A39;
background-color#D1C2A5;
font-weightbold;
color#000000;
text-aligncenter;
padding0px 0px 2px 0px;
}
Now we can add some styling to the content area, this sets the colour for the background of the selected tab.

CSS

.accordionContent
{
border-bottom-right-radius5px;
border-bottom-left-radius5px;
moz-border-bottom-right-radius5px;
moz-border-bottom-left-radius5px;
background-colorWhite;
}
The code above is obviously just the beginning of what you could do.
Ousia Logo