Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Vertical Accordion Menu In Fluid Layout

Featured Replies

Hello All,

 

I am new to web design and I am playing with some new designs. I have been searching for new tutorials and customizing them to what I want. I am playing around with this fluid layout:

 

http://matthewjamest...ct-3-column.htm

 

I would like to add this verical accordion menu to the left column of the layout:

 

http://webdesign.tut...e-css3-version/

 

 

I can't seem to get the accordion to work. I put the menu in the "col2" div and the html shows up along with some of the styling but not accordion effect.

 

I would be appreciative is anyone has any tips or direction they could share.

 

Thanks!

herre you go working example here

 

http://www.html5imageeditor.co.uk/wdf/accordion2/

 

instructions first download the demo files

 

http://webdesign.tutsplus.com/tutorials/site-elements/orman-clarks-vertical-navigation-menu-the-css3-version/

 

make sure you have your csslayout.css in the root

 

and here is the html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB">
<head>
<title>The Perfect 3 Column Liquid Layout: No CSS hacks. SEO friendly. iPhone compatible.</title>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
<meta name="description" content="The Perfect 3 Column Liquid Layout: No CSS hacks. SEO friendly. iPhone compatible." />
<meta name="keywords" content="The Perfect 3 Column Liquid Layout: No CSS hacks. SEO friendly. iPhone compatible." />
<meta name="robots" content="index, follow" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="csslayout.css" media="screen" />
<link rel="stylesheet" href="css/styles.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
</head>
<body>
<div id="header"> </div>
</div>
<div class="colmask threecol">
 <div class="colmid">
   <div class="colleft">
  <div class="col1">
    <!-- Column 1 start -->
    <h2>Percentage dimensions of the holy grail layout</h2>
    <img src="perfect-3-column-dimensions.gif" width="350" height="370" alt="Three column layout dimensions" />
    <p>All the dimensions are in percentage widths so the layout adjusts to any screen resolution. Vertical dimensions are not set so they stretch to the height of the content.</p>
    <h3>Maximum column content widths</h3>
    <p>To prevent wide content (like long URLs) from destroying the layout (long content can make the page scroll horizontally) the column content divs are set to overflow:hidden. This chops off any content that is wider than the div. Because of this, it's important to know the maximum widths allowable at common screen resolutions. For example, if you choose 800 x 600 pixels as your minimum compatible resolution what is the widest image that can be safely added to each column before it gets chopped off? Here are the figures:</p>
    <dl>
	  <dt><strong>800 x 600</strong></dt>
	  <dd>Left & right columns: 162 pixels</dd>
	  <dd>Center page: 357 pixels</dd>
	  <dt><strong>1024 x 768</strong></dt>
	  <dd>Left & right columns: 210 pixels</dd>
	  <dd>Center page: 459 pixels</dd>
    </dl>
    <h2>The nested div structure</h2>
    <p>I've colour coded each div so it's easy to see:</p>
    <img src="perfect-3-column-div-structure.gif" width="350" height="369" alt="Three column layout nested div structure" />
    <p>The header, colmask and footer divs are 100% wide and stacked vertically one after the other. Colmid is inside colmask and colleft is inside colmid. The three column content divs (col1, col2 & col3) are inside colleft. Notice that the main content column (col1) comes before the other columns.</p>
    <!-- Column 1 end -->
  </div>
  <div class="col2">
    <!-- Column 2 start -->

    <div id="wrapper">
	  <ul class="menu">
	    <li class="item1"><a href="#">Friends <span>340</span></a>
		  <ul>
		    <li class="subitem1"><a href="#">Cute Kittens <span>14</span></a></li>
		    <li class="subitem2"><a href="#">Strange “Stuff” <span>6</span></a></li>
		    <li class="subitem3"><a href="#">Automatic Fails <span>2</span></a></li>
		  </ul>
	    </li>
	    <li class="item2"><a href="#">Videos <span>147</span></a>
		  <ul>
		    <li class="subitem1"><a href="#">Cute Kittens <span>14</span></a></li>
		    <li class="subitem2"><a href="#">Strange “Stuff” <span>6</span></a></li>
		    <li class="subitem3"><a href="#">Automatic Fails <span>2</span></a></li>
		  </ul>
	    </li>
	    <li class="item3"><a href="#">Galleries <span>340</span></a>
		  <ul>
		    <li class="subitem1"><a href="#">Cute Kittens <span>14</span></a></li>
		    <li class="subitem2"><a href="#">Strange “Stuff” <span>6</span></a></li>
		    <li class="subitem3"><a href="#">Automatic Fails <span>2</span></a></li>
		  </ul>
	    </li>
	    <li class="item4"><a href="#">Podcasts <span>222</span></a>
		  <ul>
		    <li class="subitem1"><a href="#">Cute Kittens <span>14</span></a></li>
		    <li class="subitem2"><a href="#">Strange “Stuff” <span>6</span></a></li>
		    <li class="subitem3"><a href="#">Automatic Fails <span>2</span></a></li>
		  </ul>
	    </li>
	    <li class="item5"><a href="#">Robots <span>16</span></a>
		  <ul>
		    <li class="subitem1"><a href="#">Cute Kittens <span>14</span></a></li>
		    <li class="subitem2"><a href="#">Strange “Stuff” <span>6</span></a></li>
		    <li class="subitem3"><a href="#">Automatic Fails <span>2</span></a></li>
		  </ul>
	    </li>
	  </ul>
    </div>

    <!--initiate accordion-->
    <script type="text/javascript">
$(function() {

 var menu_ul = $('.menu > li > ul'),
	    menu_a  = $('.menu > li > a');

 menu_ul.hide();

 menu_a.click(function(e) {
	 e.preventDefault();
	 if(!$(this).hasClass('active')) {
		 menu_a.removeClass('active');
		 menu_ul.filter(':visible').slideUp('normal');
		 $(this).addClass('active').next().stop(true,true).slideDown('normal');
	 } else {
		 $(this).removeClass('active');
		 $(this).next().stop(true,true).slideUp('normal');
	 }
 });

});
</script>
    <h2>No CSS hacks</h2>
    <p>The CSS used for this layout is 100% valid and hack free. To overcome Internet Explorer's broken box model, no horizontal padding or margins are used in conjunction with a width. Instead, this design uses percentage widths and clever relative positioning.</p>
    <h2>SEO friendly 2-1-3 column ordering</h2>
    <p>The higher up content is in your page code, the more important it is considered by search engine algorithms (see my article on <a href="http://matthewjamestaylor.com/blog/link-source-ordering-seo">link source ordering</a> for more details on how this affects links). To make your website as optimised as possible, your main page content must come before the side columns. This layout does exactly that: The center page comes first, then the left column and finally the right column (see the nested div structure diagram for more info). The columns can also be configured to any other order if required.</p>
    <h2>Full length column background colours</h2>
    <p>In this layout the background colours of each column will always stretch to the length of the longest column. This feature was traditionally only available with table based layouts but now with a little CSS trickery we can do exactly the same with divs. Say goodbye to annoying short columns! You can read my article on <a href="http://matthewjamestaylor.com/blog/equal-height-columns-cross-browser-css-no-hacks">equal height columns</a> if you want to see how this is done.</p>
    <h2>No Images</h2>
    <p>This layout requires no images. Many CSS website designs need images to colour in the column backgrounds but that is not necessary with this design. Why waste bandwidth and precious HTTP requests when you can do everything in pure CSS and XHTML?</p>
    <h2>No Javascript</h2>
    <p>Javascript is not required. Some website layouts rely on Javascript hacks to resize divs and force elements into place but you won't see any of that nonsense here. The Javascript at the bottom of this page is just my Google Analytics tracking code, you can remove this when you use the layout.</p>
    <h2>Resizable text compatible</h2>
    <p>This layout is fully compatible with resizable text. Resizable text is important for web accessibility. People who are vision impaired can make the text larger so it's easier for them to read. It is becoming increasingly more important to make your website resizable text compatible because people are expecting higher levels of web accessibility. Apple have made resizing the text on a website simple with the pinch gesture on their multi-touch trackpad. Is your website text-resizing compatible?</p>
    <h2>No Quirks Mode</h2>
    <p>This liquid layout does not require the XML declaration for it to display correctly in older versions of Internet Explorer. This version works without it and is thus never in quirks mode.</p>
    <h2>No IE Conditional Comments</h2>
    <p>Only one stylesheet is used with this layout This means that IE conditional comments are not needed to set extra CSS rules for older versions of Internet Explorer.</p>
    <!-- Column 2 end -->
  </div>
  <div class="col3">
    <!-- Column 3 start -->
    <div id="ads"> <a href="http://matthewjamestaylor.com"> <img src="mjt-125x125.gif" width="125" border="0" height="125" alt="Art and Design by Matthew James Taylor" /> </a> </div>
    <h2>Browser Compatibility</h2>
    <p>This 3 column liquid Layout has been tested on the following browsers:</p>
    <h3>iPhone & iPod Touch</h3>
    <ul>
	  <li>Safari</li>
    </ul>
    <h3>Mac</h3>
    <ul>
	  <li>Safari</li>
	  <li>Firefox</li>
	  <li>Opera 9.25</li>
	  <li>Netscape 9.0.0.5 & 7.1</li>
    </ul>
    <h3>Windows</h3>
    <ul>
	  <li>Firefox 1.5, 2 & 3</li>
	  <li>Safari</li>
	  <li>Opera 8.1 & 9</li>
	  <li>Google Chrome</li>
	  <li>Explorer 5.5, 6 & 7</li>
	  <li>Netscape 8</li>
    </ul>
    <h2>Valid XHTML strict markup</h2>
    <p>The HTML in this layout validates as XHTML 1.0 strict.</p>
    <h2>This layout is FREE for anyone to use</h2>
    <p>That's right, you don't have to pay anything. If you are feeling generous however, link back to this page so other people can find and use this layout too.</p>
    <h2>Centered menus compatible</h2>
    <p>This layout is fully compatible with my <a href="http://matthewjamestaylor.com/blog/beautiful-css-centered-menus-no-hacks-full-cross-browser-support">cross-browser compatible centered menus</a>.</p>
    <!-- Column 3 end -->
  </div>
   </div>
 </div>
</div>
<div id="footer">
 <p>This page uses the <a href="http://matthewjamestaylor.com/blog/perfect-3-column.htm">Perfect 'Holy Grail' 3 Column Liquid Layout</a> by <a href="http://matthewjamestaylor.com">Matthew James Taylor</a>. View more <a href="http://matthewjamestaylor.com/blog/-website-layouts">website layouts</a> and <a href="http://matthewjamestaylor.com/blog/-web-design">web design articles</a>.</p>
</div>
</body>
</html>

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.