Pankaj Morajkar Pankaj Morajkar - 1 year ago 54
CSS Question

How to place content within vertical menu?

I have the following vertical menus on my page. I want to insert content in each of these menus. I am unable to comprehend how to do it? When I click on the Menu 1 it should display content on the right of the page.

Find the screenshot.

enter image description here

#button {
width: 12em;
border-right: 1px solid #000;
padding: 0 0 1em 0;
margin-bottom: 1em;
font-family: 'Trebuchet MS', 'Lucida Grande', Verdana, Arial, sans-serif;
background-color: #90bade;
color: #333;
#button ul {
list-style: none;
margin: 0;
padding: 0;
border: none;
#button li {
border-bottom: 1px solid #90bade;
margin: 0;
list-style: none;
list-style-image: none;
#button li a {
display: block;
padding: 5px 5px 5px 0.5em;
border-left: 10px solid #1958b7;
border-right: 10px solid #508fc4;
background-color: #2175bc;
color: #fff;
text-decoration: none;
width: 100%;
html>body #button li a {
width: auto;
#button li a:hover {
border-left: 10px solid #1c64d1;
border-right: 10px solid #5ba3e0;
background-color: #2586d7;
color: #fff;

<div id="button">
<li><a href="#">'Menu 1'</a>
<li><a href="#">'Menu 2'</a>
<li><a href="#">'Menu 3'</a>
<li><a href="#">'Menu 4'</a>
<li><a href="#">'Menu 5'</a>
<li><a href="#">'Menu 6'</a>

Answer Source

Hello See my below demo when you click on the menu it will show the content right side i have only done this for 3 menu only others will be same

use jQuery to do this easily


 $(document).ready(function () {
 $('#button ul li:first').addClass('active');
 $('#button ul li a').click(function (event) {
    var content = $(this).attr('href');

I added a liitle Css

 .active {
 .section {
 #button {

also and some html elements for content section

 <div id="section-Menu1" class="tab-content">
 <h2>Menue 1</h2>
 <p>Welcome Menue 1 Text.</p>

see the below Fiddle details

**If you dont want menu1 being active then just remove $('#button ul li:first').addClass('active'); and write $('.tab-content').hide();below instead of$('.tab-content:not(:first)').hide();

Hope It helps You MenuSidebarFiddle