Search code examples
htmlcssmarkup

How can I mark it up?


I have a picture and it looks like this: enter image description here

And I want to mark it up with HTML and CSS.

I want curved part to be always at the center of screen and have content. And I want flat parts to stretch depending on user screen width by sides.

How can I do it? Could anyone provide me examples?

Thanks for your attention.


Solution

  • You can try with this Demo

    html

    #test{
        width: 50px;
        height: 600px;
        background: green;
        position: absolute;
        top:0;
        left:0;
        right:0;
        margin: auto;
        display: inline-block;
        -webkit-transform: translate(300px) rotate(90deg) ;
        -webkit-transform-origin: left top;
    }
    
    #test:after{
        background: white;
        height: 600px;
        width: 100px;
        border-radius: 100px 0 0 100px / 600px 0 0  600px;
        display: inline-block;
        content: '';
        position: relative;
        left: 25px;
    }
    

    So here is the final Demo as required

    html

    <div id="testbefore"></div>
    <div id="test"></div>
    

    css

    body, html {
        margin:0;
        padding:0;
        width:100%;
    }
    #testbefore {
        width: 100%;
        height: 50px;
        background: green;
    }
    #test {
        width: 50px;
        height: 600px;
        background: green;
        position: absolute;
        top:0;
        left:0;
        right:0;
        margin: auto;
        display: inline-block;
        -webkit-transform: translate(300px) rotate(90deg);
        -webkit-transform-origin:top;
    }
    #test:after {
        background: white;
        height: 600px;
        width: 100px;
        border-radius: 100px 0 0 100px / 600px 0 0 600px;
        display: inline-block;
        content:'';
        position: relative;
        left: 50px;
    }