Hi,
You have a umber of validation errors in your page which you should fix. The one with missing closing div is causing the colours to change.
You missed the closing div from .ad here:
<div class="ad">
<div class="img-container"> <img title="Sydney airport" alt="Sydney airport" src="http://pintotours.net/Oceania/images/airportSyd2.jpg" width="600" height="399"> </div>
</div>
That last closing div is missing in your page so all the styles cascade through to where they shouldn’t and result in blue centred text.
You are also doing thing like the following which is bad.
<p>
<div class="ad">
You can’t wrap a div in a p tag and although some doctypes will allow a p element to be unclosed browsers invariable get it wrong and wrap the div in a p and apply styles from the p element to the div. Therefore never do it. We have mentioned this to you a number of times now
‘p’ element are for paragraphs and your page lacks any real structure as you mix plain text outside of p elements and use breaks to end paragraphs all of which is semantically incorrect and bad for business.
Have logical structures:
e.g.
<h3>Location</h3>
<p>Kingsford Smith airport, as it is officially known, is the only international airport serving Sydney. It is situated 5 miles south of the metropolis, next to Botany Bay. Two of the airport’s runways extend deep into the Bay, on reclaimed land. </p>
and never never like this:
<h3>Location</h3>
Kingsford Smith airport, as it is officially known, is the only international airport serving Sydney. It is situated 5 miles south of the metropolis, next to Botany Bay. Two of the airport’s runways extend deep into the Bay, on reclaimed land.
Don’t use breaks to end paragraphs or to make space and never use empty elements to make space either. Just add classes to the appropriate element and create the margin or padding that you need.
Regarding your images in http://pintotours.net/Work/airportSyd.html then you are using a technique usually reserved for videos to maintain an aspect ratio for the replaced element you are displaying.
Essentially the technique is used for videos to maintain a the 16:9 aspect ratio by using a padding to width ratio to create a block to hold the element. It can be used for images but usually you would have images that have the same aspect ratios to start with so that they don’t get stretched. In effect you don’t need that technique for images as you just set their width to 100% and their height to auto and they will maintain their aspect ratio automatically.
In your code you are creating an image container and then placing the image absolutely into place but then you’re letting the image maintain its own aspect ratio with auto height and therefore it blows out of the container that is holding it (because the image is now absolutely placed). This results in an image that has no relationship to the img container that you created and the image size will vary from image to image depending on its aspect ratio.
To compound issues further you are then placing a 100% wide image at left 18% which means it is now taking up 118% of available space which means it never actually fits in the container at all (and then you do the same with the top position).
To try and get things back on track you would need to use these rules for the images and their img-containers.
.img-container{
margin:0 auto 20px;
border:8px solid green;
border-radius:8px;
padding-top:50%;
width:73%;
}
.img-container img{
position:absolute;
left:0;
top:0;
right:0;
bottom:0;
width:100%;
height:100%;
border:none;
border-radius:0;
}
The only problem is that some images may get stretched or squashed if you are not using the same aspect ratio images all the time but they will all at least be the same size…
You may have been better off just setting the image to width:100% and height:auto and losing all the other trickery.