0

I have a div tag which is a main container and inside I have three more. now what I want to do is to put them to the right of everyone. I mean one div will be at the left side one in the middle and the third one on the right. but the only div which will be visible is the left first and the rest of them will not be visible. I used overflow hidden but not working.

here is my code. Please tell me what am I doing wrong.

<!DOCTYPE HTML>
<html lang="en">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
    <style>
        body {
            margin: 0;
        }
        #header {
            width: 100%; height: 50px;
            background: aqua;
        }
        ul {
            list-style: none;
            margin: 0;
        }
        ul li {
            float: left;
            margin-right: 30px;
        }
        #contents {
            width: 100%; height: 600px; overflow: hidden;
            background: lightblue;
        }
        .contentsWrapper {
            display: block;
            width: 100%; height: 300px;
        }
        #contentsOne { background: red; }
        #contentsTwo { background: blue; }
        #contentsThree { background: grey; }
    </style>
    <title>title</title>
</head>
<body>
    <div id="header">
        <ul>
            <li><a href="#">Home</a></li>
            <li><a href="#">FAQ</a></li>
            <li><a href="#">Contact Us</a></li>
        </ul>
    </div>
    <div id="contents">
        <div class="contentsWrapper" id="contentsOne">One</div>
        <div class="contentsWrapper" id="contentsTwo">Two</div>
        <div class="contentsWrapper" id="contentsThree">Three</div>
    </div>
</body>
</html>

2 Answers 2

1

I don't know if I understood your problem, do you want something like this? http://jqueryui.com/demos/accordion/fillspace.html you can use jQuery plugin from demo for that and add on each part you want.

Sign up to request clarification or add additional context in comments.

Comments

0

Is this what you want?

Replace:

#contentsOne { background: red; }
#contentsTwo { background: blue; }
#contentsThree { background: grey; }

with:

#contentsOne { background: red; float:left;width:33%;}
#contentsTwo { background: blue; float:left;width:33%;visibility:hidden; }
#contentsThree { background: grey;visibility:hidden;}

2 Comments

no. contentOne, Two and Three should have 100% width. But they will be stacked to the right of each div tag. so when the user clicks lets say FAQ links the contentsTwo will slide from right to left.
@al0neevenings if you want sliding animation -- you need js.. and when it slides,the 1st column container will disappear,yes??

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.