See how the tiny Facebook icon is positioned in the lower right-hand corner over another image?
How can I do that using a combo of HTML/CSS/Rails/Prototype!? An example would be great. Perhaps in jsfiddle.net.
See how the tiny Facebook icon is positioned in the lower right-hand corner over another image?
How can I do that using a combo of HTML/CSS/Rails/Prototype!? An example would be great. Perhaps in jsfiddle.net.
You can use css to solve the problem.
div {
position: relative;
display: inline;
}
.imtip {
position: absolute;
bottom: 0;
right: 0;
}
<div>
<img src="https://i.stack.imgur.com/Blaly.png" />
<img src="http://www.w3schools.com/favicon.ico" class="imtip" />
</div>
Basically, I've done more or less what ZDYN said, just that you need to include a display: inline
in the container otherwise the container div
spans the whole width.
Here's a simple example using divs instead of images: http://jsfiddle.net/sqJtr/
Basically, you put both of your images in the same container. Give the container a position that isn't static (in my example, relative). Then give the overlay image position: absolute
and position it however you want using bottom
and right
.
Here you go. This is done using 2 images.
<div class="parent">
<img src="http://i.ehow.com/images/a06/dv/5g/buy-car-repair-manuals-online-200X200.jpg" />
<div class="inner"><img src="http://www.airporthybridrentals.com/wp-content/uploads/2009/04/car-rental-sign.gif" /></div>
</div>
.parent{
width:200px;
height:200px;
position:absolute;
z-index:0;
}
.inner{
position:absolute;
z-index:1;
bottom:0;
right:0;
}
Try that:
html, body, .wrapper { height: 100%; }
.wrapper { position: relative; }
.top { height: 15%; background: #222; }
.mid { height: 70%; background: #CCC; }
.bot { height: 15%; background: #777; }
.container {
position: absolute;
background: #FFF;
padding: 20px;
width: 80%;
top: 10%;
left: 50%;
margin-left: -40%;
clear: both;
}
.container > div {
float: left;
width: 42%;
height: 250px;
padding: 1%;
}
.container > div:first-child {
background: #EEE;
float: left;
width: 54%;
}
.container > p {
position: absolute;
bottom: -100px;
right: 0;
border: 1px solid #EEE;
width: 50%;
height: 70px;
}
<div class="wrapper">
<div class="top"></div>
<div class="mid">
<div class="container">
<p>Some Text Here</p>
<div>IMAGE HERE</div>
<div>DESCRIPTION HERE</div>
</div>
</div>
<div class="bot"></div>
</div>
Collected from stackoverflow.
See my answer to this question.
The difference with your situation is that you don´t need any javascript if you don´t want to, you can just add divs to the html and position them absolutely on top of the photos.
I think I would personally add the divs using javascript anyway so that they don´t clutter the html.