Search code examples
csstwitter-bootstrapliquid-layout

Strip full screen in fixed twitter bootstrap layout


I would like to create this layout with twitter bootstrap.

https://i.sstatic.net/f6mn7.png

This my start Fiddle

http://jsfiddle.net/antoc/n8ec9j2h/

My html

<div class="container-fluid">
<div class="container">
    <div class="row">
        <div class="col-md-4">
                <h3 class="bg-blue">title</h3>

            <p>Lorem ipsum</p>
        </div>
        <div class="col-md-8">
                <h3 class="bg-red">title</h3>

            <p>Lorem ipsum</p>
             <h3 class="bg-green">title</h3>

            <p>Lorem ipsum</p>
        </div>
    </div>
</div>

My problems are:

  1. how to create the blu, red and green strip in css?
  2. how to create the yellow background in css?

Solution

  • Add some margin/padding hackery into it... like this updated fiddle

    Here's the relevent CSS:

    .bg-yellow{
        background:yellow;
        margin:-10px 0 -9999px -9999px;
        padding:10px 0 9999px 9999px;
    }
    .bg-blue {
        margin-left:-1000px;
        padding-left:1000px;
    }
    
    .bg-green, .bg-red{
        margin-right:-1000px;
    }
    

    And the HTML

    <div class="container">
        <div class="row">
            <div class="col-md-4">
                <h3 class="bg-blue">title</h3>
                <div class="bg-yellow">
                    <p>Lorem ipsum</p>
                </div>
            </div>
            <div class="col-md-8">
                <h3 class="bg-red">title</h3>
                <p>Lorem ipsum</p>
                <h3 class="bg-green">title</h3>
                <p>Lorem ipsum</p>
            </div>
        </div>
    </div>