By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,244 Members | 1,381 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,244 IT Pros & Developers. It's quick & easy.

a in h2, or h2 in a

P: n/a
I have a heading that I would like to link to site section, in the following
context:

<h1>Site Contents</h1>
<h2>First Section</h2>
<h2>Second Section</h2>
<h2>Third Section</h2>

I want that the section headings are poining to the relevant sections of the
site. Since I am not specialist, excuse me if it is a stupid question, but
which is better (in sence of good html):

<a href="section1"><h2>First Section<h2></a>

- or -

<h2><a href="section1">First Section</a></h2>?

At least I noticed that some (older) browsers tend to render it diferenly if
I use a:hover.

Thanks for your time,
suncho
Jul 20 '05 #1
Share this Question
Share on Google+
28 Replies


P: n/a
Atanas Boev wrote:
I want that the section headings are poining to the relevant sections of
the site. Since I am not specialist, excuse me if it is a stupid question,
but which is better (in sence of good html):

<a href="section1"><h2>First Section<h2></a>


This is not HTML, <a> elements are inline and cannot contain block elements
(<h*> elements are blocks).
--
David Dorward <http://dorward.me.uk/>
Jul 20 '05 #2

P: n/a
Atanas Boev wrote:
I want that the section headings are poining to the relevant sections of the
site. Since I am not specialist, excuse me if it is a stupid question, but
which is better (in sence of good html):

<a href="section1"><h2>First Section<h2></a>
Inline *can't* contain block-level.

- or -

<h2><a href="section1">First Section</a></h2>?


Block *can* contain inline-level.

Instead of 'section' use '#section' or is the page you are pointing to
called 'section' (without extension), which would make this a valid URI.

Also, if you are making a list of links, you are better of using <ul>
instead of <h2>, <h2> can be used to be pointed to:

<ul>
<li><a href="#section1">First Section</a></li>
</ul>

<!-- more document here -->

<h2 id="section1">First Section</h2>

--
Anne van Kesteren
<http://www.annevankesteren.nl/>
Jul 20 '05 #3

P: n/a
In article <bt**********@news.cc.tut.fi> in
comp.infosystems.www.authoring.html, Atanas Boev wrote:

<a href="section1"><h2>First Section<h2></a>

- or -

<h2><a href="section1">First Section</a></h2>?


The first is wrong, and the second may be correct.

But do you really want the heading to be a LINK? Normally the
headings are placed that can be linked to, from elsewhere. In this
case you would want
<h2><a name="section1">First Section</a></h2>

--
Stan Brown, Oak Road Systems, Cortland County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2 spec: http://www.w3.org/TR/REC-CSS2/
2.1 changes: http://www.w3.org/TR/CSS21/changes.html
validator: http://jigsaw.w3.org/css-validator/
Jul 20 '05 #4

P: n/a

"Stan Brown" <th************@fastmail.fm> wrote in message
news:MP************************@news.odyssey.net.. .
But do you really want the heading to be a LINK? Normally the
headings are placed that can be linked to, from elsewhere. In this
case you would want
<h2><a name="section1">First Section</a></h2>


Or simply <h2 name="section1">First Section</h2>
Jul 20 '05 #5

P: n/a
Neal wrote:
<h2><a name="section1">First Section</a></h2>
Or simply <h2 name="section1">First Section</h2>


<h2> elements do not support the name attribute, perhaps you mean <h2
id="section1"> - although this isn't supposed in most antique browsers.

--
David Dorward <http://dorward.me.uk/>
Jul 20 '05 #6

P: n/a
"Anne van Kesteren" <ma**@annevankesteren.nl> wrote in message
news:bt**********@reader08.wxs.nl...
Atanas Boev wrote:
I want that the section headings are poining to the relevant sections of the site. Since I am not specialist, excuse me if it is a stupid question, but which is better (in sence of good html):

<a href="section1"><h2>First Section<h2></a>
Inline *can't* contain block-level.

- or -

<h2><a href="section1">First Section</a></h2>?


Block *can* contain inline-level.

Instead of 'section' use '#section' or is the page you are pointing to
called 'section' (without extension), which would make this a valid URI.

My mistake, I meant <a href="section1.html">
Also, if you are making a list of links, you are better of using <ul>
instead of <h2>, <h2> can be used to be pointed to:

<ul>
<li><a href="#section1">First Section</a></li>
</ul>


