View Full Version : having trouble with the <address> tag
brothercake
01-23-2003, 04:58 PM
I'm getting into this whole semantics of HTML stuff ... I must admit - when CSS and dynamic HTML came along I thought everything could be DIVs and SPANs and it doesn't matter anymore ...
But XML and Bobby showed me the error of that :)
Anyway ... the <address> tag is causing me problems - it doesn't validate - it's not allowed inside <p> and <p> isn't allowed inside it ... is there a way I can get paragraph line-breaking out of it, preferably without using <br /> WHat I really want to do is:
<p>
<address>
<small>
... lines of address ...
</small>
</address>
</p>
justame
01-23-2003, 08:32 PM
bro...
just a sorry® /me cant help ya...:O((( n' :O((( /me hasnt just a heard® of thattt tag before...
'cept heyyy did you just a try® using the <pre> tag??? aka...
<pre>
<small>
... lines of address ...
</small>
</pre>
Catman
01-23-2003, 10:21 PM
It seems pre isn't allowed to contain address either. Would something like this do what you're looking for?
<head>
<style>
div {
width : 16em;
}
</style>
</head>
<body>
<div>
<address>
Joe Smith the Mighty Man
Somewhere Over the Rainbow
Oz
</address>
</div>
</body>
ronaldb66
01-24-2003, 08:36 AM
... Brothercake is on a mission to unveil the lesser known elements in the HTML spec... :D
I checked the specs, too; maybe it's because it's an inline element? W3Schools mentions having to insert breaks to get multiple lines, and the W3C themselves have an example with a elements, but these are still all inline elms.
See if setting display: block leads to anything.
redstormaudio
01-24-2003, 09:10 AM
Originally posted by brothercake
... the <address> tag is causing me problems - it doesn't validate - it's not allowed inside <p> and <p> isn't allowed inside it ...
This may be a bug in the validator. CSE HTML Validator seems to think it's okay to have a <p> in an <address> (though not the other way around). XHTML 1.1 defines them both as block level (http://www.w3.org/TR/xhtml-modularization/abstract_modules.html#s_textmodule) so this should be correct (the <p> element is restricted from containing other block elements (http://www.w3.org/TR/1999/REC-html401-19991224/struct/text.html#h-9.3.1), but I can find no similar restraint on the <address> element).
Sorry *sniffle*, but CSE isn't a validator no matter how much they try to make people believe that. :(
P can be contained in ADDESS in Transitional but not in Strict. ADDRESS can never be contained in P.
I don't understand, ADDRESS does break the line. Do you want the P for the margins? Control them with CSS. :thumbsup:
redstormaudio
01-24-2003, 01:24 PM
Granted CSE isn't perfect, but it certainly is useful. I still can't find any current reference to <address> not allowing a <p> within (though I did find some odd discussions on a w3 mail-list from back around html 3.2 and an example from 1995 on the w3 web site that actually uses <p> in an <address>).
It's a pointless search considering the end result can be achieved in other ways, but I'd still like to see the w3's docs on this. (I wonder what else they've slipped past us...)
ronaldb66
01-24-2003, 02:13 PM
Ehhh, if I understand the DTD correctly (we're talking XHTML 1.0 strict), both p and address are defined as block elements, and can't contain other block elements, at least not eachother. If anyone wants to try reading a DTD for him- or herself, have fun! (http://www.w3.org/TR/2002/REC-xhtml1-20020801/dtds.html#a_dtd_XHTML-1.0-Strict)
Oh, and in the transitional DTD i found sort of the same. And now I'm going to find some ice for my poor brains... :(
Catman
01-24-2003, 02:37 PM
And yet, oddly, a div may contain a div and other block elements.
brothercake
01-24-2003, 03:16 PM
I think meow had the best idea - raw <address> blocks with CSS margins for spacing; that's not ideal - because I want it to degrade back to legacy ... I may end up using <br /> tags after all! Thanks all for the ideas :)
Tails
01-24-2003, 06:52 PM
I'm on this quest too. By the way, many browsers implement the <ADDRESS> tag the same as <I>. I only use the most efficient tags. I don't see the difference from ADDRESS and I. And Italics can be defined in CSS. So there's the choice of perfection and compromise.
But anyway, where can I find every tag in HTML 4.0? I'm writing an HTML tutorial myself and I bet there's a thing or 2 that I've walked past (many people don't use the TBODY and COLGROUP tags and they have potential to simplify code down by alot). Does the W3 have all this on their site?
Catman
01-24-2003, 08:09 PM
How about this (http://www.w3.org/TR/xhtml11/doctype.html) page on the W3C site?
brothercake
01-24-2003, 09:20 PM
Originally posted by Tails
I don't see the difference from ADDRESS and I.
The difference is semantic - <address> means that what contains it is an address; <i> just means it's italic - the former has a specific semantic meaning, the latter is just styling (thanks to jkd who helped me to understand this)
That's what my "mission to unveil the lesser known elements" (:)) is all about - I want to create pages which makes sense semantically without any reference to what they look like.
At a more fundamental level, I'm trying to divorce myself from the notion of "webpage as online DTP" towards the notion as "webpage as semantic logical entity", because that's what it really is.
Sounds heavy I know ... but it's actually not - it's easier.
Don't do the breaks! Don't do the breaks! :o
Use CSS for modern graphical browsers to add margins and leave other agents to handle <address> as they see fit. Set the font-style to normal if you don't like he italics in Netscape 4.
brothercake
01-25-2003, 07:57 PM
Originally posted by meow
Set the font-style to normal if you don't like the italics in Netscape 4.
Yeah right .... like I give two shakes about netscape 4 ....
No not really - actually I'm using @media groups, which ns4 doesn't understand, so it just gets the unstyled layout, same as netscape 3 ;)
ronaldb66
01-27-2003, 10:00 AM
At a more fundamental level, I'm trying to divorce myself from the notion of "webpage as online DTP" towards the notion as "webpage as semantic logical entity", because that's what it really is.
A very good approach indeed, and by all means keep going because I already learned a lot trying to formulate proper answers! I think i'll re-read my HTML 4.01 Bible pretty soon...
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.