Skip to content Skip to sidebar Skip to footer

Adding A Caption To A Div That Already Contains Content

I have a small slider within a 200px by 200px div. However what I would really love is to have a 100px by 20px caption box in the top right hand corner with a colored background an

Solution 1:

Try this:

Add to CSS

.slider2 { position: relative; }

.caption-box {
  position: absolute;
  right: 0;
  height: 20px;
  width:100px;
  background-color: red; // change to suit
  color: #fff; // change to suit
}

Your HTML changed:

<div class="caption-box">Caption</div><!-- added this -->
<div class="slider2">
        <img src="client9.jpg" height="200" width="200" />
        <img src="client10.jpg" height="200" width="200" />
        <img src="client11.jpg" height="200" width="200" />
        <img src="client2.jpg" height="200" width="200" />
    </div>

Post a Comment for "Adding A Caption To A Div That Already Contains Content"