Thanks a lot, seems better approach that way!

In that case, which is a good way to achieve the following:

<ul>
<li><a href="#section1.html">First Section</a></li>
<p>In first section of the site you can find the following items...</p>
<li><a href="#section2.html">Second Section</a></li>
<p>In second section of the site you can find the following items...</p>
</ul>

Is there a good HTML way to have link title and long description?

suncho

Jul 20 '05 #7

P: n/a
On Sat, 3 Jan 2004 22:55:54 +0200, Atanas Boev wrote:
<ul>
<li><a href="#section1.html">First Section</a></li>
<p>In first section of the site you can find the following items...</p>
<li><a href="#section2.html">Second Section</a></li>
<p>In second section of the site you can find the following items...</p>
</ul>

Is there a good HTML way to have link title and long description?


<dl>
<dt><a href="#section1">First Section</a></dt>
<dd>In first section of the site you can find the following
items...</dd>
<dt><a href="#section2">Second Section</a></dt>
<dd>In second section of the site you can find the following
items...</dd>
</dl>

<dl> stands for "definition list". <dt> stands for "definition
term". <dd> stands for "definition description".

When linking to an anchor on the same page, don't use #foo.html,
since you're not linking to an HTML document.

Ian
--
http://www.aspipes.org/
http://www.bookstacks.org/
http://www.learnsomethingnew.us/
Jul 20 '05 #8

P: n/a
Ian Rastall wrote:
When linking to an anchor on the same page, don't use #foo.html,
since you're not linking to an HTML document.


Just in ongoing search for knowledge: is that actually wrong or is it
just not necessary.

For example in my weblog pages I *do* include the pagename before the
id, like <a href="weblog.html#20040103">, so, when at the end of the
month I make up a new page, again with the name 'weblog.html' all I have
to do is find and replace these "weblog.html#" with "year-month.html#".
Is that wrong?

--

Barbara

http://home.wanadoo.nl/b.de.zoete/html/weblog.html
http://home.wanadoo.nl/b.de.zoete/html/webontwerp.html

Jul 20 '05 #9

P: n/a
"Ian Rastall" <id*******@sbcglobal.net> wrote in message
news:us****************************@40tude.net...
<dl>
<dt><a href="#section1">First Section</a></dt>
<dd>In first section of the site you can find the following
items...</dd>
<dt><a href="#section2">Second Section</a></dt>
<dd>In second section of the site you can find the following
items...</dd>
</dl>
Thanks alot! I have nested list of links and descriptions, can I nest
definition lists?

My page structure is like the following:
- Section1 title (linked to site section)
- Subsection1.1 title (linked to subsection)
Paragraph explaining what could be find in the subsection1.1
- Subsection1.2 title (linked to subsection)
Paragraph explaining what could be find in the subsection1.2
- Section2 title (linked to site section)
- Subsection2.1 title (linked to subsection)
Paragraph explaining what could be find in the subsection2.1
- Subsection2.1 title (linked to subsection)
Paragraph explaining what could be find in the subsection2.1

How do I do that?
When linking to an anchor on the same page, don't use #foo.html,
since you're not linking to an HTML document.


My typo, I meant <a href="section2.html"> ...maybe it's time to get some
sleep now;)
suncho
Jul 20 '05 #10

P: n/a
David Dorward wrote:
Neal wrote:

<h2><a name="section1">First Section</a></h2>


Or simply <h2 name="section1">First Section</h2>

<h2> elements do not support the name attribute, perhaps you mean <h2
id="section1"> - although this isn't supposed in most antique browsers.


supported*

You may be correct (Netscape 4?), but those browsers don't have market
share anyway and the new way is cleaner and doesn't make pages act
funky, when authors apply CSS styles like:

a:hover OR a:active OR a:focus

Correct alternatives (that also give less problems with the <a name=""/>
syntax) are:

a:link:hover AND a:visited:hover etc.

--
Anne van Kesteren
<http://www.annevankesteren.nl/>
Jul 20 '05 #11

P: n/a
Barbara de Zoete wrote:
Just in ongoing search for knowledge: is that actually wrong or is it
just not necessary.
The last. Identifiers can contain dots.
For example in my weblog pages I *do* include the pagename before the
id, like <a href="weblog.html#20040103">, so, when at the end of the
month I make up a new page, again with the name 'weblog.html' all I have
to do is find and replace these "weblog.html#" with "year-month.html#".
Is that wrong?


You could better link directly to the archived posts for Google, don't
you think?

Besides, identifiers can't start with a number. You should use
'#post-20030103' or something similar.
--
Anne van Kesteren
<http://www.annevankesteren.nl/>
Jul 20 '05 #12

P: n/a
Atanas Boev wrote:
Thanks alot! I have nested list of links and descriptions, can I nest
definition lists?

My page structure is like the following:
- Section1 title (linked to site section)
- Subsection1.1 title (linked to subsection)
Paragraph explaining what could be find in the subsection1.1
- Subsection1.2 title (linked to subsection)
Paragraph explaining what could be find in the subsection1.2
- Section2 title (linked to site section)
- Subsection2.1 title (linked to subsection)
Paragraph explaining what could be find in the subsection2.1
- Subsection2.1 title (linked to subsection)
Paragraph explaining what could be find in the subsection2.1

How do I do that?


Since you are so full of interest for correct markup :-):

<ul>
<li>Section1 title (linked to site section)
<dl>
<dt>Subsection1.1 title (linked to subsection)</dt>
<dd>Paragraph explaining what could be find in the subsection1.1</dd>
<dt>Subsection1.2 title (linked to subsection)</dt>
<dd>Paragraph explaining what could be find in the subsection1.2</dd>
</dl>
</li>
<li>Section2 title (linked to site section)
<dl>
<dt>Subsection2.1 title (linked to subsection)</dt>
<dd>Paragraph explaining what could be find in the subsection2.1</dd>
<dt>Subsection2.1 title (linked to subsection)</dt>
<dd>Paragraph explaining what could be find in the subsection2.1</dd>
</dl>
</li>
</ul>

I hope I didn't made any obvious mistakes...
--
Anne van Kesteren
<http://www.annevankesteren.nl/>
Jul 20 '05 #13

P: n/a
Anne van Kesteren wrote:
Barbara de Zoete wrote:
For example in my weblog pages I *do* include the pagename before the

id, like <a href="weblog.html#20040103">, so, when at the end of the
month I make up a new page, again with the name 'weblog.html' all I
have to do is find and replace these "weblog.html#" with
"year-month.html#". Is that wrong?


You could better link directly to the archived posts for Google, don't
you think?


Hang on. How did Google get in here? I'm talking about a page I maintain
locally and that I upload whenever I've made a change to it (which is
probably about every day or more often). There are no dayly individual
posts that make one big page or something.
Besides, identifiers can't start with a number. You should use
'#post-20030103' or something similar.


Now, this is helpfull. I did get about as many validation errors as
there are entries on my weblogpages. And they do tell me it's about the
<id> I use for every day. I just couldn't find out what was wrong. Now
at least I understand. Thanks.

--

Barbara

http://home.wanadoo.nl/b.de.zoete/html/weblog.html
http://home.wanadoo.nl/b.de.zoete/html/webontwerp.html

Jul 20 '05 #14

P: n/a
Barbara de Zoete wrote:
You could better link directly to the archived posts for Google, don't
you think?


Hang on. How did Google get in here? I'm talking about a page I maintain
locally and that I upload whenever I've made a change to it (which is
probably about every day or more often). There are no dayly individual
posts that make one big page or something.


I think I misunderstood your URI structure and made a (now) irrelevant
comment on it. Sorry about that.
Besides, identifiers can't start with a number. You should use
'#post-20030103' or something similar.


Now, this is helpfull. I did get about as many validation errors as
there are entries on my weblogpages. And they do tell me it's about the
<id> I use for every day. I just couldn't find out what was wrong. Now
at least I understand. Thanks.


Glad I could help.
--
Anne van Kesteren
<http://www.annevankesteren.nl/>
Jul 20 '05 #15

P: n/a
Ian Rastall <id*******@sbcglobal.net> wrote:
<dl>
<dt><a href="#section1">First Section</a></dt>
<dd>In first section of the site you can find the following
items...</dd>
That's illogical markup, since you are not giving a definition of the
term "First Section". Instead, you imply that the reader already knows
what the phrase means. You are using it as a heading for the subsequent
text. Does this ring a bell?
<dl> stands for "definition list". <dt> stands for "definition
term". <dd> stands for "definition description".


Well, almost; <dd> stands for "definition data".

Common as it might be to abuse <dl> for lists of items with associated
text, it is neither logical nor useful presentationally. You can more
easily achieve a desired appearance by using headings and paragraphs
under them, then adding some CSS.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 20 '05 #16

P: n/a
On Sat, 03 Jan 2004 22:48:19 +0100, Barbara de Zoete wrote:
For example in my weblog pages I *do* include the pagename before the
id, like <a href="weblog.html#20040103">, so, when at the end of the
month I make up a new page, again with the name 'weblog.html' all I have
to do is find and replace these "weblog.html#" with "year-month.html#".
Is that wrong?


Well, I'm not sure I understand what you mean. When you type <a
href="foo.html#bar"></a>, you're linking to an internal anchor in a
different document, unless foo.html is the document you're in. But
you don't need to do that.

Ian
--
http://www.aspipes.org/
http://www.bookstacks.org/
http://www.learnsomethingnew.us/
Jul 20 '05 #17

P: n/a
In article <3f**********************@news.rcn.com> in
comp.infosystems.www.authoring.html, Neal wrote:

"Stan Brown" <th************@fastmail.fm> wrote in message
news:MP************************@news.odyssey.net. ..
But do you really want the heading to be a LINK? Normally the
headings are placed that can be linked to, from elsewhere. In this
case you would want
<h2><a name="section1">First Section</a></h2>


Or simply <h2 name="section1">First Section</h2>


I don't think so. Maybe you're thinking of
<h2 id="section1">First Section</h2>
That's valid, but Netscape 4 can't find a link to #section1 when the
anchor is an id.

I haven't _quite_ given up on having links work in Netscape 4. Not
quite.

--
Stan Brown, Oak Road Systems, Cortland County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2 spec: http://www.w3.org/TR/REC-CSS2/
2.1 changes: http://www.w3.org/TR/CSS21/changes.html
validator: http://jigsaw.w3.org/css-validator/
Jul 20 '05 #18

P: n/a
On Sat, 3 Jan 2004 20:04:46 -0500, Stan Brown wrote:
Netscape 4 can't find a link to #section1 when the
anchor is an id.


You could always use the "name" and "id" attributes at the same
time, although I doubt that's correct usage.

Ian
--
http://www.aspipes.org/
http://www.bookstacks.org/
http://www.learnsomethingnew.us/
Jul 20 '05 #19

P: n/a
On Sat, 3 Jan 2004, Ian Rastall wrote:
On Sat, 3 Jan 2004 20:04:46 -0500, Stan Brown wrote:
Netscape 4 can't find a link to #section1 when the
anchor is an id.
You could always use the "name" and "id" attributes at the same
time,


It was indeed a recommended transitional technique (HTML/4.*).
although I doubt that's correct usage.


Not "correct" in the sense of SGML purism, but quite a practical
transitional approach (as long as a DOCTYPE is used which permits this
usage, of course).

Not nearly as repulsive as XHTML/1.0 Appendix C, anyhow :-}
Jul 20 '05 #20

P: n/a
Jukka K. Korpela wrote:
Ian Rastall <id*******@sbcglobal.net> wrote:

<dl>
<dt><a href="#section1">First Section</a></dt>
<dd>In first section of the site you can find the following
items...</dd>

That's illogical markup, since you are not giving a definition of the
term "First Section". Instead, you imply that the reader already knows
what the phrase means. You are using it as a heading for the subsequent
text. Does this ring a bell?


Not really, in <dd> you are just defining (describing actually) what the
section (<dt>) is all about. With this kind of markup, you can easily
see those are related to each other, the description and the link to the
chapter.

--
Anne van Kesteren
<http://www.annevankesteren.nl/>
Jul 20 '05 #21

P: n/a
Ian Rastall wrote:
On Sat, 03 Jan 2004 22:48:19 +0100, Barbara de Zoete wrote:
For example in my weblog pages I *do* include the pagename before the
id, like <a href="weblog.html#20040103">, so, when at the end of the
month I make up a new page, again with the name 'weblog.html' all I have
to do is find and replace these "weblog.html#" with "year-month.html#".
Is that wrong?


Well, I'm not sure I understand what you mean. When you type <a
href="foo.html#bar"></a>, you're linking to an internal anchor in a
different document, unless foo.html is the document you're in. But
you don't need to do that.


I'm sorry. Appearently I wasn't very clear. But yes, you answer my
question. Linking inside the document you're in can be done with
"foo.html#bar" but it is not necessary.

--

Barbara

http://home.wanadoo.nl/b.de.zoete/html/weblog.html
http://home.wanadoo.nl/b.de.zoete/html/webontwerp.html

Jul 20 '05 #22

P: n/a

"Jukka K. Korpela" <jk******@cs.tut.fi> wrote in message
news:Xn****************************@193.229.0.31.. .
Ian Rastall <id*******@sbcglobal.net> wrote:
<dl>
<dt><a href="#section1">First Section</a></dt>
<dd>In first section of the site you can find the following
items...</dd>


That's illogical markup, since you are not giving a definition of the
term "First Section". Instead, you imply that the reader already knows
what the phrase means. You are using it as a heading for the subsequent
text. Does this ring a bell?


Many thanks to all the people who helped me! Maybe I'm going too far into
the discussion, but I really want to make my best efforts of making my page
correct, so I need one final clarification. I have list of links with
associated text to them.

My first approach was like:
<h1>Main heading of the page</h1>
<span class="section_formatting">
<h2><a href="section1/index.html">Section1 of the site</a></h2>
<h3><a href="section1/item1.html">Item 1 in Section1</a></h3>
<p>Description of Item 1 in Section1</p>
<h3><a href="section2/item1.html">Item 2 in Section1</a></h3>
<p>Description of Item 2 in Section2</p>
</span>
<span class="section_formatting">
<h2><a href="section2/index.html">Section2 of the site</a></h2>
<h3><a href="section2/item1.html">Item 1 in Section2</a></h3>
<p>Description of Item 1 in Section2</p>
<h3><a href="section2/item2.html">Item 2 in Section2</a></h3>
<p>Description of Item 2 in Section2</p>
</span>

Then, after being advised to use lists I constructed it as follows:
<h1>Main heading of the page</h1>
<ul class="section_formatting">
<li><a href="section1/index.html">Section1 of the site</a>
<dl>
<dt><a href="section1/item1.html">Item 1 in Section1</a></dt>
<dd>Description of Item 1 in Section1</dd>
<dt><a href="section1/item2.html">Item 2 in Section1</a></dt>
<dd>Description of Item 2 in Section1</dd>
</dl>
</li>
</ul>
<ul class="section_formatting">
<li><a href="section1/index.html">Section2 of the site</a>
<dl>
<dt><a href="section2/item1.html">Item 1 in Section2</a></dt>
<dd>Description of Item 1 in Section2</dd>
<dt><a href="section2/item2.html">Item 2 in Section2</a></dt>
<dd>Description of Item 2 in Section2</dd>
</dl>
</li>
</ul>

The second approach looks more structured, but it doesn't render good with
the stylesheet turned off (the <dl> parts don't get indented under <li>),
which made me think that probably it's not a good code. "section_formatting"
is a block 256px x 256px with border.

Which approach do you think it better? Or maybe something else? Please help,
I'm totaly lost ;(
suncho
Jul 20 '05 #23

P: n/a
Atanas Boev wrote:
Then, after being advised to use lists I constructed it as follows:
<h1>Main heading of the page</h1>
<ul class="section_formatting">
<li><a href="section1/index.html">Section1 of the site</a>
<dl>
<dt><a href="section1/item1.html">Item 1 in Section1</a></dt>
<dd>Description of Item 1 in Section1</dd>
<dt><a href="section1/item2.html">Item 2 in Section1</a></dt>
<dd>Description of Item 2 in Section1</dd>
</dl>
</li>
</ul>
<ul class="section_formatting">
<li><a href="section1/index.html">Section2 of the site</a>
<dl>
<dt><a href="section2/item1.html">Item 1 in Section2</a></dt>
<dd>Description of Item 1 in Section2</dd>
<dt><a href="section2/item2.html">Item 2 in Section2</a></dt>
<dd>Description of Item 2 in Section2</dd>
</dl>
</li>
</ul>


<h1>Main heading of the page</h1>
<ul class="section_formatting">
<li><a href="section1/index.html">Section1 of the site</a>
<dl>
<dt><a href="section1/item1.html">Item 1 in Section1</a></dt>
<dd>Description of Item 1 in Section1</dd>
<dt><a href="section1/item2.html">Item 2 in Section1</a></dt>
<dd>Description of Item 2 in Section1</dd>
</dl>
</li>
<li><a href="section1/index.html">Section2 of the site</a>
<dl>
<dt><a href="section2/item1.html">Item 1 in Section2</a></dt>
<dd>Description of Item 1 in Section2</dd>
<dt><a href="section2/item2.html">Item 2 in Section2</a></dt>
<dd>Description of Item 2 in Section2</dd>
</dl>
</li>
</ul>

You don't need to start a new <ul> or end the first.

--
Anne van Kesteren
<http://www.annevankesteren.nl/>
Jul 20 '05 #24

P: n/a
In article <7w***************************@40tude.net> in
comp.infosystems.www.authoring.html, Ian Rastall wrote:
You could always use the "name" and "id" attributes at the same
time, although I doubt that's correct usage.


Then why bring it up? :-)

--
Stan Brown, Oak Road Systems, Cortland County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2 spec: http://www.w3.org/TR/REC-CSS2/
2.1 changes: http://www.w3.org/TR/CSS21/changes.html
validator: http://jigsaw.w3.org/css-validator/
Jul 20 '05 #25

P: n/a
On Sun, 4 Jan 2004 10:48:08 -0500, Stan Brown wrote:
In article <7w***************************@40tude.net> in
comp.infosystems.www.authoring.html, Ian Rastall wrote:
You could always use the "name" and "id" attributes at the same
time, although I doubt that's correct usage.


Then why bring it up? :-)


Well ... you didn't hear it from me, but sometimes it helps to break
the rules. Especially if it's code that may technically be invalid,
but which doesn't cause any problems in browsers. Not always the
best solution, but sometimes ... it works.

Ian
--
http://www.aspipes.org/
http://www.bookstacks.org/
http://www.learnsomethingnew.us/
Jul 20 '05 #26

P: n/a

"Ian Rastall" <id*******@sbcglobal.net> wrote in message
news:1c******************************@40tude.net.. .
On Sun, 4 Jan 2004 10:48:08 -0500, Stan Brown wrote:
You could always use the "name" and "id" attributes at the same
time, although I doubt that's correct usage.


Then why bring it up? :-)


Well ... you didn't hear it from me, but sometimes it helps to break
the rules. Especially if it's code that may technically be invalid,
but which doesn't cause any problems in browsers. Not always the
best solution, but sometimes ... it works.


What I don't understand fully - there's no way they could allow name
and id together? Even though this means an author must choose between
valid code and being accessible to older browsers?
Jul 20 '05 #27

P: n/a
On Sun, 4 Jan 2004 12:33:06 -0500, Neal wrote:
What I don't understand fully - there's no way they could allow name
and id together?


This is an excellent topic, and I wish I could answer your question
accurately. I just don't understand HTML parsing well enough. But I
do know that browsers ignore something they don't understand, and
probably also things that are redundant.

I've doubled up on name and id in the past, and had no trouble that
I could see. I often work with footnotes, where the user can jump to
the bottom of the page and back up again, and if they can't go back
up they get annoyed.

Ian
--
http://www.aspipes.org/
http://www.bookstacks.org/
http://www.learnsomethingnew.us/
Jul 20 '05 #28

P: n/a
"Atanas Boev" <su*************@cs.tut.fi> wrote:
My first approach was like:
<h1>Main heading of the page</h1>
<span class="section_formatting">
<h2><a href="section1/index.html">Section1 of the site</a></h2>
<h3><a href="section1/item1.html">Item 1 in Section1</a></h3>
<p>Description of Item 1 in Section1</p>
<h3><a href="section2/item1.html">Item 2 in Section1</a></h3>
<p>Description of Item 2 in Section2</p>
</span> (etc.)

That's fine, except for the fact that <span> is by definition an inline
element and must not contain block elements like h2, h3, p. Use <div>
instead. Oh, and as a class name, mere "section" would be more natural.
The second approach [using <dl>] looks more structured,


Maybe it looks like, and maybe it even is, but it's _wrong_ structure.
There's no definition list, in fact, in the document. Besides, what you
do have is lower level headings. And especially the h2 elements in your
first approach work well by having more weight (to search engines, and
in the appearance of the document) than the rest.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 20 '05 #29

This discussion thread is closed

Replies have been disabled for this discussion.