Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > tag attributes,

Reply
Thread Tools

tag attributes,

 
 
adam buxton
Guest
Posts: n/a
 
      10-16-2004
hi all,
i'm studying in england ona web design course and the assignment i've
been set states i must use html 4.0 strict.

i've found all the tags and attribute san dam ok with this i just have
one question that the lecturer will not answer becouse it's also part
of the assignment :s

CLASS and ID are common attributes for every tag yes or no? and if yes
is it then ok to give every tag an ID and a CLASS?

the assignment stipulates the use of an averae of two attributes per
tag?

thanks in advance
 
Reply With Quote
 
 
 
 
brucie
Guest
Posts: n/a
 
      10-16-2004
In alt.html adam buxton said:

> CLASS and ID are common attributes for every tag yes or no?


no


--


v o i c e s
 
Reply With Quote
 
 
 
 
Nico Schuyt
Guest
Posts: n/a
 
      10-16-2004
adam buxton wrote:

> i'm studying in england ona web design course and the assignment i've
> been set states i must use html 4.0 strict.


http://www.w3schools.com/css/css_syntax.asp

--
Nico
www.nicoschuyt.nl


 
Reply With Quote
 
Kris
Guest
Posts: n/a
 
      10-16-2004
In article <yspkba5f1rto$(E-Mail Removed)>,
brucie <****@usenetshit.info> wrote:

> > CLASS and ID are common attributes for every tag yes or no?

>
> no


To clarify to the OP: they are common attributes for _nearly every
element_. As far as I remember it comes down to the HTML and HEAD
element and all those elements inside the head section that should not
carry classes and IDs. You may want to double check that before
restating it as a fact.

Be sure to know the difference between tags and elements when digging in.

--
Kris
<(E-Mail Removed)> (nl)
 
Reply With Quote
 
brucie
Guest
Posts: n/a
 
      10-16-2004
In alt.html Kris said:

>>> CLASS and ID are common attributes for every tag yes or no?


>> no


> To clarify to the OP: they are common attributes for _nearly every
> element_. As far as I remember it comes down to the HTML and HEAD
> element and all those elements inside the head section that should not
> carry classes and IDs.


to clarify for the OP: no

> You may want to double check that before restating it as a fact.


yes, that would be a good idea.

you can check for yourself in 2 seconds here:
http://www.w3.org/TR/html401/index/attributes.html

--


v o i c e s
 
Reply With Quote
 
Kris
Guest
Posts: n/a
 
      10-16-2004
In article <(E-Mail Removed)>,
brucie <****@usenetshit.info> wrote:

> >>> CLASS and ID are common attributes for every tag yes or no?

>
> > To clarify to the OP: they are common attributes for _nearly every
> > element_. As far as I remember it comes down to the HTML and HEAD
> > element and all those elements inside the head section that should not
> > carry classes and IDs.

>
> to clarify for the OP: no


I remembered wrongly. Nevertheless I was right on the 'nearly every
element' bit.

Good I had the disclaimer ready.

> > You may want to double check that before restating it as a fact.

>
> yes, that would be a good idea.
>
> you can check for yourself in 2 seconds here:
> http://www.w3.org/TR/html401/index/attributes.html


Thanks for this. I learned something today...

--
Kris
<(E-Mail Removed)> (nl)
 
Reply With Quote
 
Andy Dingley
Guest
Posts: n/a
 
      10-16-2004
On 16 Oct 2004 04:03:51 -0700, http://www.velocityreviews.com/forums/(E-Mail Removed) (adam
buxton) wrote:

Ignore W3 Schools. If you're asking questions at this level, you need
to read the real specification.
http://www.w3.org/TR/html4/sgml/dtd.html

Learn how to read a DTD. The effort will repay itself.

>CLASS and ID are common attributes for every tag yes or no?


They're certainly common, but not on _every_ element.

Strictly speaking, they're "coreattrs". Inside the DTD an entity is
declared called "coreattrs", which contains the set of attributes (
id, class, style, title ). These are intended for "common" use across
all elements (or nearly all). The element definitions then include
this entity "coreattrs", or else the entity "attrs" (which includes
coreattrs indirectly).

AFAIK all the HTML elements include this entity, from <body> down.
The elements used outside the body; <html>, <head>, <title> etc. are
the ones that don't include them.

Also "id" is an attribute, rather than "ID". Although HTML is
case-insensitive, XML and XHTML are case-sensitive, and you should
start paying attention to this.

"ID" is a basic SGML type within the DTD. It has constrained
behaviour; it must have a suitable format for a "name" and it must be
unique in the document. Because id is declared as being an ID, it
also behaves in this way. If you invent your own DTD though (maybe
for some new XML application), attributes called "id" aren't unique
identifiers unless you've also set their type.


> if yes is it then ok to give every tag an ID and a CLASS?


Yes (except for that handful of elements)


>the assignment stipulates the use of an averae of two attributes per
>tag?


That's a crude rule of thumb, but it's a reminder to use plenty of
these attributes, wherever they're appropriate. You can apply the
same logic to the "title" attribute too.

Searching this newsgroup for "semantic" will show you many threads on
appropriate use of class and id.

In general, I use lots of class attributes for the purposes of CSS and
I use a few id attributes to assist with DHTML (client-side
JavaScript). I use very few id attributes for CSS purposes.

If there's the remotest likelihood that there could be more than one
element of a particular style on the page, then use class rather than
id. Even if you can't think why, just if it's not demonstrably wrong
to have more than one. In DHTML though, it's often necessary to
_uniquely_ identify an element, even if there are several very similar
ones.

Paste some of your code up for critique, if you want.

--
Smert' spamionam
 
Reply With Quote
 
Nico Schuyt
Guest
Posts: n/a
 
      10-16-2004
Andy Dingley wrote:

> Ignore W3 Schools. If you're asking questions at this level, you need
> to read the real specification.
> http://www.w3.org/TR/html4/sgml/dtd.html


At his level it's not likely he understands a word of that

--
Nico
www.nicoschuyt.nl


 
Reply With Quote
 
Andy Dingley
Guest
Posts: n/a
 
      10-16-2004
On Sat, 16 Oct 2004 16:00:31 +0200, "Nico Schuyt"
<(E-Mail Removed)> wrote:

>> http://www.w3.org/TR/html4/sgml/dtd.html

>
>At his level it's not likely he understands a word of that


Probably not. But then maybe he'll post again asking for help.

DTDs aren't _hard_, they're just seen as hard, really _are_ hard to
locate an explanation for, then they get ignored.

On a course that sems to be taking a reasonable approach to web
design, then one would hope that the tutor would explain the
significance and reading of a DTD.


Anyone have a favourite link on the reading of DTDs ?

 
Reply With Quote
 
Michael Winter
Guest
Posts: n/a
 
      10-16-2004
On Sat, 16 Oct 2004 16:52:54 +0100, Andy Dingley <(E-Mail Removed)>
wrote:

[snip]

> Anyone have a favourite link on the reading of DTDs ?


The basic explanation
(<URL:http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.3>) earlier in the
Recommendation was enough for me when I first started trying to read the
DTDs. I don't know what anyone else thinks of it though.

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do u invoke Tag b's Tag Handler from within Tag a's tag Handler? shruds Java 1 01-27-2006 03:00 AM
To vlan tag or not to tag? budyerr Cisco 1 07-08-2004 03:45 AM
using param or out tag inside sql tag (jsp/jstl/tomcat) shahbaz Java 0 10-27-2003 02:46 AM
struts tag inside a tag kishan bisht Java 1 07-08-2003 11:04 PM
How to embed the <jsp:plugin> tag into a tag handler class...HELP !! jstack Java 1 07-04-2003 06:58 PM



Advertisments