• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 430
  • Last Modified:

How to divide the remaining of the the screen to 3 parts eauql parts in CSS

I want to implement the attached image, but I am not sure how can I split the remaining of the page vertically to 3 parts, here is my code:
      #window1 {
           margin-top: 90px;
           background-position: top left;
           width: 100%;
           height: 200px;
           padding: 0.5em;
           position: fixed;
           overflow: auto;
           }
      #window2 {
           margin-top: 290px;
           margin-left: 200px;
           width: 100%;
           height: 200px;
           padding: 0.5em;
           position: fixed;
           overflow: auto;
           }
       #window3 {
           margin-top: 490px;
           margin-left: 200px;
           background-position: top left;
           width: 70%;
           height: 200px;
           padding: 0.5em;
           position: fixed;
           overflow: auto;
           }
       #window4 {
           margin-top: 490px;
           margin-left: 200px;
           width: 30%;
           height: 300px;
           padding: 0.5em;
           position: fixed;
           overflow: auto;
           }

Open in new window

main-page.jpg
0
Ashraf Hassanein
Asked:
Ashraf Hassanein
  • 7
  • 5
  • 4
2 Solutions
 
GaryCommented:
http://jsfiddle.net/QUuL4/1/

<div id="header">header</div>
<div id="sidebar">Sidebar</div>
<div id="content1">content1</div>
<div id="content2">content2</div>
<div id="bottom-container">
<div id="content3">content3</div>
<div id="content4">content4</div>
    </div>

Open in new window


div {
    border:1px solid blue
}
#header {
    height:90px
}
#sidebar {
    float:left;
    width:200px
}
#content1{
margin-left: 210px;
    height:90px
}
#content2{
    margin-left: 210px;
    height:90px
}
#bottom-container{
        margin-left: 210px;  
        height:90px
}
#content3{
    display:inline-block;
width:49%
}
#content4{
        display:inline-block;
width:49%
}

Open in new window

0
 
Ashraf HassaneinAuthor Commented:
Hi Gary,  
    In http://jsfiddle.net/QUuL4/1/ I can see that content3 and 3 are splitting the bottom div as rows (horizontally) but I want them to split it as columns (vertically) also I have tried the first 2 contents (1, and 2) and  can see that in my implementation that the can scroll overthe header, what do you advise?
0
 
Scott Fell, EE MVEDeveloperCommented:
I like to use a responsive framework with a grid. http://getbootstrap.com/css/


http://jsbin.com/OSoyOda/1/
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery.min.js"></script>
<link href="http://getbootstrap.com/dist/css/bootstrap.css" rel="stylesheet" type="text/css" />
<script src="http://getbootstrap.com/dist/js/bootstrap.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
  <div class="row">
      <div class="col-sm-12">Nav</div>
  </div>
  <div class="row">  
      <div class="col-sm-2">Left</div>
      <div class="col-sm-10">
    
           <div class="col-sm-12">Mid Top</div>
           <div class="col-sm-12">Mid Mid</div>
           <div class="col-sm-6">Mid Bottom Left</div>
           <div class="col-sm-6">Mid Bottom Right</div>
      </div>
  </div>
</body>
</html>

Open in new window

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
GaryCommented:
http://jsfiddle.net/QUuL4/2/

scroll overthe header
Don't know what you mean
0
 
Ashraf HassaneinAuthor Commented:
I did not work in my implementation, but I tried the following code:

   <style>
      #window1 {
           position: fixed;
           margin-left: 5px;
           height: 200px;
           overflow: auto;
           }
      #window2 {
           position: fixed;
           margin-top: 200px;
           margin-left: 5px;
           height: 170px;
           overflow: auto;
           }
       #bottomHome {
           position: fixed;
           margin-top: 400px;
           margin-left: 5px;
           border: none;
           overflow-y:hidden;
           overflow-x:hidden
           }
       #window3 {
           float: left;
           width: 300px;
           padding: 0.5em;
           overflow: auto;
           }
       #window4 {
           width: 100px;
           padding: 0.5em;
           overflow: auto;
           }
   </style>
  <div id="window1">
       </div>
</div>
<div id="window2">
 
     </div>
</div>
<div id="bottomHome">
<div id="window3">
   </div>
<div id="window4">
       </div>
</div>

Open in new window


But I have now is something as the attached image,
How can I:
  1- Attach the Div bottomHome directly to the above div?
   2- Get both Window 3 and 4 on the same level?
  3- Make Window 3 and 4 scorrable?
error-style.JPG
0
 
Scott Fell, EE MVEDeveloperCommented:
It is always a good idea to run your code through a validator like http://validator.w3.org/  For everything you open, it must be closed in the same order.  In this case, your html is invalid that you just posted.

Did you notice how this worked http:#a39763647 or a different approach http:#a39763619
0
 
GaryCommented:
What is wrong with the sample code I posted
The code you are trying to use is not a good way to do it at all - it will cause a lotta problems
0
 
Ashraf HassaneinAuthor Commented:
But now I am confused :-) The example you attached earlier requires to change the css, can't my issue solved by just adjusting the divs?
0
 
Ashraf HassaneinAuthor Commented:
Hi, I tried to do as your previous advice, but something wrong in my implementation :-(
https://www.hassans.nl/new/test.php
0
 
Scott Fell, EE MVEDeveloperCommented:
Honestly, based on what I am seeing in this very basic code, I would say take 4 hour time out from this and go through the web fundamentals http://www.codecademy.com/tracks/web.  You will save yourself 10 times the hours you put into it.

At the very least your basic code should look like this to start
<!DOCTYPE html>
<html>
<head>
<!-- CSS files here -->
<!--  javascript files here -->
<!-- add any on page css below -->
<style>

</style>
<!-- add any of your jquery or javascript functions -->
<meta charset=utf-8 />
<title>padas</title>
</head>
<body>
<!-- each tag should be closed in the same order it was open -->
<!-- Try and stagger your tags to keep track of where you are -->
  <div class="1">
       <div class="2">
       </div><!-- close 2 -->
       <div class="3">
              <div class="4">
              </div><!-- close 4 -->
              <div class="5">
              </div><!-- close 5 -->
       </div><!-- close 3 -->
</div><!-- close 1 -->
</body>
</html>

Open in new window


Start here http://validator.w3.org/

If you start with the code sample cathel or I have given, you can replace the content with your own.  If you go to the link cathel gave you http://jsfiddle.net/GaryC123/u63cE/2/, click the "Fork" link at the top, now start replacing your content with what he has and see if that helps you.

The problem is  you have not followed the code structure we gave you.
0
 
GaryCommented:
I don't know how anyone can help you when you insist on using your own code that is badly devised but won't take on board other experts suggestions
I couldn't even begin to debug the link you gave as half the page is off screen and due to your own code is not even accessible because you have basically disabled the page scrolling.
0
 
Ashraf HassaneinAuthor Commented:
Thanks for all your support, I found my mistake, the solution of cathal worked with me very well.
0
 
Ashraf HassaneinAuthor Commented:
I've requested that this question be closed as follows:

Accepted answer: 250 points for GaryC123's comment #a39765447
Assisted answer: 0 points for AshrafHassanein's comment #a39764871
Assisted answer: 250 points for padas's comment #a39766007

for the following reason:

Thanks for all experts my mistake with a typo, thank you so much for your great support.
0
 
Ashraf HassaneinAuthor Commented:
Thanks for all experts for being very patient and helpful for me.
0
 
Scott Fell, EE MVEDeveloperCommented:
Thank you for the points. Best of luck on your project.
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 7
  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now