I have been experimenting with creating an image that, upon hover, displays a caption sliding out from left to right on the top and bottom. I have managed to achieve this effect on two separate images - one displaying the top caption and the other displaying the bottom caption. However, I am struggling to implement both effects on the same image. Additionally, I am trying to make sure that the captions and the image scale properly to fit the container, which has been quite challenging. I also attempted to insert two divs into the top slide caption to get them to scale accordingly, but I couldn't quite figure it out. Here is the current state of my code:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>slide caption thingy</title>
<link rel="stylesheet" type="text/css" media="screen" href="style.css" />
</head>
<body>
<div class="wrapper">
<header>
<h1 class="main_head">hj</h1>
</header>
<hr />
<div class="container left">
<img src="images/1.jpg" alt="image" />
<article class="text css3-3 css3-4">
<h1><a href="#" class="css3-3 css3-4">space1</a> </h1>
</article>
</div>
<div class="container right">
<img src="images/2.jpg" alt="image" />
<article class="text css3-4">
<h1><a href="#" class="css3-4">space2</a></h1>
</article>
</div>
<hr />
</div>
</body>
</html>
CSS
* {
margin: 0;
padding: 0;
}
body {
}
.wrapper {
margin: 0 auto;
width: 960px;
padding: 30px;
position: relative;
}
.left {
float: left;
}
.right {
float: right;
}
hr {
border: none;
width: 100%;
height: 7px;
margin: 10px 0 10px 0;
clear: both;
}
a {
text-shadow: 1px 1px #efefef;
text-decoration: none;
}
b {
text-shadow: 1px 1px #efefef;
text-decoration: none;
}
header h1.main_head {
font: 36px/18px Georgia, Arial, sans-serif;
color: #838383;
text-shadow: 1px 1px #efefef;
text-align: center;
padding: 20px 0 20px 0;
}
.container {
border: 10px solid #fff;
position: relative;
overflow: hidden;
height: 200px;
-webkit-box-shadow: 0 0 3px #000;
-moz-box-shadow: 0 0 3px #000;
box-shadow: 0 0 3px #000;
-webkit-transition: all .5s ease-out;
-moz-transition: all .5s ease-out;
transition: all .5s ease-out;
}
.container:hover {
cursor: pointer;
-webkit-box-shadow: 0 0 10px #000;
-moz-box-shadow: 0 0 10px #000;
box-shadow: 0 0 10px #000;
}
.container2 {
border: 10px solid #fff;
position: relative;
overflow: hidden;
height: 200px;
-webkit-box-shadow: 0 0 3px #000;
-moz-box-shadow: 0 0 3px #000;
box-shadow: 0 0 3px #000;
-webkit-transition: all .5s ease-out;
-moz-transition: all .5s ease-out;
transition: all .5s ease-out;
}
.container2:hover {
cursor: pointer;
-webkit-box-shadow: 0 0 10px #000;
-moz-box-shadow: 0 0 10px #000;
box-shadow: 0 0 10px #000;
}
.text {
background: rgba(0,0,0,0.5);
color: white;
font: 14px Georgia,serif;
height: 80px;
width: inherit;
position: absolute;
}
.text a {
color: #fff;
display: block;
padding: 15px;
font-size: 16px;
font-weight: normal;
text-shadow: none;
text-decoration: none;
width: 400px;
}
/* CSS3 Right Effect */
article.css3-3 {
right: -400px;
top: 0;
-webkit-transition: all .5s ease-out;
-moz-transition: all .5s ease-out;
-o-transition: all .5s ease-out;
transition: all .5s ease-out;
width: 400px;
}
.text a.css3-3 {
-webkit-transition: all .4s ease-out;
-moz-transition: all .4s ease-out;
-o-transition: all .5s ease-out;
transition: all .4s ease-out;
}
.text a.css3-3:hover {
color: #d0206a;
text-decoration: none;
}
.container:hover article.css3-3 {
right: 0;
}
/* CSS3 Left Effect */
article.css3-4 {
left: -400px;
bottom: 0;
-webkit-transition: all .5s ease-out;
-moz-transition: all .5s ease-out;
-o-transition: all .5s ease-out;
transition: all .5s ease-out;
width: 400px;
}
.text a.css3-4 {
-webkit-transition: all .4s ease-out;
-moz-transition: all .4s ease-out;
-o-transition: all .5s ease-out;
transition: all .4s ease-out;
}
.text a.css3-4:hover {
color: #d0206a;
text-decoration: none;
}
.container:hover article.css3-4 {
left: 0;
}