PDA

View Full Version : [SOLVED] css help?



moore.bryan
June 13th, 2008, 02:15 AM
i've been tooling around for about three hours with this (http://www.456bereastreet.com/archive/200501/turning_a_list_into_a_navigation_bar/) thread, but no matter what i do, i can't seem to get the menu centered; what am i doing wrong?
http://www.bmoore.net/test_menu.html

sowelie
June 13th, 2008, 02:20 AM
What browser are you testing in...because in Firefox it looks like you have more than that for issues. But anyway, if you're using fixed width layout set the width of the menu to some number (whatever you want). Then, make the left and right margins auto.

frup
June 13th, 2008, 02:30 AM
I recommend you take a tour through something like htmldog.com

for centred text the css attribute is text-align:center

for centering a div in the middle of the page you can do

margin: 0 auto;

but the rest you would generally do with margins and specific widths etc.

monstermudder78
June 13th, 2008, 05:50 AM
It seems kinda jumbled with my firefox settings, but here is what the web developer toolbar says:

HTML:

# Line 117, Column 10: ID "NAV-WESTERN" already defined.

<li id="nav-Western"><a href="http://www.bmoore.net/western_civ_h.html">Wester



An "id" is a unique identifier. Each time this attribute is used in a document it must have a different value. If you are using this attribute as a hook for style sheets it may be more appropriate to use classes (which group elements) than id (which are used to identify exactly one element).
# Info Line 116, Column 10: ID "NAV-WESTERN" first defined here.

<li id="nav-Western"><a href="http://www.bmoore.net/western_civ_a.html">Wester

# Error Line 123, Column 8: ID "NAV" already defined.

<ul id="nav">



An "id" is a unique identifier. Each time this attribute is used in a document it must have a different value. If you are using this attribute as a hook for style sheets it may be more appropriate to use classes (which group elements) than id (which are used to identify exactly one element).
# Info Line 115, Column 8: ID "NAV" first defined here.

<ul id="nav">

# Warning Line 129, Column 80: cannot generate system identifier for general entity "NodeID".

…atboro-horsham.org/public/?4068Nav=|&NodeID=661" target="main">PS Parent Acce



An entity reference was found in the document, but there is no reference by that name defined. Often this is caused by misspelling the reference name, unencoded ampersands, or by leaving off the trailing semicolon (;). The most common cause of this error is unencoded ampersands in URLs as described by the WDG in "Ampersands in URLs".

Entity references start with an ampersand (&) and end with a semicolon (;). If you want to use a literal ampersand in your document you must encode it as "&amp;" (even inside URLs!). Be careful to end entity references with a semicolon or your entity reference may get interpreted in connection with the following text. Also keep in mind that named entity references are case-sensitive; &Aelig; and &aelig; are different characters.

If this error appears in some markup generated by PHP's session handling code, this article has explanations and solutions to your problem.

Note that in most documents, errors related to entity references will trigger up to 5 separate messages from the Validator. Usually these will all disappear when the original problem is fixed.
# Error Line 129, Column 80: general entity "NodeID" not defined and no default entity.

…atboro-horsham.org/public/?4068Nav=|&NodeID=661" target="main">PS Parent Acce



This is usually a cascading error caused by a an undefined entity reference or use of an unencoded ampersand (&) in an URL or body text. See the previous message for further details.
# Error Line 129, Column 86: reference to entity "NodeID" for which no system identifier could be generated.

…-horsham.org/public/?4068Nav=|&NodeID=661" target="main">PS Parent Access</a>



This is usually a cascading error caused by a an undefined entity reference or use of an unencoded ampersand (&) in an URL or body text. See the previous message for further details.
# Info Line 129, Column 79: entity was defined here.

…hatboro-horsham.org/public/?4068Nav=|&NodeID=661" target="main">PS Parent Acc


And CSS:

69 #nav a:link, #nav a:visited Property text-shadow doesn't exist in CSS level 2.1 but exists in [css2, css3] : 2px 2px 2px #555
86 #Western #nav-Western a, #Global #nav-Global a, #Gov #nav-Gov a, #Homework #nav-Homework a, #Notes #nav-Notes a, #Current #nav-Current a, #10th #nav-10th a, #Philosophy #nav-Philosophy a, #Blackthorn #nav-Blackthorn a, #HH #nav-HH a, #PS #nav-PS a In CSS1, an id name could start with a digit ("#55ft"), unless it was a dimension ("#55in"). In CSS2, such ids are parsed as unknown dimensions (to allow for future additions of new units) To make ".10th" a valid id, CSS2 requires the first digit to be escaped ("#\310th")
93 #Western #nav-Western a, #Global #nav-Global a, #Gov #nav-Gov a, #Homework #nav-Homework a, #Notes #nav-Notes a, #Current #nav-Current a, #10th #nav-10th a, #Philosophy #nav-Philosophy a, #Blackthorn #nav-Blackthorn a, #HH #nav-HH a, #PS #nav-PS a Property text-shadow doesn't exist in CSS level 2.1 but exists in [css2, css3] : none
101 #Western #nav-Western a:hover, #Global #nav-Global a:hover, #Gov #nav-Gov a:hover, #Homework #nav-Homework a:hover, #Notes #nav-Notes a:hover, #Current #nav-Current a:hover, #10th #nav-10th a:hover, #Philosophy #nav-Philosophy a:hover, #Blackthorn #nav-Blackthorn a:hover, #HH #nav-HH a:hover, #PS #nav-PS a:hover In CSS1, an id name could start with a digit ("#55ft"), unless it was a dimension ("#55in"). In CSS2, such ids are parsed as unknown dimensions (to allow for future additions of new units) To make ".10th" a valid id, CSS2 requires the first digit to be escaped ("#\310th")

moore.bryan
June 13th, 2008, 09:38 AM
thanks to all who responded so far... i was just following the guide, verbatim, to see if i could learn some new css for me and thought it was going to be easy. ;-)

@sowelie:
i've looked in konqueror 3.5.9, firefox 3.0rc3, minefield build 2008060602, seamonkey build 2008061201, and opera 9.5.

@frup:
thanks for the site; i'll look into it. i was hoping my issue might be something one could look at and say "oh, here's where you're a dumb-***."

@monstermudder78:
i find it interesting there were errors because i followed the guide to a tee. well, that's the modern world of standards, i guess! ;-)

frup
June 13th, 2008, 10:26 AM
You can only assign an id once. Think of it like unique ID.

and id is a #name { ... }

if you want to use the same bit of css more than once you use a class. a class is defined as

.name { ... }

instead of going for example

<div id="nav-main">

go <div class="nav-main">

#nav-main will be switched to .nav-main

I talk in generic terms because learning from your own mistakes is good. It's certainly the best way to understand HTML and Css.

moore.bryan
June 13th, 2008, 11:26 AM
You can only assign an id once. Think of it like unique ID.

and id is a #name { ... }

if you want to use the same bit of css more than once you use a class. a class is defined as

.name { ... }

instead of going for example

<div id="nav-main">

go <div class="nav-main">

#nav-main will be switched to .nav-main

I talk in generic terms because learning from your own mistakes is good. It's certainly the best way to understand HTML and Css.
can you think of any reason why the author of the tutorial i was reading would assign it more than once, then?

i've decided to completely rework the original code and start from scratch; i completely agree... doing is best.