Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

HTML Forum


You are currently viewing our HTML Forum as a guest. Please register to participate.
Login



Post a Project »

Find a Professional HTML Freelancer!

Find a Freelancer to help you with your HTML projects

FREE Outsourcing eBook!

Closed Thread
UL nav won't position.
Old 10-04-2009, 05:30 PM UL nav won't position.
keatoru's Avatar
Novice Talker

Posts: 9
Name: Kent
Trades: 0
I am try to code the navbar for the site i am making. In the navbar there is a logo on the left and buttons on the right. The code so far looks like this:
html:
Code:
    <div id="head">
         <div id="logo" />
      <div class="nav">
          <ul>
          <li><a href="http://gfxgrounds.com"><img src="images/home/home.gif" border="0" /></a></li>
          <li><a href="http://gfxgrounds.com/forums"><img src="images/home/forums.gif" border="0" /></a></li>
          <li><a href="#"><img src="images/home/tutorials.gif" border="0" /></a></li>
          <li><a href="#"><img src="images/home/affiliate.gif" border="0" /></a></li>
          <li><a href="#"><img src="images/home/aboutus.gif" border="0" /></a></li>
          <li><a href="#"><img src="images/home/contactus.gif" border="0" /></a></li>
        </ul>
      </div>
    </div>
CSS:
Code:
.body {background-image:url(images/home/bg.gif);
    background-repeat:repeat;
}

#head {background-image:url(images/home/navbg.gif);
    background-repeat:repeat-x;
    height:100px;
    width:auto;
    margin-left:auto;
    margin-right:auto;
}

#logo {background-image:url(images/home/logo.gif);
    background-repeat:no-repeat;
    float:left;
    height:100px;
    width:430px;
}

.nav {float:right;
    width:465px;
    height:100px;
}

.nav ul {padding:0;
    margin:0;
    list-style:none;
}

.nav li {float:left;
}
I am using Dreamweaver CS4 to code it. In dreamweaver everything looks as it should but then when I open the page in firefox the buttons are ontop of my logo and won't float right as i've told them to.

Can someone help me fix this?
keatoru is offline
View Public Profile
 
 
Register now for full access!
Old 10-04-2009, 05:35 PM Re: UL nav won't position.
Super Talker

Posts: 127
Name: Darren Fox
Location: Illinois
Trades: 0
Float right can cause a lot of problems. You should try separating the two and use a float left for both. You will also need to specify a width for both and not use auto.
__________________
Darren Fox
Idea Web Design + Internet Marketing

Please login or register to view this content. Registration is FREE
darrenfox is offline
View Public Profile Visit darrenfox's homepage!
 
Old 10-04-2009, 05:42 PM Re: UL nav won't position.
keatoru's Avatar
Novice Talker

Posts: 9
Name: Kent
Trades: 0
i think you misunderstood the code. the width auto in my css is for the bar itself, with no logo and no buttons, just blank, and it stretches across the screen. so i don't see how changing that will affect my buttons

that bar is set in a div. inside that div i have two more divs, a logo and buttons. i set fixed dimensions for both of those and floated them to the appropriate sides of the screen.

the logo is on the left and the buttons are on the right.

but the buttons won't go right.
keatoru is offline
View Public Profile
 
Old 10-04-2009, 06:07 PM Re: UL nav won't position.
StylaStyla's Avatar
Mad Man

Posts: 401
Name: Styla
Location: City of London
Trades: 0
add float right to your nav ul

You've set your div to float right but not your UL. In addition to that, display:block to your logo would tighten things up.

If that doesn't fix it; a link to your page would be helpful.

Oh and Dreamweaver's layout view (or whatever it's called) is not known to be accurate.
__________________
Freelance Graphic Designer not for hire
StylaStyla is offline
View Public Profile Visit StylaStyla's homepage!
 
Old 10-04-2009, 06:09 PM Re: UL nav won't position.
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
Quote:
Float right can cause a lot of problems.
Why ? It's no different than a float:left.

Quote:
the width auto in my css is for the bar itself, with no logo and no buttons, just blank, and it stretches across the screen.
By default, if you don't define a width, then it's going to take up 100% of the horizontal space of it's parent anyway, so width:auto is rather pointless if that's all you're doing. However, if you're going to float an element, you MUST give it a width.

The nav won't go RIGHT because it's INSIDE the div with the logo, which you defined with a width of 430px. Where can it go if it's INSIDE the same space as the logo ??? Take it OUT of that div and it will go to the right inside of the #head div.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
View Public Profile
 
Old 10-04-2009, 06:13 PM Re: UL nav won't position.
StylaStyla's Avatar
Mad Man

Posts: 401
Name: Styla
Location: City of London
Trades: 0
Quote:
Originally Posted by LadynRed View Post

The nav won't go RIGHT because it's INSIDE the div with the logo, .
oops. didn't notice that.

Eagle-eyed coders these days.
__________________
Freelance Graphic Designer not for hire
StylaStyla is offline
View Public Profile Visit StylaStyla's homepage!
 
Old 10-04-2009, 06:15 PM Re: UL nav won't position.
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
I've been a coder for a very long time...
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
View Public Profile
 
Old 10-04-2009, 08:19 PM Re: UL nav won't position.
keatoru's Avatar
Novice Talker

Posts: 9
Name: Kent
Trades: 0
i see what i did now thanks.

for my logo div it is like this:
Code:
<div id="logo" />
i tryed closing it normally as if i were putting something inside
Code:
<div id="logo">
</div>
and it fixed the problem. guess i just can't close a div like that.
keatoru is offline
View Public Profile
 
Old 10-04-2009, 08:23 PM Re: UL nav won't position.
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
No, you cannot close a div that way. The only time you use that method to close is for tags that do not have closing tags, such as the <img> tag or <br> and others. If an element has a proper closing tag, that is what you must use.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
View Public Profile
 
Old 10-04-2009, 09:00 PM Re: UL nav won't position.
keatoru's Avatar
Novice Talker

Posts: 9
Name: Kent
Trades: 0
ok, will remember that thanks
keatoru is offline
View Public Profile
 
Closed Thread     « Reply to UL nav won't position.
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 1.08043 seconds with 12 queries