css programming help someone... please

Post your questions and problem reports here

Moderator: kfury77

Forum rules
Please try to follow these guidelines. This will help to receive faster and more accurate response.

  • Check the Support section of the corresponding product first. Chances are you will find your answer there;
  • Do not create new topics for already reported problems. Add your comments to the existing topics instead;
  • Create separate topic for each problem request. Do NOT post a number of non-related problem reports in a single topic;
  • Give your topic a meaningful title. Titles such as "A question," "Bug report" and "Help!" provide others no clue what your message is about;
  • Include the version number of the software you are using;
  • This is not an official customer support helpdesk. If you need a prompt and official response, please contact our support team directly instead. It may take a while until you receive a reply in the forum;

css programming help someone... please

Postby Silver » Thu Oct 06, 2005 11:48 pm

I've tried www.3wc.org and searching hotbot, so now I'm here.

I found where you can combine multiple classes together in the <body>, but can you

1. have muliple id's together? If so, how? I cannot seem to get it to work.

and

2. I cannot seem to comprehend the difference between class and id. I know it says you can only have 1 instance of an id, but multiple instances of class..
a. does this mean if I use say

#boldtext {
font-variant:small-caps;
font-weight:600;
}

than I can only use <span id="boldtext">only</span> one time in the html body?

-----or--------

2. it means something that I'm just not understanding...

I am using the above instance several times throughout the html page, but I get html tidy, telling me:
Warning: <span>anchor "boldtext" already defined


3. I don't know why it is telling me that it is and anchor, as it isn't, and
4. why would it tell me it is already defined? I have it defined in the <head><style> portion, but not in the html <body>.
??why would it say this is an anchor??

If you want to see what I am talking about, here is the html portion that I am talking about:

<p>H<span class="uppercase"><a name="hawaii" id="hawaii">awaii</a></span> - <span id="bolditalic" class="red">Illegal</span></p>
<blockquote>Hawaii State Law. Rev. Stats. Title 10, Chapter 134.<br />Firearms, Ammunition and Dangerous Weapons. Part 1. <br />General Regulations. Chapter 134-1 Definitions.
<br /><br /> "<span id="boldtext">Electric gun</span>" means any portable device that is electrically operated to project a missile or electromotive force.
<br /><br />Chapter 134-16 Restriction on possession, sale, gift or delivery of electric guns.
<br /><span id="bolditalic" class="green">(a)</span> It shall be unlawful for any person, including a licensed manufacturer, licensed importer or licensed dealer, to possess, offer for sale, hold for sale, sell, give, lend or deliver any electric gun.
<br /><span id="bolditalic" class="green">(b)</span> Any electric gun in violation of subsection (a) shall be confiscated and disposed of by the chief of police.
<div id="boldtext" class="navy">SUMMARY: Possession and sales of Stunning Devices are banned in Hawaii.</div><div id="toppage"><a href="#toppage">Top of page</a></div></blockquote>

and the warnings I am receiving:
Warning: <span> anchor "bolditalic" already defined
Warning: <span> anchor "boldtext" already defined
Warning: <div> anchor "toppage" already defined


I am also using the <div id="toppage"><a href="#toppage">Top of page</a></div> throughout the page.

5. Which leads me to another question/problem.

I have <style> assigned to #toppage { } But if I try to use the code as such in the <body> portion of the html, it won't apply my style.

<a id="toppage" href="#toppage">Top of page</a>

It will only apply the styling by:
<div id="toppage"><a href="#toppage">Top of page</a></div>

what am I doing wrong? Because html tidy doesn't like the second example of this... it gives me that warning above in the quote section.

Anyways, someone please help... I'm ready to pull my hair out, and that hurts! :lol:
We carry safety, security, and defense products, we're here when you need them.
Silver
 
Posts: 10
Joined: Wed Aug 03, 2005 1:14 am
Location: WA

Postby syrupcore » Fri Oct 07, 2005 2:54 am

"1. have muliple id's together? If so, how? I cannot seem to get it to work. "

dont know if you can do that. edit: <deleted some malarkey)

2. Correct. ID only occurs once on a page. Think of classes and IDs like drivers licenses. Only you have your Drivers License but many people might have a class "C" license. I dunno, that helped me. Just change your code to css: .boldtext {.....} and your html: span class="boldtext"

As a side note, consider naming your classes/ids with more semantic names like class="statename" or "substateheading". for instance, if you one day decide that you'd like all of the things on the page that are currently marked up as 'bold text' to be green instead of bold, your 'boldtext' declaration wont make any sense. maybe something like 'important' or whatever. Also, maybe you're just showing an example but what about using <strong> or <em> and then styling those? For instance, from number 4...
this:"<span id="boldtext">Electric gun</span>"
would become: "<strong>Electric gun<strong>"
and
this:<span id="bolditalic" class="green">(a)</span>
would become: <strong class="green"><em>(a)</em></strong>

3+4. See number 2. change your repeating elements to to classes and see what happens.

5. we'd need to see the CSS. of course, you'll have repeated IDs all over the page which will cause problems. I think you really need to go back and fix that and then see what sort of problems you have.

good luck.
Will
Last edited by syrupcore on Fri Oct 07, 2005 6:40 am, edited 1 time in total.
User avatar
syrupcore
Top Contributor
 
Posts: 917
Joined: Thu Jul 21, 2005 12:58 am
Location: Portland, Oregon, usa

I'm no expert, but...

Postby purpleedge2004 » Fri Oct 07, 2005 4:36 am

In broad terms, an ID defines a unique block which can appear once per page. These blocks can have formatting specified - especially positioning, margins and borders.

A class defines formatting, which can be applied to anything.

You can apply class formatting to a block/ID, you can apply multiple class formatting.

eg

<div class="bold-text" id="left-column">
Whatever I type here will appear on the page according to the positioning etc specs defined in #left-column, it will have formatting specified by the bold-text class.
</div>
Regards,
Purple
purpleedge2004
 
Posts: 11
Joined: Fri Jun 24, 2005 1:41 am
Location: Sydney, Oz

Hey Thanks!

Postby Silver » Tue Oct 11, 2005 8:33 am

Thanks both of you for your help, you truly are wonderful to help out. I was leery of using to many "class" as I'd read other bulletin boards and there were quite a few comments about people over using them. So I thought maybe using to many was a big no-no.

And thank you for clarifying the difference between class and id.
We carry safety, security, and defense products, we're here when you need them.
Silver
 
Posts: 10
Joined: Wed Aug 03, 2005 1:14 am
Location: WA

Postby syrupcore » Sat Oct 15, 2005 10:37 am

There *is* quite a bit of overclassing going on. Classes can be really useful but often it's something that you can do by just understanding the cascade. It seems that folks aren't always getting the 'cascade' part of cascading style sheets and how it can help you indentify parts of the page - without cluttering up your code with classes.

I read a really great post on another board recently that really shows the simple power of the cascade. Actually it does involve 'classing out' (IDs actually) but it's something that most people do with scripting. It's a way to highlight the 'current page" on a css menu without having to explicitly declare it on each page. This is cool mostly because it means you can use the same menu code on every page in the site - exactly what you want for ssi or php includes.

Here's the link: http://www.codingforums.com/showpost.ph ... ostcount=7

Will
User avatar
syrupcore
Top Contributor
 
Posts: 917
Joined: Thu Jul 21, 2005 12:58 am
Location: Portland, Oregon, usa


Return to HTMLPad / Rapid CSS / Rapid PHP / WeBuilder Support

Who is online

Users browsing this forum: Google [Bot] and 14 guests

cron