Split page vertically using CSS












34















Sorry guys for the really simple question but I have tried to float one div left and one right with predefined widths along these lines



<div style="width: 100%;">
<div style="float:left; width: 80%">
</div>
<div style="float:right;">
</div>
</div>


Although this 'mostly' works it seems to mess up the other elements on the page below it.



So what is the correct why to split a HTML page vertically into two parts using CSS without effecting other elements on the page?










share|improve this question





























    34















    Sorry guys for the really simple question but I have tried to float one div left and one right with predefined widths along these lines



    <div style="width: 100%;">
    <div style="float:left; width: 80%">
    </div>
    <div style="float:right;">
    </div>
    </div>


    Although this 'mostly' works it seems to mess up the other elements on the page below it.



    So what is the correct why to split a HTML page vertically into two parts using CSS without effecting other elements on the page?










    share|improve this question



























      34












      34








      34


      11






      Sorry guys for the really simple question but I have tried to float one div left and one right with predefined widths along these lines



      <div style="width: 100%;">
      <div style="float:left; width: 80%">
      </div>
      <div style="float:right;">
      </div>
      </div>


      Although this 'mostly' works it seems to mess up the other elements on the page below it.



      So what is the correct why to split a HTML page vertically into two parts using CSS without effecting other elements on the page?










      share|improve this question
















      Sorry guys for the really simple question but I have tried to float one div left and one right with predefined widths along these lines



      <div style="width: 100%;">
      <div style="float:left; width: 80%">
      </div>
      <div style="float:right;">
      </div>
      </div>


      Although this 'mostly' works it seems to mess up the other elements on the page below it.



      So what is the correct why to split a HTML page vertically into two parts using CSS without effecting other elements on the page?







      css html






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jul 26 '12 at 5:00









      Mr. Alien

      119k26225232




      119k26225232










      asked Jul 26 '12 at 4:52









      Maxim GershkovichMaxim Gershkovich

      18k33115209




      18k33115209
























          6 Answers
          6






          active

          oldest

          votes


















          42














          you can use..



          <div style="width: 100%;">
          <div style="float:left; width: 80%">
          </div>
          <div style="float:right;">
          </div>
          </div>
          <div style="clear:both"></div>


          now element below this will not be affected.






          share|improve this answer



















          • 4





            While this would work, it's considered bad practice to add elements whose only function is to "clear content".

            – Tieson T.
            Jul 26 '12 at 5:00






          • 6





            What's the best practice in these cases then? (I've been wondering for a while how to avoid "clearfix" divs)

            – Attila Fulop
            Feb 5 '13 at 16:32











          • what if I need a line between them? can't use left|right border since I don't know which one will be larger all the time...

            – gcb
            Mar 23 '13 at 6:12



















          10














          Just add overflow:auto; to parent div



          <div style="width: 100%;overflow:auto;">
          <div style="float:left; width: 80%">
          </div>
          <div style="float:right;">
          </div>
          </div>


          Working Demo






          share|improve this answer





















          • 1





            you just put height: 400px; on both sides.

            – gcb
            Mar 23 '13 at 6:11



















          7














          I guess your elements on the page messes up because you don't clear out your floats, check this out



          Demo



          HTML



          <div class="wrap">
          <div class="floatleft"></div>
          <div class="floatright"></div>
          <div style="clear: both;"></div>
          </div>


          CSS



          .wrap {
          width: 100%;
          }

          .floatleft {
          float:left;
          width: 80%;
          background-color: #ff0000;
          height: 400px;
          }

          .floatright {
          float: right;
          background-color: #00ff00;
          height: 400px;
          width: 20%;
          }





          share|improve this answer


























          • probably the best answer, thanks

            – Anton Semenichenko
            May 20 '18 at 13:01





















          3














          There can also be a solution by having both float to left.



          Try this out:



          Working Demo



          P.S. This is just an improvement of Ankit's Answer






          share|improve this answer

































            3














            Check out this fiddle:



            http://jsfiddle.net/G6N5T/1574/




            CSS/HTML code:






            .wrap {
            width: 100%;
            overflow:auto;
            }

            .fleft {
            float:left;
            width: 33%;
            background:lightblue;
            height: 400px;
            }

            .fcenter{
            float:left;
            width: 33%;
            background:lightgreen;
            height:400px;
            margin-left:0.25%;
            }

            .fright {
            float: right;
            background:pink;
            height: 400px;
            width: 33.5%;

            }

            <div class="wrap">
            <!--Updated on 10/8/2016; fixed center alignment percentage-->
            <div class="fleft">Left</div>
            <div class="fcenter">Center</div>
            <div class="fright">Right</div>
            </div>





            This uses the CSS float property for left, right, and center alignments of divs on a page.






            share|improve this answer


























            • This snippet is just a modification of this JSFiddle (click me!).

              – Stardust
              Aug 19 '15 at 17:13





















            0














            Alternatively, you can also use a special function known as the linear-gradient() function to split browser screen into two equal halves.
            Check out the following code snippet:



            body
            {
            background-image:linear-gradient(90deg, lightblue 50%, skyblue 50%);
            }


            Here, linear-gradient() function accepts three arguments





            1. 90deg for vertical division of screen.( Similarly, you can use 180deg for horizontal division of screen)


            2. lightblue color is used to represent the left half of the screen.


            3. skyblue color has been used to represent the right half of the split screen.
              Here, 50% has been used for equal division of the browser screen. You can use any other value if you don't want an equal division of the screen.
              Hope this helps. :)
              Happy Coding!






            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%2f11662536%2fsplit-page-vertically-using-css%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              6 Answers
              6






              active

              oldest

              votes








              6 Answers
              6






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              42














              you can use..



              <div style="width: 100%;">
              <div style="float:left; width: 80%">
              </div>
              <div style="float:right;">
              </div>
              </div>
              <div style="clear:both"></div>


              now element below this will not be affected.






              share|improve this answer



















              • 4





                While this would work, it's considered bad practice to add elements whose only function is to "clear content".

                – Tieson T.
                Jul 26 '12 at 5:00






              • 6





                What's the best practice in these cases then? (I've been wondering for a while how to avoid "clearfix" divs)

                – Attila Fulop
                Feb 5 '13 at 16:32











              • what if I need a line between them? can't use left|right border since I don't know which one will be larger all the time...

                – gcb
                Mar 23 '13 at 6:12
















              42














              you can use..



              <div style="width: 100%;">
              <div style="float:left; width: 80%">
              </div>
              <div style="float:right;">
              </div>
              </div>
              <div style="clear:both"></div>


              now element below this will not be affected.






              share|improve this answer



















              • 4





                While this would work, it's considered bad practice to add elements whose only function is to "clear content".

                – Tieson T.
                Jul 26 '12 at 5:00






              • 6





                What's the best practice in these cases then? (I've been wondering for a while how to avoid "clearfix" divs)

                – Attila Fulop
                Feb 5 '13 at 16:32











              • what if I need a line between them? can't use left|right border since I don't know which one will be larger all the time...

                – gcb
                Mar 23 '13 at 6:12














              42












              42








              42







              you can use..



              <div style="width: 100%;">
              <div style="float:left; width: 80%">
              </div>
              <div style="float:right;">
              </div>
              </div>
              <div style="clear:both"></div>


              now element below this will not be affected.






              share|improve this answer













              you can use..



              <div style="width: 100%;">
              <div style="float:left; width: 80%">
              </div>
              <div style="float:right;">
              </div>
              </div>
              <div style="clear:both"></div>


              now element below this will not be affected.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Jul 26 '12 at 4:55









              Ashwini AgarwalAshwini Agarwal

              4,17723255




              4,17723255








              • 4





                While this would work, it's considered bad practice to add elements whose only function is to "clear content".

                – Tieson T.
                Jul 26 '12 at 5:00






              • 6





                What's the best practice in these cases then? (I've been wondering for a while how to avoid "clearfix" divs)

                – Attila Fulop
                Feb 5 '13 at 16:32











              • what if I need a line between them? can't use left|right border since I don't know which one will be larger all the time...

                – gcb
                Mar 23 '13 at 6:12














              • 4





                While this would work, it's considered bad practice to add elements whose only function is to "clear content".

                – Tieson T.
                Jul 26 '12 at 5:00






              • 6





                What's the best practice in these cases then? (I've been wondering for a while how to avoid "clearfix" divs)

                – Attila Fulop
                Feb 5 '13 at 16:32











              • what if I need a line between them? can't use left|right border since I don't know which one will be larger all the time...

                – gcb
                Mar 23 '13 at 6:12








              4




              4





              While this would work, it's considered bad practice to add elements whose only function is to "clear content".

              – Tieson T.
              Jul 26 '12 at 5:00





              While this would work, it's considered bad practice to add elements whose only function is to "clear content".

              – Tieson T.
              Jul 26 '12 at 5:00




              6




              6





              What's the best practice in these cases then? (I've been wondering for a while how to avoid "clearfix" divs)

              – Attila Fulop
              Feb 5 '13 at 16:32





              What's the best practice in these cases then? (I've been wondering for a while how to avoid "clearfix" divs)

              – Attila Fulop
              Feb 5 '13 at 16:32













              what if I need a line between them? can't use left|right border since I don't know which one will be larger all the time...

              – gcb
              Mar 23 '13 at 6:12





              what if I need a line between them? can't use left|right border since I don't know which one will be larger all the time...

              – gcb
              Mar 23 '13 at 6:12













              10














              Just add overflow:auto; to parent div



              <div style="width: 100%;overflow:auto;">
              <div style="float:left; width: 80%">
              </div>
              <div style="float:right;">
              </div>
              </div>


              Working Demo






              share|improve this answer





















              • 1





                you just put height: 400px; on both sides.

                – gcb
                Mar 23 '13 at 6:11
















              10














              Just add overflow:auto; to parent div



              <div style="width: 100%;overflow:auto;">
              <div style="float:left; width: 80%">
              </div>
              <div style="float:right;">
              </div>
              </div>


              Working Demo






              share|improve this answer





















              • 1





                you just put height: 400px; on both sides.

                – gcb
                Mar 23 '13 at 6:11














              10












              10








              10







              Just add overflow:auto; to parent div



              <div style="width: 100%;overflow:auto;">
              <div style="float:left; width: 80%">
              </div>
              <div style="float:right;">
              </div>
              </div>


              Working Demo






              share|improve this answer















              Just add overflow:auto; to parent div



              <div style="width: 100%;overflow:auto;">
              <div style="float:left; width: 80%">
              </div>
              <div style="float:right;">
              </div>
              </div>


              Working Demo







              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Jul 26 '12 at 5:02

























              answered Jul 26 '12 at 4:55









              bugwheels94bugwheels94

              21.4k32851




              21.4k32851








              • 1





                you just put height: 400px; on both sides.

                – gcb
                Mar 23 '13 at 6:11














              • 1





                you just put height: 400px; on both sides.

                – gcb
                Mar 23 '13 at 6:11








              1




              1





              you just put height: 400px; on both sides.

              – gcb
              Mar 23 '13 at 6:11





              you just put height: 400px; on both sides.

              – gcb
              Mar 23 '13 at 6:11











              7














              I guess your elements on the page messes up because you don't clear out your floats, check this out



              Demo



              HTML



              <div class="wrap">
              <div class="floatleft"></div>
              <div class="floatright"></div>
              <div style="clear: both;"></div>
              </div>


              CSS



              .wrap {
              width: 100%;
              }

              .floatleft {
              float:left;
              width: 80%;
              background-color: #ff0000;
              height: 400px;
              }

              .floatright {
              float: right;
              background-color: #00ff00;
              height: 400px;
              width: 20%;
              }





              share|improve this answer


























              • probably the best answer, thanks

                – Anton Semenichenko
                May 20 '18 at 13:01


















              7














              I guess your elements on the page messes up because you don't clear out your floats, check this out



              Demo



              HTML



              <div class="wrap">
              <div class="floatleft"></div>
              <div class="floatright"></div>
              <div style="clear: both;"></div>
              </div>


              CSS



              .wrap {
              width: 100%;
              }

              .floatleft {
              float:left;
              width: 80%;
              background-color: #ff0000;
              height: 400px;
              }

              .floatright {
              float: right;
              background-color: #00ff00;
              height: 400px;
              width: 20%;
              }





              share|improve this answer


























              • probably the best answer, thanks

                – Anton Semenichenko
                May 20 '18 at 13:01
















              7












              7








              7







              I guess your elements on the page messes up because you don't clear out your floats, check this out



              Demo



              HTML



              <div class="wrap">
              <div class="floatleft"></div>
              <div class="floatright"></div>
              <div style="clear: both;"></div>
              </div>


              CSS



              .wrap {
              width: 100%;
              }

              .floatleft {
              float:left;
              width: 80%;
              background-color: #ff0000;
              height: 400px;
              }

              .floatright {
              float: right;
              background-color: #00ff00;
              height: 400px;
              width: 20%;
              }





              share|improve this answer















              I guess your elements on the page messes up because you don't clear out your floats, check this out



              Demo



              HTML



              <div class="wrap">
              <div class="floatleft"></div>
              <div class="floatright"></div>
              <div style="clear: both;"></div>
              </div>


              CSS



              .wrap {
              width: 100%;
              }

              .floatleft {
              float:left;
              width: 80%;
              background-color: #ff0000;
              height: 400px;
              }

              .floatright {
              float: right;
              background-color: #00ff00;
              height: 400px;
              width: 20%;
              }






              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Mar 30 '18 at 6:26









              Aakash Patel

              342114




              342114










              answered Jul 26 '12 at 4:57









              Mr. AlienMr. Alien

              119k26225232




              119k26225232













              • probably the best answer, thanks

                – Anton Semenichenko
                May 20 '18 at 13:01





















              • probably the best answer, thanks

                – Anton Semenichenko
                May 20 '18 at 13:01



















              probably the best answer, thanks

              – Anton Semenichenko
              May 20 '18 at 13:01







              probably the best answer, thanks

              – Anton Semenichenko
              May 20 '18 at 13:01













              3














              There can also be a solution by having both float to left.



              Try this out:



              Working Demo



              P.S. This is just an improvement of Ankit's Answer






              share|improve this answer






























                3














                There can also be a solution by having both float to left.



                Try this out:



                Working Demo



                P.S. This is just an improvement of Ankit's Answer






                share|improve this answer




























                  3












                  3








                  3







                  There can also be a solution by having both float to left.



                  Try this out:



                  Working Demo



                  P.S. This is just an improvement of Ankit's Answer






                  share|improve this answer















                  There can also be a solution by having both float to left.



                  Try this out:



                  Working Demo



                  P.S. This is just an improvement of Ankit's Answer







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Jul 23 '13 at 6:08









                  bugwheels94

                  21.4k32851




                  21.4k32851










                  answered Dec 21 '12 at 17:39









                  AnkurAnkur

                  1,7511724




                  1,7511724























                      3














                      Check out this fiddle:



                      http://jsfiddle.net/G6N5T/1574/




                      CSS/HTML code:






                      .wrap {
                      width: 100%;
                      overflow:auto;
                      }

                      .fleft {
                      float:left;
                      width: 33%;
                      background:lightblue;
                      height: 400px;
                      }

                      .fcenter{
                      float:left;
                      width: 33%;
                      background:lightgreen;
                      height:400px;
                      margin-left:0.25%;
                      }

                      .fright {
                      float: right;
                      background:pink;
                      height: 400px;
                      width: 33.5%;

                      }

                      <div class="wrap">
                      <!--Updated on 10/8/2016; fixed center alignment percentage-->
                      <div class="fleft">Left</div>
                      <div class="fcenter">Center</div>
                      <div class="fright">Right</div>
                      </div>





                      This uses the CSS float property for left, right, and center alignments of divs on a page.






                      share|improve this answer


























                      • This snippet is just a modification of this JSFiddle (click me!).

                        – Stardust
                        Aug 19 '15 at 17:13


















                      3














                      Check out this fiddle:



                      http://jsfiddle.net/G6N5T/1574/




                      CSS/HTML code:






                      .wrap {
                      width: 100%;
                      overflow:auto;
                      }

                      .fleft {
                      float:left;
                      width: 33%;
                      background:lightblue;
                      height: 400px;
                      }

                      .fcenter{
                      float:left;
                      width: 33%;
                      background:lightgreen;
                      height:400px;
                      margin-left:0.25%;
                      }

                      .fright {
                      float: right;
                      background:pink;
                      height: 400px;
                      width: 33.5%;

                      }

                      <div class="wrap">
                      <!--Updated on 10/8/2016; fixed center alignment percentage-->
                      <div class="fleft">Left</div>
                      <div class="fcenter">Center</div>
                      <div class="fright">Right</div>
                      </div>





                      This uses the CSS float property for left, right, and center alignments of divs on a page.






                      share|improve this answer


























                      • This snippet is just a modification of this JSFiddle (click me!).

                        – Stardust
                        Aug 19 '15 at 17:13
















                      3












                      3








                      3







                      Check out this fiddle:



                      http://jsfiddle.net/G6N5T/1574/




                      CSS/HTML code:






                      .wrap {
                      width: 100%;
                      overflow:auto;
                      }

                      .fleft {
                      float:left;
                      width: 33%;
                      background:lightblue;
                      height: 400px;
                      }

                      .fcenter{
                      float:left;
                      width: 33%;
                      background:lightgreen;
                      height:400px;
                      margin-left:0.25%;
                      }

                      .fright {
                      float: right;
                      background:pink;
                      height: 400px;
                      width: 33.5%;

                      }

                      <div class="wrap">
                      <!--Updated on 10/8/2016; fixed center alignment percentage-->
                      <div class="fleft">Left</div>
                      <div class="fcenter">Center</div>
                      <div class="fright">Right</div>
                      </div>





                      This uses the CSS float property for left, right, and center alignments of divs on a page.






                      share|improve this answer















                      Check out this fiddle:



                      http://jsfiddle.net/G6N5T/1574/




                      CSS/HTML code:






                      .wrap {
                      width: 100%;
                      overflow:auto;
                      }

                      .fleft {
                      float:left;
                      width: 33%;
                      background:lightblue;
                      height: 400px;
                      }

                      .fcenter{
                      float:left;
                      width: 33%;
                      background:lightgreen;
                      height:400px;
                      margin-left:0.25%;
                      }

                      .fright {
                      float: right;
                      background:pink;
                      height: 400px;
                      width: 33.5%;

                      }

                      <div class="wrap">
                      <!--Updated on 10/8/2016; fixed center alignment percentage-->
                      <div class="fleft">Left</div>
                      <div class="fcenter">Center</div>
                      <div class="fright">Right</div>
                      </div>





                      This uses the CSS float property for left, right, and center alignments of divs on a page.






                      .wrap {
                      width: 100%;
                      overflow:auto;
                      }

                      .fleft {
                      float:left;
                      width: 33%;
                      background:lightblue;
                      height: 400px;
                      }

                      .fcenter{
                      float:left;
                      width: 33%;
                      background:lightgreen;
                      height:400px;
                      margin-left:0.25%;
                      }

                      .fright {
                      float: right;
                      background:pink;
                      height: 400px;
                      width: 33.5%;

                      }

                      <div class="wrap">
                      <!--Updated on 10/8/2016; fixed center alignment percentage-->
                      <div class="fleft">Left</div>
                      <div class="fcenter">Center</div>
                      <div class="fright">Right</div>
                      </div>





                      .wrap {
                      width: 100%;
                      overflow:auto;
                      }

                      .fleft {
                      float:left;
                      width: 33%;
                      background:lightblue;
                      height: 400px;
                      }

                      .fcenter{
                      float:left;
                      width: 33%;
                      background:lightgreen;
                      height:400px;
                      margin-left:0.25%;
                      }

                      .fright {
                      float: right;
                      background:pink;
                      height: 400px;
                      width: 33.5%;

                      }

                      <div class="wrap">
                      <!--Updated on 10/8/2016; fixed center alignment percentage-->
                      <div class="fleft">Left</div>
                      <div class="fcenter">Center</div>
                      <div class="fright">Right</div>
                      </div>






                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Oct 8 '16 at 15:20

























                      answered Aug 19 '15 at 17:11









                      StardustStardust

                      4551517




                      4551517













                      • This snippet is just a modification of this JSFiddle (click me!).

                        – Stardust
                        Aug 19 '15 at 17:13





















                      • This snippet is just a modification of this JSFiddle (click me!).

                        – Stardust
                        Aug 19 '15 at 17:13



















                      This snippet is just a modification of this JSFiddle (click me!).

                      – Stardust
                      Aug 19 '15 at 17:13







                      This snippet is just a modification of this JSFiddle (click me!).

                      – Stardust
                      Aug 19 '15 at 17:13













                      0














                      Alternatively, you can also use a special function known as the linear-gradient() function to split browser screen into two equal halves.
                      Check out the following code snippet:



                      body
                      {
                      background-image:linear-gradient(90deg, lightblue 50%, skyblue 50%);
                      }


                      Here, linear-gradient() function accepts three arguments





                      1. 90deg for vertical division of screen.( Similarly, you can use 180deg for horizontal division of screen)


                      2. lightblue color is used to represent the left half of the screen.


                      3. skyblue color has been used to represent the right half of the split screen.
                        Here, 50% has been used for equal division of the browser screen. You can use any other value if you don't want an equal division of the screen.
                        Hope this helps. :)
                        Happy Coding!






                      share|improve this answer




























                        0














                        Alternatively, you can also use a special function known as the linear-gradient() function to split browser screen into two equal halves.
                        Check out the following code snippet:



                        body
                        {
                        background-image:linear-gradient(90deg, lightblue 50%, skyblue 50%);
                        }


                        Here, linear-gradient() function accepts three arguments





                        1. 90deg for vertical division of screen.( Similarly, you can use 180deg for horizontal division of screen)


                        2. lightblue color is used to represent the left half of the screen.


                        3. skyblue color has been used to represent the right half of the split screen.
                          Here, 50% has been used for equal division of the browser screen. You can use any other value if you don't want an equal division of the screen.
                          Hope this helps. :)
                          Happy Coding!






                        share|improve this answer


























                          0












                          0








                          0







                          Alternatively, you can also use a special function known as the linear-gradient() function to split browser screen into two equal halves.
                          Check out the following code snippet:



                          body
                          {
                          background-image:linear-gradient(90deg, lightblue 50%, skyblue 50%);
                          }


                          Here, linear-gradient() function accepts three arguments





                          1. 90deg for vertical division of screen.( Similarly, you can use 180deg for horizontal division of screen)


                          2. lightblue color is used to represent the left half of the screen.


                          3. skyblue color has been used to represent the right half of the split screen.
                            Here, 50% has been used for equal division of the browser screen. You can use any other value if you don't want an equal division of the screen.
                            Hope this helps. :)
                            Happy Coding!






                          share|improve this answer













                          Alternatively, you can also use a special function known as the linear-gradient() function to split browser screen into two equal halves.
                          Check out the following code snippet:



                          body
                          {
                          background-image:linear-gradient(90deg, lightblue 50%, skyblue 50%);
                          }


                          Here, linear-gradient() function accepts three arguments





                          1. 90deg for vertical division of screen.( Similarly, you can use 180deg for horizontal division of screen)


                          2. lightblue color is used to represent the left half of the screen.


                          3. skyblue color has been used to represent the right half of the split screen.
                            Here, 50% has been used for equal division of the browser screen. You can use any other value if you don't want an equal division of the screen.
                            Hope this helps. :)
                            Happy Coding!







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Jan 1 at 7:48









                          Raunak MitraRaunak Mitra

                          11




                          11






























                              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.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f11662536%2fsplit-page-vertically-using-css%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

                              Can a sorcerer learn a 5th-level spell early by creating spell slots using the Font of Magic feature?

                              Does disintegrating a polymorphed enemy still kill it after the 2018 errata?

                              A Topological Invariant for $pi_3(U(n))$