navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

horizontal nav question

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> Cascading Style Sheets >> horizontal nav question
Page: [1]
 
c1sissy

 

Posts: 5084
Joined: 7/20/2002
From: NJ
Status: offline

 
horizontal nav question - 1/31/2004 9:15:30   
I'm working on learning how to do a horizontal navigation, without javascript though.

I found this code online. My question is the usage of the id. I thought that ID could only be applied in one instance on a page? Isn't this going against the rule?
#nav ul{
   padding : 0;
   margin : 0;
   white-space : nowrap;
   background-color : #003399;
   color : White; 
} 
#nav ul li{
   display : inline;
} 
#nav ul li a{
   background-color : #0066CC;
   color : White;
   font-weight : bold;
   text-decoration : none;
}


_____________________________

Deb-aka-c4Ksissy
high panjandurum and alpha female of the silverback tribe
As decreed by Jesper 5-24-2003.
The only stupid question is... the one that is never asked!!
http://directory.css-styling.com
http://fmsforum.com
http://positioniseverything.net/
http://www.tanfa.co.uk/
Nancy

 

Posts: 3626
Joined: 11/9/1999
From: Nebraska
Status: offline

 
RE: horizontal nav question - 1/31/2004 18:22:15   
Deb,

The css rules you have listed are not multiple uses of an ID, but rather a further defining.

For example, the #nav ID would be applied to a div tag.

Then the rule further says that any UL tag within that #nav ID will have the properties that are listed. Then any LI tag within a UL tag within that #nav ID will be display inlined, and further, any links within those LI will be displayed as shown in your coding.

So any link in another DIV tag with a different ID will not behave the same, they could be underlined or different background, or whatever properties they inherit from somewhere else.

By the way these are contextual selectors: they apply only during a specific context, which in your example is when they are within the #nav ID.

Hope this made sense.

Nancy

_____________________________

Easy Estimates -- is a simple to use tool to quickly build a Web site page enabling visitors to quickly and easily create an estimate of the cost of services that you provide.

(in reply to c1sissy)
c1sissy

 

Posts: 5084
Joined: 7/20/2002
From: NJ
Status: offline

 
RE: horizontal nav question - 1/31/2004 20:17:59   
quote:

ORIGINAL: Nancy

Deb,

The css rules you have listed are not multiple uses of an ID, but rather a further defining.

For example, the #nav ID would be applied to a div tag.

Then the rule further says that any UL tag within that #nav ID will have the properties that are listed. Then any LI tag within a UL tag within that #nav ID will be display inlined, and further, any links within those LI will be displayed as shown in your coding.

So any link in another DIV tag with a different ID will not behave the same, they could be underlined or different background, or whatever properties they inherit from somewhere else.

By the way these are contextual selectors: they apply only during a specific context, which in your example is when they are within the #nav ID.

Hope this made sense.

Nancy


Hi Nancy, great to see you!

LOL, as I was reading your reply and thinking that this sounds like contextual selectors!

And yes, this makes sense, I was just sort of surprised as I didn't see any ID's set up like this until I started to search on how to do a horizontal navigation.

Now that I know that this is legitimate, I'm going to play with it as soon as I find the things I need for my next logo assignment.

Thanks again Nancy I really apprecaite your answer!

_____________________________

Deb-aka-c4Ksissy
high panjandurum and alpha female of the silverback tribe
As decreed by Jesper 5-24-2003.
The only stupid question is... the one that is never asked!!
http://directory.css-styling.com
http://fmsforum.com
http://positioniseverything.net/
http://www.tanfa.co.uk/

(in reply to Nancy)
ellipisces

 

Posts: 849
Joined: 12/14/2003
Status: offline

 
RE: horizontal nav question - 2/2/2004 5:31:47   
"borrowed" this horizontal css, look kinda cool, put an unumbered list inside a div with the ID: navcontainer. note: this CSS is from an embedded style sheet but could easily be used in a linked file

#navcontainer
{

height: 20px;
width: 590px;
}

#navcontainer ul
{
border: 0;
margin: 0;
padding: 0;
list-style-type: none;
text-align: center;
}

#navcontainer ul li
{
display: block;
float: left;
text-align: center;
padding: 0;
margin: 0;
}

#navcontainer ul li a
{
background: #CCCCCC;
background-image: url(http://www.yourpicandpath.jpg);
width: 145px;
height: 18px;

padding: 0;
margin: 0 0 0px 0;
color: #333333;
text-decoration: none;
display: block;
text-align: center;
font: normal 10px/18px verdana, lucida, sans-serif;
}

#navcontainer ul li a:hover
{
color: #FFFFFF;
background: #284197;
background-image: url(http://www.yourpicandpath.jpg);
}

</style>


_____________________________


(in reply to c1sissy)
c1sissy

 

Posts: 5084
Joined: 7/20/2002
From: NJ
Status: offline

 
RE: horizontal nav question - 2/2/2004 7:35:07   
Hi ellipisces:
Thanks for the post. I'm going to have a study on this.

I had several tutorials that I had looked at and am now having difficulty finding them!

I like the tuts on things as it helps to see how they are doing something and why.

I know that the display inline does not work for NN4. I believe that there is also a bug for IE5 somehow.

So if you are going to use the horizontal nav, is there a work around? What are the percentages of users on these browsers?

_____________________________

Deb-aka-c4Ksissy
high panjandurum and alpha female of the silverback tribe
As decreed by Jesper 5-24-2003.
The only stupid question is... the one that is never asked!!
http://directory.css-styling.com
http://fmsforum.com
http://positioniseverything.net/
http://www.tanfa.co.uk/

(in reply to ellipisces)
carleygreen

 

Posts: 6
Joined: 12/17/2003
Status: offline

 
RE: horizontal nav question - 2/2/2004 7:53:45   
Are ther any resources for someone knowing nothing about css to get started?

_____________________________

hurry, come one come all... send valentines day flowers online in a hurry to the uk and worldwide.

(in reply to c1sissy)
c1sissy

 

Posts: 5084
Joined: 7/20/2002
From: NJ
Status: offline

 
RE: horizontal nav question - 2/2/2004 7:58:31   
quote:

ORIGINAL: carleygreen

Are ther any resources for someone knowing nothing about css to get started?


Hi Carleygreen
Welcome to the family.

If you click on the css forum, you will see that there are css links at the top, great resources listed in there, and ritarun has posted a link to the tips and resources within this forum that has more links.

Also, once you get started, post away with questions. And it isn't difficult to learn. Very easy.:)

CSS links

CSS Links and resources

< Message edited by c1sissy -- 2/2/2004 8:05:15 >


_____________________________

Deb-aka-c4Ksissy
high panjandurum and alpha female of the silverback tribe
As decreed by Jesper 5-24-2003.
The only stupid question is... the one that is never asked!!
http://directory.css-styling.com
http://fmsforum.com
http://positioniseverything.net/
http://www.tanfa.co.uk/

(in reply to carleygreen)
Giomanach

 

Posts: 6091
Joined: 11/19/2003
From: England
Status: offline

 
RE: horizontal nav question - 2/2/2004 8:01:28   
quote:

And it isn't difficult to learn. Very easy.

You're only saying that 'cos you know how to do it :):)

_____________________________




(in reply to c1sissy)
c1sissy

 

Posts: 5084
Joined: 7/20/2002
From: NJ
Status: offline

 
RE: horizontal nav question - 2/2/2004 8:06:03   
quote:

ORIGINAL: Giomanach

quote:

And it isn't difficult to learn. Very easy.

You're only saying that 'cos you know how to do it :):)


:):)
Hello Son, how are you? I hope that all is going well for you.

_____________________________

Deb-aka-c4Ksissy
high panjandurum and alpha female of the silverback tribe
As decreed by Jesper 5-24-2003.
The only stupid question is... the one that is never asked!!
http://directory.css-styling.com
http://fmsforum.com
http://positioniseverything.net/
http://www.tanfa.co.uk/

(in reply to Giomanach)
Giomanach

 

Posts: 6091
Joined: 11/19/2003
From: England
Status: offline

 
RE: horizontal nav question - 2/2/2004 8:11:54   
Everything's fine here mom, I ended up going back to my old job, slaving over a hot photocopier (xerox to everyone else), but it pays the bills, but I am still looking for anothewr job, need the money so I can come home :)

_____________________________




(in reply to c1sissy)
womynaloud

 

