Converting to tableless layout












0














I'm currently using 1 table to align 2 main portions of the site. It's causing problems for me now, so I'd like to use pure CSS.



I have a 205px wide navbar column on the left. Occupying the rest of the space on the right, I'd like to have a container (So on the right side of the screen, taking up screen width - 200 pixels) This container would not have a fixed height, but I want its top to be aligned with the top of the navbar.



Here's a demo of what I currently have .



I would like the solution to be similar to that, but not use tables, and have the top of the container aligned with the top of the sidebar.



I've made several attempts at doing this (before I started using the table, and after) but none of them even remotely worked. I've come here as a last resort, so I hope that someone could help.










share|improve this question
























  • That is a very common, very solved problem. CSS - Equal Height Columns?
    – Madara Uchiha
    Jul 29 '12 at 16:29












  • @Truth That is not what I am trying to do.
    – fruitcup
    Jul 29 '12 at 16:44










  • How is it different?
    – Madara Uchiha
    Jul 29 '12 at 16:55












  • @Truth I don't want them to be the same size, one of the columns is a fixed size and fixed position, and the right column is allowed to expand farther down.
    – fruitcup
    Jul 29 '12 at 16:57










  • So, I've FINALLY come up with a solution that works perfectly cross-browser, doesn't use tables, and doesn't use javascript. (I feel so proud :3) Rather than explaining it, you can view my completed fiddle demo here: jsfiddle.net/af9L5
    – fruitcup
    Jul 30 '12 at 21:01
















0














I'm currently using 1 table to align 2 main portions of the site. It's causing problems for me now, so I'd like to use pure CSS.



I have a 205px wide navbar column on the left. Occupying the rest of the space on the right, I'd like to have a container (So on the right side of the screen, taking up screen width - 200 pixels) This container would not have a fixed height, but I want its top to be aligned with the top of the navbar.



Here's a demo of what I currently have .



I would like the solution to be similar to that, but not use tables, and have the top of the container aligned with the top of the sidebar.



I've made several attempts at doing this (before I started using the table, and after) but none of them even remotely worked. I've come here as a last resort, so I hope that someone could help.










share|improve this question
























  • That is a very common, very solved problem. CSS - Equal Height Columns?
    – Madara Uchiha
    Jul 29 '12 at 16:29












  • @Truth That is not what I am trying to do.
    – fruitcup
    Jul 29 '12 at 16:44










  • How is it different?
    – Madara Uchiha
    Jul 29 '12 at 16:55












  • @Truth I don't want them to be the same size, one of the columns is a fixed size and fixed position, and the right column is allowed to expand farther down.
    – fruitcup
    Jul 29 '12 at 16:57










  • So, I've FINALLY come up with a solution that works perfectly cross-browser, doesn't use tables, and doesn't use javascript. (I feel so proud :3) Rather than explaining it, you can view my completed fiddle demo here: jsfiddle.net/af9L5
    – fruitcup
    Jul 30 '12 at 21:01














0












0








0







I'm currently using 1 table to align 2 main portions of the site. It's causing problems for me now, so I'd like to use pure CSS.



I have a 205px wide navbar column on the left. Occupying the rest of the space on the right, I'd like to have a container (So on the right side of the screen, taking up screen width - 200 pixels) This container would not have a fixed height, but I want its top to be aligned with the top of the navbar.



Here's a demo of what I currently have .



I would like the solution to be similar to that, but not use tables, and have the top of the container aligned with the top of the sidebar.



I've made several attempts at doing this (before I started using the table, and after) but none of them even remotely worked. I've come here as a last resort, so I hope that someone could help.










share|improve this question















I'm currently using 1 table to align 2 main portions of the site. It's causing problems for me now, so I'd like to use pure CSS.



I have a 205px wide navbar column on the left. Occupying the rest of the space on the right, I'd like to have a container (So on the right side of the screen, taking up screen width - 200 pixels) This container would not have a fixed height, but I want its top to be aligned with the top of the navbar.



Here's a demo of what I currently have .



I would like the solution to be similar to that, but not use tables, and have the top of the container aligned with the top of the sidebar.



I've made several attempts at doing this (before I started using the table, and after) but none of them even remotely worked. I've come here as a last resort, so I hope that someone could help.







html css css-tables






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited yesterday









Brian Tompsett - 汤莱恩

4,1631337100




4,1631337100










asked Jul 29 '12 at 16:26









fruitcup

50731231




50731231












  • That is a very common, very solved problem. CSS - Equal Height Columns?
    – Madara Uchiha
    Jul 29 '12 at 16:29












  • @Truth That is not what I am trying to do.
    – fruitcup
    Jul 29 '12 at 16:44










  • How is it different?
    – Madara Uchiha
    Jul 29 '12 at 16:55












  • @Truth I don't want them to be the same size, one of the columns is a fixed size and fixed position, and the right column is allowed to expand farther down.
    – fruitcup
    Jul 29 '12 at 16:57










  • So, I've FINALLY come up with a solution that works perfectly cross-browser, doesn't use tables, and doesn't use javascript. (I feel so proud :3) Rather than explaining it, you can view my completed fiddle demo here: jsfiddle.net/af9L5
    – fruitcup
    Jul 30 '12 at 21:01


















  • That is a very common, very solved problem. CSS - Equal Height Columns?
    – Madara Uchiha
    Jul 29 '12 at 16:29












  • @Truth That is not what I am trying to do.
    – fruitcup
    Jul 29 '12 at 16:44










  • How is it different?
    – Madara Uchiha
    Jul 29 '12 at 16:55












  • @Truth I don't want them to be the same size, one of the columns is a fixed size and fixed position, and the right column is allowed to expand farther down.
    – fruitcup
    Jul 29 '12 at 16:57










  • So, I've FINALLY come up with a solution that works perfectly cross-browser, doesn't use tables, and doesn't use javascript. (I feel so proud :3) Rather than explaining it, you can view my completed fiddle demo here: jsfiddle.net/af9L5
    – fruitcup
    Jul 30 '12 at 21:01
















That is a very common, very solved problem. CSS - Equal Height Columns?
– Madara Uchiha
Jul 29 '12 at 16:29






That is a very common, very solved problem. CSS - Equal Height Columns?
– Madara Uchiha
Jul 29 '12 at 16:29














@Truth That is not what I am trying to do.
– fruitcup
Jul 29 '12 at 16:44




@Truth That is not what I am trying to do.
– fruitcup
Jul 29 '12 at 16:44












How is it different?
– Madara Uchiha
Jul 29 '12 at 16:55






How is it different?
– Madara Uchiha
Jul 29 '12 at 16:55














@Truth I don't want them to be the same size, one of the columns is a fixed size and fixed position, and the right column is allowed to expand farther down.
– fruitcup
Jul 29 '12 at 16:57




@Truth I don't want them to be the same size, one of the columns is a fixed size and fixed position, and the right column is allowed to expand farther down.
– fruitcup
Jul 29 '12 at 16:57












So, I've FINALLY come up with a solution that works perfectly cross-browser, doesn't use tables, and doesn't use javascript. (I feel so proud :3) Rather than explaining it, you can view my completed fiddle demo here: jsfiddle.net/af9L5
– fruitcup
Jul 30 '12 at 21:01




So, I've FINALLY come up with a solution that works perfectly cross-browser, doesn't use tables, and doesn't use javascript. (I feel so proud :3) Rather than explaining it, you can view my completed fiddle demo here: jsfiddle.net/af9L5
– fruitcup
Jul 30 '12 at 21:01












2 Answers
2






active

oldest

votes


















1














Fiddle



.container{height: 100%; border: 1px solid #0f0; display: table;}
#sidebar{
width:40%; height: 100%; display: table-cell; background: #ccc;
}
#sidebar2{
width:60%; height: 100%; display: table-cell; background: #f00;
}
body, html {
height:100%;
}


HTML



<div class="container">
<div id="sidebar">links and whatnot go here</div>
<div id="sidebar2">this is the container (but its top is not aligned with the sidebar as I would like)</div>
</div>


Note: table-cell property is supported by supports IE8+



EDIT:
If you can't use table-cell then you have to use some jquery to calculate height. Check this Fiddle






share|improve this answer























  • I would still like the sidebar to be fixed on the left and vertically centered, as in my original fiddle. Plus this is nearly the same as using tables (so any peace of mind I gain from not using tables is negated)
    – fruitcup
    Jul 29 '12 at 16:47










  • @dragonmoray please check the edit
    – Dipak
    Jul 29 '12 at 17:02



















0














I would do something like this:



. HTML:



<div id="container">
<aside id="sidebar">Links and whatnot</aside>
<section id="content">Content and whatnot</section>
</div>


. CSS:



html, body {
width: 100%;
height: 100%;
}

div#container {
height: 100%;
}

aside#sidebar {
background-color: #f00;
width: 205px;
min-height: 100%;
float: left;
}

section#content {
background-color: #0f0;
min-height: 100%;
}


You can see it working in this fiddle.






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f11710879%2fconverting-to-tableless-layout%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    Fiddle



    .container{height: 100%; border: 1px solid #0f0; display: table;}
    #sidebar{
    width:40%; height: 100%; display: table-cell; background: #ccc;
    }
    #sidebar2{
    width:60%; height: 100%; display: table-cell; background: #f00;
    }
    body, html {
    height:100%;
    }


    HTML



    <div class="container">
    <div id="sidebar">links and whatnot go here</div>
    <div id="sidebar2">this is the container (but its top is not aligned with the sidebar as I would like)</div>
    </div>


    Note: table-cell property is supported by supports IE8+



    EDIT:
    If you can't use table-cell then you have to use some jquery to calculate height. Check this Fiddle






    share|improve this answer























    • I would still like the sidebar to be fixed on the left and vertically centered, as in my original fiddle. Plus this is nearly the same as using tables (so any peace of mind I gain from not using tables is negated)
      – fruitcup
      Jul 29 '12 at 16:47










    • @dragonmoray please check the edit
      – Dipak
      Jul 29 '12 at 17:02
















    1














    Fiddle



    .container{height: 100%; border: 1px solid #0f0; display: table;}
    #sidebar{
    width:40%; height: 100%; display: table-cell; background: #ccc;
    }
    #sidebar2{
    width:60%; height: 100%; display: table-cell; background: #f00;
    }
    body, html {
    height:100%;
    }


    HTML



    <div class="container">
    <div id="sidebar">links and whatnot go here</div>
    <div id="sidebar2">this is the container (but its top is not aligned with the sidebar as I would like)</div>
    </div>


    Note: table-cell property is supported by supports IE8+



    EDIT:
    If you can't use table-cell then you have to use some jquery to calculate height. Check this Fiddle






    share|improve this answer























    • I would still like the sidebar to be fixed on the left and vertically centered, as in my original fiddle. Plus this is nearly the same as using tables (so any peace of mind I gain from not using tables is negated)
      – fruitcup
      Jul 29 '12 at 16:47










    • @dragonmoray please check the edit
      – Dipak
      Jul 29 '12 at 17:02














    1












    1








    1






    Fiddle



    .container{height: 100%; border: 1px solid #0f0; display: table;}
    #sidebar{
    width:40%; height: 100%; display: table-cell; background: #ccc;
    }
    #sidebar2{
    width:60%; height: 100%; display: table-cell; background: #f00;
    }
    body, html {
    height:100%;
    }


    HTML



    <div class="container">
    <div id="sidebar">links and whatnot go here</div>
    <div id="sidebar2">this is the container (but its top is not aligned with the sidebar as I would like)</div>
    </div>


    Note: table-cell property is supported by supports IE8+



    EDIT:
    If you can't use table-cell then you have to use some jquery to calculate height. Check this Fiddle






    share|improve this answer














    Fiddle



    .container{height: 100%; border: 1px solid #0f0; display: table;}
    #sidebar{
    width:40%; height: 100%; display: table-cell; background: #ccc;
    }
    #sidebar2{
    width:60%; height: 100%; display: table-cell; background: #f00;
    }
    body, html {
    height:100%;
    }


    HTML



    <div class="container">
    <div id="sidebar">links and whatnot go here</div>
    <div id="sidebar2">this is the container (but its top is not aligned with the sidebar as I would like)</div>
    </div>


    Note: table-cell property is supported by supports IE8+



    EDIT:
    If you can't use table-cell then you have to use some jquery to calculate height. Check this Fiddle







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Jul 29 '12 at 17:01

























    answered Jul 29 '12 at 16:35









    Dipak

    10.1k12228




    10.1k12228












    • I would still like the sidebar to be fixed on the left and vertically centered, as in my original fiddle. Plus this is nearly the same as using tables (so any peace of mind I gain from not using tables is negated)
      – fruitcup
      Jul 29 '12 at 16:47










    • @dragonmoray please check the edit
      – Dipak
      Jul 29 '12 at 17:02


















    • I would still like the sidebar to be fixed on the left and vertically centered, as in my original fiddle. Plus this is nearly the same as using tables (so any peace of mind I gain from not using tables is negated)
      – fruitcup
      Jul 29 '12 at 16:47










    • @dragonmoray please check the edit
      – Dipak
      Jul 29 '12 at 17:02
















    I would still like the sidebar to be fixed on the left and vertically centered, as in my original fiddle. Plus this is nearly the same as using tables (so any peace of mind I gain from not using tables is negated)
    – fruitcup
    Jul 29 '12 at 16:47




    I would still like the sidebar to be fixed on the left and vertically centered, as in my original fiddle. Plus this is nearly the same as using tables (so any peace of mind I gain from not using tables is negated)
    – fruitcup
    Jul 29 '12 at 16:47












    @dragonmoray please check the edit
    – Dipak
    Jul 29 '12 at 17:02




    @dragonmoray please check the edit
    – Dipak
    Jul 29 '12 at 17:02













    0














    I would do something like this:



    . HTML:



    <div id="container">
    <aside id="sidebar">Links and whatnot</aside>
    <section id="content">Content and whatnot</section>
    </div>


    . CSS:



    html, body {
    width: 100%;
    height: 100%;
    }

    div#container {
    height: 100%;
    }

    aside#sidebar {
    background-color: #f00;
    width: 205px;
    min-height: 100%;
    float: left;
    }

    section#content {
    background-color: #0f0;
    min-height: 100%;
    }


    You can see it working in this fiddle.






    share|improve this answer




























      0














      I would do something like this:



      . HTML:



      <div id="container">
      <aside id="sidebar">Links and whatnot</aside>
      <section id="content">Content and whatnot</section>
      </div>


      . CSS:



      html, body {
      width: 100%;
      height: 100%;
      }

      div#container {
      height: 100%;
      }

      aside#sidebar {
      background-color: #f00;
      width: 205px;
      min-height: 100%;
      float: left;
      }

      section#content {
      background-color: #0f0;
      min-height: 100%;
      }


      You can see it working in this fiddle.






      share|improve this answer


























        0












        0








        0






        I would do something like this:



        . HTML:



        <div id="container">
        <aside id="sidebar">Links and whatnot</aside>
        <section id="content">Content and whatnot</section>
        </div>


        . CSS:



        html, body {
        width: 100%;
        height: 100%;
        }

        div#container {
        height: 100%;
        }

        aside#sidebar {
        background-color: #f00;
        width: 205px;
        min-height: 100%;
        float: left;
        }

        section#content {
        background-color: #0f0;
        min-height: 100%;
        }


        You can see it working in this fiddle.






        share|improve this answer














        I would do something like this:



        . HTML:



        <div id="container">
        <aside id="sidebar">Links and whatnot</aside>
        <section id="content">Content and whatnot</section>
        </div>


        . CSS:



        html, body {
        width: 100%;
        height: 100%;
        }

        div#container {
        height: 100%;
        }

        aside#sidebar {
        background-color: #f00;
        width: 205px;
        min-height: 100%;
        float: left;
        }

        section#content {
        background-color: #0f0;
        min-height: 100%;
        }


        You can see it working in this fiddle.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited yesterday









        tiagoperes

        2,20521734




        2,20521734










        answered Jul 29 '12 at 16:45









        Viktor

        1122421




        1122421






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f11710879%2fconverting-to-tableless-layout%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Monofisismo

            Angular Downloading a file using contenturl with Basic Authentication

            Olmecas