How to split page background with vertical polyline?












2















I found how to split page with vertical line - see jsfiddle:
enter image description here



The code is below -



body {
background-color: white;
}

#background {
position: fixed;
top: 0px;
left: 0px;
width: 50%;
height: 100%;
background-color: black;
z-index: 1;
}

#content {
position: relative;
z-index: 2;
padding: 30px;
text-align: center;
font-weight: bold;
color: red;
font-family: Arial, sans-serif;
}


Now I would like to replace vertical line with polyline to get something like this:
enter image description here



How can I do it with CSS?



P.S. I can not use background image, since polyline can be different (the points will have different coordinates).










share|improve this question



























    2















    I found how to split page with vertical line - see jsfiddle:
    enter image description here



    The code is below -



    body {
    background-color: white;
    }

    #background {
    position: fixed;
    top: 0px;
    left: 0px;
    width: 50%;
    height: 100%;
    background-color: black;
    z-index: 1;
    }

    #content {
    position: relative;
    z-index: 2;
    padding: 30px;
    text-align: center;
    font-weight: bold;
    color: red;
    font-family: Arial, sans-serif;
    }


    Now I would like to replace vertical line with polyline to get something like this:
    enter image description here



    How can I do it with CSS?



    P.S. I can not use background image, since polyline can be different (the points will have different coordinates).










    share|improve this question

























      2












      2








      2








      I found how to split page with vertical line - see jsfiddle:
      enter image description here



      The code is below -



      body {
      background-color: white;
      }

      #background {
      position: fixed;
      top: 0px;
      left: 0px;
      width: 50%;
      height: 100%;
      background-color: black;
      z-index: 1;
      }

      #content {
      position: relative;
      z-index: 2;
      padding: 30px;
      text-align: center;
      font-weight: bold;
      color: red;
      font-family: Arial, sans-serif;
      }


      Now I would like to replace vertical line with polyline to get something like this:
      enter image description here



      How can I do it with CSS?



      P.S. I can not use background image, since polyline can be different (the points will have different coordinates).










      share|improve this question














      I found how to split page with vertical line - see jsfiddle:
      enter image description here



      The code is below -



      body {
      background-color: white;
      }

      #background {
      position: fixed;
      top: 0px;
      left: 0px;
      width: 50%;
      height: 100%;
      background-color: black;
      z-index: 1;
      }

      #content {
      position: relative;
      z-index: 2;
      padding: 30px;
      text-align: center;
      font-weight: bold;
      color: red;
      font-family: Arial, sans-serif;
      }


      Now I would like to replace vertical line with polyline to get something like this:
      enter image description here



      How can I do it with CSS?



      P.S. I can not use background image, since polyline can be different (the points will have different coordinates).







      html css background polyline






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 13 '18 at 20:03









      LA_LA_

      7,47740140247




      7,47740140247
























          1 Answer
          1






          active

          oldest

          votes


















          3














          You can consider multiple background to achieve this but it may be tricky to find the different values depending on the shape. It's basically a combination of triangle shape and rectangle shape above each other to create the final layer (changing the colors will help you identify each one)






          body {
          margin:0;
          }
          .box {
          height:100vh;
          background:
          linear-gradient(to bottom right,#000 49.8%,transparent 50%) 0 0/70% 120%,
          linear-gradient(to top right,#000 49.8%,transparent 50%) 0 0/60% 70%,
          linear-gradient(#000,#000) 0 100%/50% 31%,
          linear-gradient(to bottom right,#000 49.8%,transparent 50%) 55.3% 100%/10% 30.2%;
          background-repeat:no-repeat;
          }

          <div class="box">

          </div>





          You can also consider clip-path within a pseudo element and it will be easier (https://bennettfeely.com/clippy/)






          body {
          margin:0;
          }
          .box {
          height:100vh;
          position:relative;
          }
          .box:before {
          content:"";
          position:absolute;
          top:0;
          left:0;
          bottom:0;
          right:20%;
          background:#000;
          -webkit-clip-path: polygon(0 0, 72% 0, 59% 33%, 68% 62%, 47% 100%, 0 100%);
          clip-path: polygon(0 0, 72% 0, 59% 33%, 68% 62%, 47% 100%, 0 100%);
          }

          <div class="box">

          </div>








          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%2f53288655%2fhow-to-split-page-background-with-vertical-polyline%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            3














            You can consider multiple background to achieve this but it may be tricky to find the different values depending on the shape. It's basically a combination of triangle shape and rectangle shape above each other to create the final layer (changing the colors will help you identify each one)






            body {
            margin:0;
            }
            .box {
            height:100vh;
            background:
            linear-gradient(to bottom right,#000 49.8%,transparent 50%) 0 0/70% 120%,
            linear-gradient(to top right,#000 49.8%,transparent 50%) 0 0/60% 70%,
            linear-gradient(#000,#000) 0 100%/50% 31%,
            linear-gradient(to bottom right,#000 49.8%,transparent 50%) 55.3% 100%/10% 30.2%;
            background-repeat:no-repeat;
            }

            <div class="box">

            </div>





            You can also consider clip-path within a pseudo element and it will be easier (https://bennettfeely.com/clippy/)






            body {
            margin:0;
            }
            .box {
            height:100vh;
            position:relative;
            }
            .box:before {
            content:"";
            position:absolute;
            top:0;
            left:0;
            bottom:0;
            right:20%;
            background:#000;
            -webkit-clip-path: polygon(0 0, 72% 0, 59% 33%, 68% 62%, 47% 100%, 0 100%);
            clip-path: polygon(0 0, 72% 0, 59% 33%, 68% 62%, 47% 100%, 0 100%);
            }

            <div class="box">

            </div>








            share|improve this answer






























              3














              You can consider multiple background to achieve this but it may be tricky to find the different values depending on the shape. It's basically a combination of triangle shape and rectangle shape above each other to create the final layer (changing the colors will help you identify each one)






              body {
              margin:0;
              }
              .box {
              height:100vh;
              background:
              linear-gradient(to bottom right,#000 49.8%,transparent 50%) 0 0/70% 120%,
              linear-gradient(to top right,#000 49.8%,transparent 50%) 0 0/60% 70%,
              linear-gradient(#000,#000) 0 100%/50% 31%,
              linear-gradient(to bottom right,#000 49.8%,transparent 50%) 55.3% 100%/10% 30.2%;
              background-repeat:no-repeat;
              }

              <div class="box">

              </div>





              You can also consider clip-path within a pseudo element and it will be easier (https://bennettfeely.com/clippy/)






              body {
              margin:0;
              }
              .box {
              height:100vh;
              position:relative;
              }
              .box:before {
              content:"";
              position:absolute;
              top:0;
              left:0;
              bottom:0;
              right:20%;
              background:#000;
              -webkit-clip-path: polygon(0 0, 72% 0, 59% 33%, 68% 62%, 47% 100%, 0 100%);
              clip-path: polygon(0 0, 72% 0, 59% 33%, 68% 62%, 47% 100%, 0 100%);
              }

              <div class="box">

              </div>








              share|improve this answer




























                3












                3








                3







                You can consider multiple background to achieve this but it may be tricky to find the different values depending on the shape. It's basically a combination of triangle shape and rectangle shape above each other to create the final layer (changing the colors will help you identify each one)






                body {
                margin:0;
                }
                .box {
                height:100vh;
                background:
                linear-gradient(to bottom right,#000 49.8%,transparent 50%) 0 0/70% 120%,
                linear-gradient(to top right,#000 49.8%,transparent 50%) 0 0/60% 70%,
                linear-gradient(#000,#000) 0 100%/50% 31%,
                linear-gradient(to bottom right,#000 49.8%,transparent 50%) 55.3% 100%/10% 30.2%;
                background-repeat:no-repeat;
                }

                <div class="box">

                </div>





                You can also consider clip-path within a pseudo element and it will be easier (https://bennettfeely.com/clippy/)






                body {
                margin:0;
                }
                .box {
                height:100vh;
                position:relative;
                }
                .box:before {
                content:"";
                position:absolute;
                top:0;
                left:0;
                bottom:0;
                right:20%;
                background:#000;
                -webkit-clip-path: polygon(0 0, 72% 0, 59% 33%, 68% 62%, 47% 100%, 0 100%);
                clip-path: polygon(0 0, 72% 0, 59% 33%, 68% 62%, 47% 100%, 0 100%);
                }

                <div class="box">

                </div>








                share|improve this answer















                You can consider multiple background to achieve this but it may be tricky to find the different values depending on the shape. It's basically a combination of triangle shape and rectangle shape above each other to create the final layer (changing the colors will help you identify each one)






                body {
                margin:0;
                }
                .box {
                height:100vh;
                background:
                linear-gradient(to bottom right,#000 49.8%,transparent 50%) 0 0/70% 120%,
                linear-gradient(to top right,#000 49.8%,transparent 50%) 0 0/60% 70%,
                linear-gradient(#000,#000) 0 100%/50% 31%,
                linear-gradient(to bottom right,#000 49.8%,transparent 50%) 55.3% 100%/10% 30.2%;
                background-repeat:no-repeat;
                }

                <div class="box">

                </div>





                You can also consider clip-path within a pseudo element and it will be easier (https://bennettfeely.com/clippy/)






                body {
                margin:0;
                }
                .box {
                height:100vh;
                position:relative;
                }
                .box:before {
                content:"";
                position:absolute;
                top:0;
                left:0;
                bottom:0;
                right:20%;
                background:#000;
                -webkit-clip-path: polygon(0 0, 72% 0, 59% 33%, 68% 62%, 47% 100%, 0 100%);
                clip-path: polygon(0 0, 72% 0, 59% 33%, 68% 62%, 47% 100%, 0 100%);
                }

                <div class="box">

                </div>








                body {
                margin:0;
                }
                .box {
                height:100vh;
                background:
                linear-gradient(to bottom right,#000 49.8%,transparent 50%) 0 0/70% 120%,
                linear-gradient(to top right,#000 49.8%,transparent 50%) 0 0/60% 70%,
                linear-gradient(#000,#000) 0 100%/50% 31%,
                linear-gradient(to bottom right,#000 49.8%,transparent 50%) 55.3% 100%/10% 30.2%;
                background-repeat:no-repeat;
                }

                <div class="box">

                </div>





                body {
                margin:0;
                }
                .box {
                height:100vh;
                background:
                linear-gradient(to bottom right,#000 49.8%,transparent 50%) 0 0/70% 120%,
                linear-gradient(to top right,#000 49.8%,transparent 50%) 0 0/60% 70%,
                linear-gradient(#000,#000) 0 100%/50% 31%,
                linear-gradient(to bottom right,#000 49.8%,transparent 50%) 55.3% 100%/10% 30.2%;
                background-repeat:no-repeat;
                }

                <div class="box">

                </div>





                body {
                margin:0;
                }
                .box {
                height:100vh;
                position:relative;
                }
                .box:before {
                content:"";
                position:absolute;
                top:0;
                left:0;
                bottom:0;
                right:20%;
                background:#000;
                -webkit-clip-path: polygon(0 0, 72% 0, 59% 33%, 68% 62%, 47% 100%, 0 100%);
                clip-path: polygon(0 0, 72% 0, 59% 33%, 68% 62%, 47% 100%, 0 100%);
                }

                <div class="box">

                </div>





                body {
                margin:0;
                }
                .box {
                height:100vh;
                position:relative;
                }
                .box:before {
                content:"";
                position:absolute;
                top:0;
                left:0;
                bottom:0;
                right:20%;
                background:#000;
                -webkit-clip-path: polygon(0 0, 72% 0, 59% 33%, 68% 62%, 47% 100%, 0 100%);
                clip-path: polygon(0 0, 72% 0, 59% 33%, 68% 62%, 47% 100%, 0 100%);
                }

                <div class="box">

                </div>






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Nov 13 '18 at 20:23

























                answered Nov 13 '18 at 20:18









                Temani AfifTemani Afif

                71.4k93979




                71.4k93979






























                    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%2f53288655%2fhow-to-split-page-background-with-vertical-polyline%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

                    Full-time equivalent

                    さくらももこ

                    13 indicted, 8 arrested in Calif. drug cartel investigation