Posts: 142
Joined: 1/17/2002
From: Ponca City Oklahoma USA
Status: offline

 
RE: horizontal nav question - 2/4/2004 4:30:06   
Deb,

Thanks for the links for the horizontal menus. I'm in the process of rebuilding my work site and it will work great. Trying to learn enough css to make the site load faster and look better (and I have a looonnng way to go :))

I'm using one of the horizontal menus from your link, have edited a couple of the parameters so it looks like I want, I just can't figure out how to get it to center itself on the page instead of on the left.

Here's the code I'm using -

quote:


#nav ul{
border-left:0px solid #0066CC; border-right:0px solid #0066CC; border-top:2px solid #0066CC; border-bottom:2px solid #0066CC; padding:0; margin:0; white-space : nowrap;
background-color : #003399;
color : White;
float : left;
width : 698;

}
#nav ul li{
display : inline;
}
#nav ul li a{
padding-left : .5em;
padding-right : .5em;
background-color : #003399;
color : White;
Font-Family: Arial, Verdana, Helvetica;
font-size: 90%;
font-weight : normal;
text-decoration : none;
float : left;
border-right-color : #0066CC;
border-right-style : solid;
border-right-width : 1px;
}
#nav ul li a:hover{
background-color : #99CCFF;
color : #000066;
}



I'm pretty sure it will be something easy, but I've tried changing both of the float tags to center and that didn't do it, so I'm out of ideas! It's also 3:15 in the morning here so my brain isn't working all that well.

Help from anyone would be greatly appreciated!

Gayle

_____________________________

The box said "requires windows 98 or better" so I installed Linux!

(in reply to c1sissy)
c1sissy

 

Posts: 5084
Joined: 7/20/2002
From: NJ
Status: offline

 
RE: horizontal nav question - 2/4/2004 6:36:27   
Hi Gayle, believe it or not, I have a much more simplified version of this.

Try adding a padding-right: 5px;
then add to the pixels as you need to in order to get it to line up the way you want it. Mine took I think 50px.
http://c.1asphost.com/c1sissy/logohomework/week3.html

This works in opera, NN7 and in mozilla.

In case you have difficulty with getting in here is my code, lol, I'm not as fancy as you are, but I'm getting there. I have some corrections to do, I had emailed Nancy as for some reason thigns weren't working out like they said this would with the code.

/*Css list created by DR 2004 for logo homework pages*/
body {
    background-image: url(texture2.gif); repeat:x;
    background-color: #DCDCDC;
    font-style: normal;
    font-weight: normal;
    font-size: medium;
    font-family: arial, "times new roman", serif;
    margin-top: 2em; 
    margin-right: 2em; 
    margin-bottom: 2em;
    margin-left: 2em; 
    }
p    {
    font-family: Helvetica, Verdana, Arial, sans-serif ;
     }
h1  {
    font-family: "Comic Sans MS", sans-serif ;
    text-align: center;
    margin-left: 25%;
    margin-right: 25%;
    border-bottom: 1px #00008B dashed;
    }
h2  {
    }
img {
    margin-left: 15%;
    }
.header {
    width: 98%;
    height:20px;
    background-color: #FFFAF0;
    border-bottom: 6px #00008B solid;
    }
a:link {
    color: #00008B;
    }
a:active {
    color: #2F4F4F;
    }
a:visited {
    color: #000000;
}
a:hover {
    color: #778899;
    font-size: medium;
}

#navlist li {
    display: inline;
    list-stle-type: none;
    padding-right: 50px;
    font-size: small;
    font-weight: bold;
    font-family: arial, sans-serif;
    }
.counter {
    position: absolute;
    background-color: #ffffff;
    margin-left: 25%;
        }



I hope that this helps you out a bit.

< Message edited by c1sissy -- 2/4/2004 6:40:25 >


_____________________________

Deb-aka-c4Ksissy
high panjandurum and alpha female of the silverback tribe
As decreed by Jesper 5-24-2003.
The only stupid question is... the one that is never asked!!
http://directory.css-styling.com
http://fmsforum.com
http://positioniseverything.net/
http://www.tanfa.co.uk/

(in reply to womynaloud)
Giomanach

 

