0
<div class="row">

        <div class="container-a1">
        <ul class="caption-style-1">
            <li class="col-lg-3 col-sm-3 portfolio-item">
                <img class="img-responsive" src="img/1.png" alt="">
                <div class="caption">
                    <div class="blur"></div>
                    <div class="caption-text">
                        <h1>Amazing Caption</h1>
                        <p>Whatever It Is - Always Awesome</p>
                    </div>
                </div>
            </li>
            <li class="col-lg-3 col-sm-3 portfolio-item">
                <img class="img-responsive" src="img/1.png" alt="">
                <div class="caption">
                    <div class="blur"></div>
                    <div class="caption-text">
                        <h1>Amazing Caption</h1>
                        <p>Whatever It Is - Always Awesome</p>
                    </div>
                </div>
            </li>
            <li class="col-lg-3 col-sm-3 portfolio-item">
                <img class="img-responsive" src="img/1.png" alt="">
                <div class="caption">
                    <div class="blur"></div>
                    <div class="caption-text">
                        <h1>Amazing Caption</h1>
                        <p>Whatever It Is - Always Awesome</p>
                    </div>
                </div>
            </li>
            <li class="col-lg-3 col-sm-3 portfolio-item">
                <img class="img-responsive" src="img/1.png" alt="">
                <div class="caption">
                    <div class="blur"></div>
                    <div class="caption-text">
                        <h1>Amazing Caption</h1>
                        <p>Whatever It Is - Always Awesome</p>
                    </div>
                </div>
            </li>
            </ul>
        </div>

        </div>


 <style>
        .portfolio-item {margin:0; padding:0;}

            .caption-style-1{
        list-style-type: none;
        margin: 0px;
        padding: 0px;

    }

    .caption-style-1 li{
        float: left;
        padding: 0px;
        position: relative;
        overflow: hidden;
    }

    .caption-style-1 li:hover .caption{
        opacity: 1;

    }


    .caption-style-1 img{
        margin: 0px;
        padding: 0px;
        float: left;
        z-index: 4;
    }


    .caption-style-1 .caption{
        cursor: pointer;
        position: absolute;
        opacity: 0;
        -webkit-transition:all 0.45s ease-in-out;
        -moz-transition:all 0.45s ease-in-out;
        -o-transition:all 0.45s ease-in-out;
        -ms-transition:all 0.45s ease-in-out;
        transition:all 0.45s ease-in-out;

    }
    .caption-style-1 .blur{
        background-color: rgba(0,0,0,0.65);
        height: 175px;
        width: 292px;
        z-index: 5;
        position: absolute;
    }

    .caption-style-1 .caption-text h1{
        text-transform: uppercase;
        font-size: 24px;
    }
    .caption-style-1 .caption-text{
        z-index: 10;
        color: #fff;
        position: absolute;
        width: 293px;
        height: 176px;
        text-align: center;

    }



    </style>

I converted a tutorial for a hover caption over to bootstrap. The problem is the grid style portfolio is responsive and I can't seem to get the caption to be responsive. I tried setting the height and width to 100% but that did not work? Any tips?

Velibor Nikolic
  • 239
  • 3
  • 15

1 Answers1

1

Velibor Nikolic Hi there.
You are usingdiv in a ul > li Which is not probably a good idea.
Have a look at this link here.

Try doing something like this for what you are looking to do with the Caption. Have a look at this Fiddle for a working sample.

This is fully responsive, both image and caption.
I use the Bootstrap class of col-xs-12 for the width and the caption class uses height:100% .

I reduced someclasses and added the shaded background to the caption class, the blur class is not needed.

Here is a sample of one image block with the caption.

<div class="col-sm-4 col-xs-12 clear-L-R">
     <img src="http://lorempixel.com/640/640/nature" class="img-responsive clear-L-R" alt="">
     <div class="col-xs-12 caption caption-text">
          <h1>Amazing Caption</h1>
          <p>Whatever It Is - Always Awesome</p>
      </div>
</div>
Community
  • 1
  • 1
AngularJR
  • 2,752
  • 2
  • 16
  • 19
  • Thank you exactly what I needed. – Velibor Nikolic Sep 26 '15 at 22:40
  • Hi Velibor, You are welcome. Did you need it to have the ul>li ? if so it can be done using the ul>li without the div's if you really need it this way. I can do it this way if you need it or just want to see it that way. – AngularJR Sep 26 '15 at 23:21