/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Works on IE7, CSS layout messed up in Firefox3

Okay, so I have a new layout I’m working on, which I got working fine but the code was a bit messy/superfluous.

[url]http://romana.webcity.com.au/~cat49763/new/index.shtml[/url]

So, I had a go at cleaning it up a bit and using the margins for positioning as best I can. It works fine in IE7 and looks identical to the first design (apart from some spacing changes I made on purpose in the footer section).

[url]http://romana.webcity.com.au/~cat49763/new/index_test.shtml[/url]

Firefox (my default and preferred browser) however is not liking the changes. The content background image (of which there is just one now instead of a header and a content bg like in the first design) is not sitting at the top of the page, instead its starting at about 165px down – the margin-top for the navbar. If I change the margin-top on the contentbg div to -165px, it moves up to the right spot but it takes the nav bar to the top with it. In IE, the -165px top margin pushes the image off the page by 165px, as you would expect.

Why is the navbar linked to the contentbg now? Is it because I took it out of the nested nav divs I had previously used?

The other elements of the page are also all overlapping but I think I can tweak those once I get the background in the right position.

[code=html]
<div id=”contentbg”>

<ul id=”nav”>
<li><a href=”index.shtml”>Home</a></li>
<li><a href=”sessions.shtml”>Sessions</a></li>
<li><a href=”products.shtml”>Products</a></li>
<li><a href=”gallery.shtml”>Gallery</a></li>
<li><a href=”contact.shtml”>Contact</a></li>
<li><a href=”clients.shtml”>Clients</a></li>
<li><a href=”http://cathrynjupp.com/blog/”>Blog</a></li>
</ul>

</div>[/code]

CSS:

[QUOTE]

#contentbg {
background: #fff url(images/contentbg.jpg) center top no-repeat;
margin:0 auto;
margin-top:0;
width:900px;
min-height:600px;
text-align:left;
}

#nav {
overflow:hidden;
background:transparent;
margin-left:323px;
margin-top:165px;
width:900px;
list-style-type:none;
padding:0;
}

#nav li {
float:left;
}

#nav li a {
display:block;
width:65px;
padding:3px;
margin-left:6px;
text-align:center;
}

#nav li a:link, #nav li a:visited {
font-weight:bold;
text-decoration:none;
color:#ccc;
background-color:#666;
}

#nav li a:hover {
font-weight:bold;
color:#666;
background-color:#ccc;
}

[/QUOTE]

Btw, everything validates, the CSS and the HTML of both versions. I’m just hoping I’ve missed something simple on the second version so I can have a cleaner code.

Thanks in advance for your help ?

to post a comment
CSS

3 Comments(s)

Copy linkTweet thisAlerts:
@FangApr 07.2009 — body {
margin:0;
padding:0;
background:#fff url(images/background.jpg) no-repeat fixed center top;
color:#000;
font-family: Verdana, Arial, sans-serif;
font-size:12px;
text-align:center;
min-width:900px;
}

a:link, a:visited {
color:#ccc;
text-decoration:underline;
}

a:hover {
color:#666;
text-decoration:underline;
}

a:active {
color:#666;
text-decoration:underline;
}

img.heading {
width:210px;
height:130px;
border:0;
}


#contentbg {
padding-top:155px;
background: #fff url(images/contentbg.jpg) no-repeat center top;
margin:0 auto;
width:900px;
min-height:450px;
text-align:left;
}

#nav {
overflow:hidden;
background:transparent;
margin-left:323px;
width:550px;
list-style-type:none;
padding:0;
}

#nav li {
float:left;
}

#nav li a {
display:block;
width:65px;
padding:3px;
margin-left:6px;
text-align:center;
}

#nav li a:link, #nav li a:visited {
font-weight:bold;
text-decoration:none;
color:#ccc;
background-color:#666;
}

#nav li a:hover {
font-weight:bold;
color:#666;
background-color:#ccc;
}


#content {
background:transparent;
width:700px;
padding-left:170px;
}

#title {
background:transparent;
margin-top:10px;
margin-bottom:-30px;
}


#footer {
background: #fff url(images/footer.jpg) no-repeat;
margin:0 auto;
color: #000;
width: 900px;
text-align: left;
padding:130px 0 10px 0;
}

#footer p {
background:transparent;
font-size:10px;
margin-top:0px;
margin-left:6px;
margin-bottom:5px;
}

#footer p a:link, #footer p a:visited {
text-decoration:underline;
color:#333;
}

#footer p a:hover {
text-decoration:underline;
color:#999;
}
&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt;
&lt;html&gt;&lt;head&gt;




&lt;title&gt;
Cathryn Jupp : Portrait Photographer : Child | Family | Newborn | Maternity : Perth (Rockingham) WA
&lt;/title&gt;

&lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;

&lt;meta name="Name" content="Cathryn Jupp"&gt;

&lt;meta name="Author" content="Cathryn Jupp"&gt;

&lt;meta name="Creator" content="Cathryn Jupp"&gt;

&lt;meta name="Publisher" content="Cathryn Jupp"&gt;

&lt;meta name="Copyright" content="Cathryn Jupp 2009"&gt;

&lt;meta name="Distributor" content="Local"&gt;

&lt;meta name="Rating" content="General"&gt;

&lt;meta name="Robots" content="All"&gt;

&lt;meta name="Revisit-After" content="7 days"&gt;

&lt;meta name="DESCRIPTION" content="Portrait photographer specialising in newborn, maternity, child and family, located
south of Perth, Western Australia"&gt;

&lt;meta name="KEYWORDS" content="portrait,photographer,photography,family photos,Perth WA,Perth,Rockingham WA,Rockingham,SOR,child photography,natural light,Cathryn Jupp,kids,children,child,on location photography,baby photos,maternity photos,child photos,custom photography,family photographer,child photographer,newborn photographer,outdoors photography,memories,parent gift ideas,family portrait,child portrait, newborn portrait, maternity portrait"&gt;

&lt;link rel="stylesheet" type="text/css" href="photo2.css"&gt;

&lt;link rel="shortcut icon" href="/favicon.ico"&gt;

&lt;/head&gt;&lt;body&gt;

<i> </i> &lt;div id="contentbg"&gt;

<i> </i> &lt;ul id="nav"&gt;
<i> </i> &lt;li&gt;&lt;a href="http://romana.webcity.com.au/&amp;#37;7Ecat49763/new/index.shtml"&gt;Home&lt;/a&gt;&lt;/li&gt;
<i> </i> &lt;li&gt;&lt;a href="http://romana.webcity.com.au/%7Ecat49763/new/sessions.shtml"&gt;Sessions&lt;/a&gt;&lt;/li&gt;
<i> </i> &lt;li&gt;&lt;a href="http://romana.webcity.com.au/%7Ecat49763/new/products.shtml"&gt;Products&lt;/a&gt;&lt;/li&gt;
<i> </i> &lt;li&gt;&lt;a href="http://romana.webcity.com.au/%7Ecat49763/new/gallery.shtml"&gt;Gallery&lt;/a&gt;&lt;/li&gt;
<i> </i> &lt;li&gt;&lt;a href="http://romana.webcity.com.au/%7Ecat49763/new/contact.shtml"&gt;Contact&lt;/a&gt;&lt;/li&gt;
<i> </i> &lt;li&gt;&lt;a href="http://romana.webcity.com.au/%7Ecat49763/new/clients.shtml"&gt;Clients&lt;/a&gt;&lt;/li&gt;
<i> </i> &lt;li&gt;&lt;a href="http://cathrynjupp.com/blog/"&gt;Blog&lt;/a&gt;&lt;/li&gt;
<i> </i> &lt;/ul&gt;

<i> </i> &lt;div id="content"&gt;
<i> </i> &lt;img id="title" src="images/welcome.png" class="heading" alt="Welcome" height="130" width="230"&gt;

<i> </i> &lt;p&gt;
I am a portrait photographer located in the Rockingham area, south of
Perth, Western Australia. I work in the greater Perth region, from
Mandurah up to the northern suburbs of Perth. I specialise in modern
portrait photography of children and families, newborn and maternity. &lt;/p&gt;
&lt;p&gt;
The photography session is held either in your home and yard, where the
child feels comfortable, or on location. Taking the time to get to know
your child and not pressuring them to take specific poses results in
natural, candid photography that captures the essence of who your child
really is. &lt;/p&gt;
&lt;p&gt;
I offer high resolution digital images on CD as well as more
traditional paper printing, albums, coffee table books and modern
canvas prints. &lt;/p&gt;
&lt;p&gt;
Please look around the site for more details and to view my portfolio.
To see my most recent work, have a look at the photos posted as session
previews on my blog. &lt;/p&gt;
&lt;p&gt;
Custom photography of your family is a beautiful way of preserving
precious memories. Photographs make perfect gifts for grandparents,
aunts, uncles and friends. Your children will treasure their photos in
years to come. &lt;/p&gt;

<i> </i> &lt;/div&gt;

<i> </i> &lt;/div&gt;

<i> </i> &lt;div id="footer"&gt;

<i> </i> &lt;p&gt;
Best viewed with &lt;a href="http://www.mozilla-europe.org/en/products/firefox/"&gt;Mozilla Firefox 3&lt;/a&gt; or IE7 at 1024x768 resolution or higher.
&lt;/p&gt;
&lt;p&gt;
Other browsers can &lt;a href="mailto:[email protected]?subject=Feedback%20for%20Website%20Browser%20Compatibility" class="small"&gt;send feedback to me&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
Web Design by Cathryn Jupp &amp;#169; 2009&lt;br&gt;
&lt;/p&gt;

<i> </i> &lt;/div&gt;

&lt;/body&gt;&lt;/html&gt;
I would drop the "Best viewed ...", sound like you won't bother to check your site in other browsers.
Copy linkTweet thisAlerts:
@CathrynauthorApr 07.2009 — Wow awesome you fixed it ?

I firstly want to thank you, I have been blundering around on the web on and off for years, googling here and there and slowly teaching myself whatever I need for my purpose at the time but I always hit walls I can't overcome. Having someone edit my code and make it work is something no-one has done before and I can't express just how helpful it is and how much I appreciate that you spent your time doing that.

Now I have some questions, so that I can do it myself next time! If you don't have time to answer, I understand, you've already helped so much ?

I went through and compared both files to try and see exactly what you did.

The main thing I'm not understanding is how your changes to the contentbg id work. Hmm, scratch that, I think I'm starting to get it. The padding pushes the navbar down, not the background image. Is that right? The navbar is inside the contentbg and this links them in the document flow, so when I put the margin on the top of the navbar, there was nothing before it in the page so Firefox assumed I meant start the whole lot at 165px down? To move the navbar vertically I change the contentbg padding.

And then the footer area. I noticed you fixed it up, even though I didn't mention the problem I was having there. Thank you. What I was trying to do with that nested div was to simulate valign="bottom", which doesn't seem to work/exist in css. I see you have used padding to push the text down instead. At first I thought I didn't like it, because I'm going to have to change the padding when I change the text there, to keep it looking like its aligned to the bottom. But then I thought, my way would have the problem of going over the top of the div and making a mess if I had too much text, so I'm sticking with your way. But I've changed the width of the footer p to 550px, so that it wraps before it overlaps the image.

And I took that stuff in the footer text out ? The content is actually not what the site will end up with, either the main "spiel" or the footer, or even the images probably, I just needed to have something there so I could see what I was doing, so copy pasted from my old site. I used to have a basic html site that I could only get to work properly in Firefox, hopefully this time my site will work a lot better! Especially if I keep hanging around in here ?
Copy linkTweet thisAlerts:
@FangApr 07.2009 — Sounds like you have understood the changes.

The footer could also be done with the text absolutely positioned in a relative div. Using padding reduced the css and html elements used.

Remove the "white space" from your images; this will reduce the page load time. The footer image could be reduced to approx. 300 x 150, then align it right in the background.
×

Success!

Help @Cathryn spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...