Posts: 6091
Joined: 11/19/2003
From: England
Status: offline

 
RE: horizontal nav question - 2/4/2004 6:40:46   
try http://c.1asphost.com/c1sissy/logohomework/lvs.css

Dan

< Message edited by Giomanach -- 2/4/2004 11:43:09 >


_____________________________




(in reply to c1sissy)
c1sissy

 

Posts: 5084
Joined: 7/20/2002
From: NJ
Status: offline

 
RE: horizontal nav question - 2/4/2004 6:43:21   
quote:

ORIGINAL: Giomanach

try http://c.1asphost.com/c1sissy/logohomework/logohomework_Flvs.css

Dan


Dan, that gives a 404 page error,

_____________________________

Deb-aka-c4Ksissy
high panjandurum and alpha female of the silverback tribe
As decreed by Jesper 5-24-2003.
The only stupid question is... the one that is never asked!!
http://directory.css-styling.com
http://fmsforum.com
http://positioniseverything.net/
http://www.tanfa.co.uk/

(in reply to Giomanach)
Giomanach

 

Posts: 6091
Joined: 11/19/2003
From: England
Status: offline

 
RE: horizontal nav question - 2/4/2004 6:44:32   
see the edit, it's difficult taking it from the File Manager References :)

_____________________________




(in reply to c1sissy)
c1sissy

 

Posts: 5084
Joined: 7/20/2002
From: NJ
Status: offline

 
RE: horizontal nav question - 2/4/2004 12:04:30   
quote:

Deb,

Thanks for the links for the horizontal menus. I'm in the process of rebuilding my work site and it will work great. Trying to learn enough css to make the site load faster and look better (and I have a looonnng way to go )


Gayle, I'm looking for more that give a better explaination of this. Something more on the line of a tutorial, however I seem to be batting a big 0 on this search!

Just so you know, there are issues with IE5 and NN4 with this. I forgot to let you know this in my previous post. I read somewhere about some sort of hack for IE5, but I didn't bookmark it so I don't have it to post for you.

_____________________________

Deb-aka-c4Ksissy
high panjandurum and alpha female of the silverback tribe
As decreed by Jesper 5-24-2003.
The only stupid question is... the one that is never asked!!
http://directory.css-styling.com
http://fmsforum.com
http://positioniseverything.net/
http://www.tanfa.co.uk/

(in reply to womynaloud)
womynaloud

 

Posts: 142
Joined: 1/17/2002
From: Ponca City Oklahoma USA
Status: offline

 
RE: horizontal nav question - 2/4/2004 14:24:17   
Not a problem. I'm still playing with it, colors, etc. Trying to learn css may just drive me crazier than I already am!

Thanks for the help. As soon as I get more than just the home page up, I'll put up a link!

Gayle

_____________________________

The box said "requires windows 98 or better" so I installed Linux!

(in reply to c1sissy)
fiachra

 

Posts: 338
Joined: 5/12/2002
From:
Status: offline

 
RE: horizontal nav question - 2/5/2004 14:13:47   
quote:

ORIGINAL: womynaloud

I just can't figure out how to get it to center itself on the page instead of on the left.

Here's the code I'm using -

quote:


#nav ul{
border-left:0px solid #0066CC; border-right:0px solid #0066CC; border-top:2px solid #0066CC; border-bottom:2px solid #0066CC; padding:0; margin:0; white-space : nowrap;
background-color : #003399;
color : White;
float : left;
width : 698;

}
#nav ul li{
display : inline;
}
#nav ul li a{
padding-left : .5em;
padding-right : .5em;
background-color : #003399;
color : White;
Font-Family: Arial, Verdana, Helvetica;
font-size: 90%;
font-weight : normal;
text-decoration : none;
float : left;
border-right-color : #0066CC;
border-right-style : solid;
border-right-width : 1px;
}
#nav ul li a:hover{
background-color : #99CCFF;
color : #000066;
}



I've tried changing both of the float tags to center and that didn't do it, so I'm out of ideas!

Help from anyone would be greatly appreciated!

Gayle


You can put it in a div and centre the div.

Floats of their very nature can't be centred.

TTFN

Fiachra

_____________________________

www.peopleeatingtastyaliens.com

(in reply to womynaloud)
Page:   [1]

All Forums >> Web Development >> Cascading Style Sheets >> horizontal nav question
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts