http://iledan.me/test.html
I have a set of 3 images as links using CSS transitions to create a hover effect. Each image has its own div, and all 3 divs are in a container div. Why can't I get the middle image to center between the float:left; and float:right; div?
If you have a solution to my problem or an alternative solution (rather than 3 divs) I'd greatly appreciate it!
EDIT: the middle div is centered using margin-left:auto; and margin-right:auto;
I have a set of 3 images as links using CSS transitions to create a hover effect. Each image has its own div, and all 3 divs are in a container div. Why can't I get the middle image to center between the float:left; and float:right; div?
If you have a solution to my problem or an alternative solution (rather than 3 divs) I'd greatly appreciate it!
EDIT: the middle div is centered using margin-left:auto; and margin-right:auto;
<html>
<head>
<style type="text/css">
#container {
width: 170px;
height: auto;
}
{
float: left;
height: 30px;
width: 30px;
}
#linkedin img {
position:absolute;
height: 30px;
width: 30px;
-webkit-transition: opacity 0.2s ease-in-out;
-moz-transition: opacity 0.2s ease-in-out;
-o-transition: opacity 0.2s ease-in-out;
transition: opacity 0.2s ease-in-out;}
#linkedin img.top:hover {opacity:0;}
{
height: 30px;
width: 30px;
margin-left: auto;
margin-right: auto;
text-align: center;
}
#facebook img {
position: absolute;
height: 30px;
width: 30px;
margin-left: auto;
margin-right: auto;
text-align: center;
-webkit-transition: opacity 0.2s ease-in-out;
-moz-transition: opacity 0.2s ease-in-out;
-o-transition: opacity 0.2s ease-in-out;
transition: opacity 0.2s ease-in-out;}
#facebook img.top:hover {opacity:0;}
{
height: 30px;
width: 30px;
margin-left: auto;
}
#instagram img {
position:absolute;
height: 30px;
width: 30px;
-webkit-transition: opacity 0.2s ease-in-out;
-moz-transition: opacity 0.2s ease-in-out;
-o-transition: opacity 0.2s ease-in-out;
transition: opacity 0.2s ease-in-out;}
#instagram img.top:hover {opacity:0;}
</style>
</head>
<body>
<div id = "container">
<div id="linkedin">
<a href="index.html"><img src="images/linkedin_h.png"/>
<img class="top" src="images/linkedin.png"/>
</a></div>
<div id="instagram">
<a href="index.html"><img src="images/instagram_h.png"/>
<img class="top" src="images/instagram.png"/>
</div>
<div id="facebook">
<a href="index.html"><img src="images/facebook_h.png"/>
<img class="top" src="images/facebook.png"/>
</a>
</div>
</div>
</body>
</html>
Last edited: