/    Sign up×
Community /Pin to ProfileBookmark

3 images in header.. A very complicated question..

Sorry to post so may times in one day, but its hard learning on my own.

Basically I sliced my header into 3 images, as one part I want to be a clickable logo.

So far I got the left and center images to align on the top using CSS but the third image seems to contain itself within the width of the two abover.

Here is my code

[CODE]<?xml version=”1.0″ encoding=”UTF-8″?>
<!DOCTYPE html
PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd” />

<html xmlns=”http://www.w3.org/1999/xhtml”
xml:lang=”en” lang=”en” />
<head>
<title>TheDj’s Net First Design Test</title>
<link rel=”stylesheet” href=”css/default.css” />
</head>
<body>
<div id=”container”>
<div id=”header”>

<img src=”images/top_left_banner.gif” alt=”TheDj’s First Design Test /> <!–left of banner–>

<div id=”centerheader”>
<img src=”images/middle_logo_banner.gif” alt=”Logo” />

<div id=”headerright”>
<img src=”images/top_right_banner.gif” alt=”top right” />
<ul id=”nav”>
<li><a href=”#”>Home</a></li>
<li><a href=”#”>Members</a></li>
<li><a href=”#”>Login</a></li>
</ul>

</div> <!–end header–>

<div id=”main”>
<div id=”main_content_left”>
<img src=”images/main_content_left.gif” />
</div> <!–end main content left–>

<div id=”main_content_left_2″>
<img src=”images/main_content_left_2.gif” />
</div> <!–end main content left 2–>

<div id=”main_content_left_top_3″>
<img src =”images/main_content_left_top_3″ />
</div> <!–end main content left top 3–>

<div id=”main_content_bottom_3″>
<img src=”images/main_content_bottom_3.gif” />
</div> <!–end main content 3 bottom–>

<div id=”main_content_left_top_4″>
<img src=”images/main_content_left_top_4.gif” />
</div> <!–end main content 4 top–>

<div id=”main_content_left_bottom_4″>
<img src=”images/main_content_left_bottom_4.gif” />
</div> <!–end main content 4 bottom–>

<div id=”main_content_left_top_5″>
<img src=”images/main_content_left_to_5.gif” />
</div> <!–end main content 5 top–>

<div id=”main_content_left_bottom_5″>
<img src=”images/main_content_left_bottom_5.gif” />
</div> <!–end main content 5 bottom–>

<div id=”main_content_last_right”>
<img src=”images/main_content_left_bottom_6.gif”

</div> <!–end main–>

</div><!–end container–>

</body>
</html>[/CODE]

And here is my CSS

[CODE]/*RESET*/

html, body, div, span,
h1, h2, h3, h4, h5, h6, p,
a, em, font, img,
dl, dt, dd, ol, ul, li,
{
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-size: 100&#37;;
vertical-align: baseline;
background: transparent;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}

/*Main Styles*/

html {
background: url(images/bg.gif) repeat;
}

#container {
width: 800px;
height: 800px;
background: #ffffff;
margin: 3em auto;
}

#header {
overflow: hidden;
heaight: 100%; /*for IE*/
float: left;
}

#header img {
float: left;
}

#headerright ul#nav {
float: right;
}

#centerheader img {
float: left;
}

#headerright {
float: right;
}

#headerright img {
float: right;
}

#headerright ul#nav {
float: top-right;
}

/*Main Content*/

#main_content_left {
float: left;
}
[/CODE]

With that code in place the first 2 header sections align perfectly side by side.. the thrid header section lines below and in line with the right edge of my headers center image..

Im not sure what to do to fix it, I appreciate your help.

Thanks

to post a comment
CSS

10 Comments(s)

Copy linkTweet thisAlerts:
@aj_nscJun 22.2009 — You didn't close any of the DIVs you opened in your header.

Also, img tags can have id's, too, why not just style the img directly inside of wrapping it in a div which has no meaning?

EDIT:

Something else I just picked up on but the following line has no meaning:

<i>
</i>body {
line-height: 1;
}


1 what? px? em? &#37;? pina coladas?

And the only legal values for float are left, right, none, and inherit...top-right is not allowed there.
Copy linkTweet thisAlerts:
@NerdygeekauthorJun 22.2009 — I added in another 3 closing div's just before my header and div..

Although it's still the same problem.

Left and center image for header line up perfectly but the right hand image of my header is down a line and only lining up with right hand edge of header center image :-(

It seems that the right hand header image is taking a new line, but I haven't stated to take a new line.. so confusing :-(

Here is a screenshot of what happens

http://img194.imageshack.us/img194/203/strangecss.jpg


I've figured that mayeb it's the nav bar not allowing room for the image to go into the header, also tried to search google for what that is called when I get the navbar to display within that image, without any luck.
Copy linkTweet thisAlerts:
@WebWarriorJun 22.2009 — As aj_nsc mentioned, you must first fix body { line-height: 1px; } in CSS you must always specify the units. Enclosing divs for images aren't needed either. In fact in your case using #header img { float: left; } would work. Since all of the images inside the div#header would be floating left. I am not sure if that would provide you with a desired effect though, since judging from the image that you provided, you are probably trying to center the images inside a container (creating a banner perhaps). In this case I would recommend not breaking the image into 3 separate img's, but rather use one large image as #header's background. Like so

#header

{

background: url(yourimage.jpg) no-repeat top left;

height: 60px; /* your image's height*/ position: relative; /* This part is very important as explained below */

}

Of course you want the right image to be clickable (hyperlink). Simple insert an <a> tag inside the #header and give it a styling so that it appears on the right side inside #header and occupies as much space as you need. CSS example below:

#header a

{

position: absolute; /* This element will use absolute coordinate positioning relative to #header */

display: block; /* We need the whole Width x Height area to be clickable */

top: 0;

left: 500px; /* or whatever X, Y position within #header your want to start at */

width: 60px; /* or whatever width and height you need */

height: 60px;

}

Also, you need to fix the misspelling in your CSS

#header

{

height: 100&#37;; /* misspelled in your CSS as heaight */

}
Copy linkTweet thisAlerts:
@NerdygeekauthorJun 22.2009 — Your idea is great but unfortunatley doesnt solve my problem.

It's the nav bar, I want it to be on the right hand side of my header, so the very right hand image contains my navigation.

I can see now that it's the navigation is obstructing the right hand image from moving into place as it is taking up more pixels..

At least I think that's what it is.

I'm trying my hardest here, but nothing I do works, and I have no idea what to search for to get the nav to display over the top of my image instead of beside it.
Copy linkTweet thisAlerts:
@anna55Jun 22.2009 — Can we have a link to your page?
Copy linkTweet thisAlerts:
@NerdygeekauthorJun 22.2009 — There is no page Im using firebug developer addon, it saves me time uploading all of the time.

I guess if I knew what to search for to force the nav bar into or over the top of the thrid image it would be solved.
Copy linkTweet thisAlerts:
@anna55Jun 22.2009 — There is no page Im using firebug developer addon, it saves me time uploading all of the time.
[/QUOTE]

It will save you more time to invest in a few seconds of uploading. All your different threads might be answered then. But if you like to go on posting....

As I see it there is too much float in your properties.
Copy linkTweet thisAlerts:
@NerdygeekauthorJun 22.2009 — It will save you more time to invest in a few seconds of uploading. All your different threads might be answered then. But if you like to go on posting....

As I see it there is too much float in your properties.[/QUOTE]


I'm only learning I dont have a oparticular site to upload to, I might not ever even use this creation but it is a learning process.

Too much float?

I've discovred when I remove the nav eveything fits into place in the header, so my supicions are correct that the navbar needs some sort of property that forces it to display over the top of the right hand image, but I don't know what it's called or how to do it :-(
Copy linkTweet thisAlerts:
@aj_nscJun 23.2009 — There's about 10000000 free hosts out there. Sign up for an account so you'll have a place to upload your files so we can see.

If you don't want to do that, then attach your site in a zip file to your post (images, html and css).
Copy linkTweet thisAlerts:
@NerdygeekauthorJun 23.2009 — Thanks everyone for your responses.

I went and covered a CSS 2 course and it helped me understand more about markup and CSS.

So I guess my question is voided now.

Until next time.

NerdyGeek
×

Success!

Help @Nerdygeek 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 6.17,
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: @nearjob,
tipped: article
amount: 1000 SATS,

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

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...