Hi im struggling to center these three images in the middle of the page, ive enclosed all 3 images within one div (row) which i have then enclosed in another div (page) which is probably unnecessary,
ive centered the yellow div (page) but cant work out how to center the blue div (row) within the yellow div.
Heres a jsfiddle of my project: http://jsfiddle.net/edddotcom/7NQKU/11/
or here's the code:
CSS:
.page {
width:850px;
margin-left: auto;
margin-right: auto;
background-color:yellow;
}
.row {
max-width: 840px;
background-color: blue;
display: inline-block;
text-align: center;
margin-left: auto;
margin-right: auto;
}
.container {
display: block;
float: left;
width: 200px;
height: 116px;
background-color: red;
margin: 5px;
}
span {
margin-top: 10px;
margin-left: 10px;
max-height: 100%;
text-align: justify;
}
img {
width:100%;
max-width: 400px;
min-width: 200px;
}
HTML:
<div class="page">
<div class="row">
<div class="container">
<img src="http://cloudsmaker.com/hipsterwall/img/salto-al-norte.jpg"> <span>TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE </span>
</div>
<div class="container">
<img src="http://cloudsmaker.com/hipsterwall/img/salto-al-norte.jpg"> <span>TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE </span>
</div>
<div class="container">
<img src="http://cloudsmaker.com/hipsterwall/img/salto-al-norte.jpg"> <span>TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE TEXT HERE </span>
</div>
</div>
</div>
JavaScript:
$(document).ready(function () {
//ON CLICK
$("span").hide();
$("img").toggle(function () { //fired the first time
$(".container").css({
"height": "116px",
"width": "200px"
});
$("span").hide();
$(this).parent().animate({
//FIRSTCLICK COMMAND
height: "400px",
width: "400px"
}, function () {
$(this).children("span").show();
});
//Enlarges container then shows text
}, function () { // fired the second time
$(this).siblings("span").hide(0, '', function () {
$(this).parent(".container").animate({
//SECONDCLICK COMMAND
height: "116px",
width: "200px"
});
});
}); //Hides text then contracts container
});
The JavaScript probably isn't necessary but I've included it to give you a better idea of whats going on