Poll HTML Markup

S

shapper

Hello,

I am displaying a poll to a user that has 1 question and 4 answers. I
am using the following HTML markup:

<h3>Question</h3>
<ul>
<li>Answer 1</li>
<li>Answer 2</li>
<li>Answer 3</li>
<li>Answer 4</li>
</ul>

Is this correct? Should I also place the Question in a list item
dropping the header?

Or maybe using a <p> for the question?

Thanks,
Miguel
 
E

Els

shapper said:
I am displaying a poll to a user that has 1 question and 4 answers. I
am using the following HTML markup:

<h3>Question</h3>
<ul>
<li>Answer 1</li>
<li>Answer 2</li>
<li>Answer 3</li>
<li>Answer 4</li>
</ul>

Is this correct? Should I also place the Question in a list item
dropping the header?

Or maybe using a <p> for the question?

I think I'd go for using a <p> for the question, and have the <h3> (or
whichever level of heading is appropriate for it) saying something
like "Poll". It's not a crime to place the question in the <h3>
though, just don't use it in the list, as it is not part of the list.
 
J

Jonathan N. Little

Els said:
I think I'd go for using a <p> for the question, and have the <h3> (or
whichever level of heading is appropriate for it) saying something
like "Poll". It's not a crime to place the question in the <h3>
though, just don't use it in the list, as it is not part of the list.

Style as you wish:

p.question { font-size: 1.25em; font-weight: bold; }
ul.answers { ... }

<h1>The Foo Poll</h1>
<p class="question">Question....?</h3>
<ul class="answers">
<li>Answer 1</li>
<li>Answer 2</li>
<li>Answer 3</li>
<li>Answer 4</li>
</ul>
 
A

Adrienne Boswell

Gazing into my crystal ball I observed shapper <[email protected]>
writing in 25g2000hsx.googlegroups.com:
Hello,

I am displaying a poll to a user that has 1 question and 4 answers. I
am using the following HTML markup:

<h3>Question</h3>
<ul>
<li>Answer 1</li>
<li>Answer 2</li>
<li>Answer 3</li>
<li>Answer 4</li>
</ul>

Is this correct? Should I also place the Question in a list item
dropping the header?

Or maybe using a <p> for the question?

Thanks,
Miguel

This would be a good candidate for a definition list, eg:

<dl>
<dt>What is the not color of an apple?</dt>
<dd>Red</dd>
<dd>Green</dd>
<dd>Blue</dd>
<dd>Yellow</dd>
</dl>
 
J

Jukka K. Korpela

Adrienne said:
This would be a good candidate for a definition list, eg:

No it wouldn't.
<dt>What is the not color of an apple?</dt>

Why do you claim that "What is the not color of an apple?" is a term that
you are defining? It ain't no term. It's a question. Well, a grammatically
malformed question, but still. It does not even _contain_ a term, just
common English words.
 
J

Jukka K. Korpela

shapper said:
I am displaying a poll to a user that has 1 question and 4 answers.

Why do you call it a poll? Is this a _presentation_ of a poll (in a document
_about_ some study)? Or is it supposed to _be_ a poll? If it is, where does
the user enter his answer? If this is really part of a form, you should say
it, since it really matters, for markup purposes and otherwise.
<h3>Question</h3>

Do you have 1st and 2nd level headings at higher structure levels? If not,
you should not use markup for a 3rd level heading.

"Question" is seldom a good heading. Yes, you meant it as a placeholder, but
it is all-important what kind of questions you _really_ have there. If they
are short, you could make them headings at a suitable level. Otherwise, you
should perhaps use short headings that describe the topic of the question,
followed by a paragraph (or maybe <div>) that contains the question itself.
 
A

Adrienne Boswell

No it wouldn't.


Why do you claim that "What is the not color of an apple?" is a term
that you are defining? It ain't no term. It's a question. Well, a
grammatically malformed question, but still. It does not even
_contain_ a term, just common English words.

Bad choice of question and answer, I agree. However, I still think that
a definition list would work here. After all, a question and answer are
a name/value pair, and a word/definition(s) are also a name/value pair.

In reality, the OP would be better off with a label and radio or check
box inputs.
 
H

Harlan Messinger

Jukka said:
No it wouldn't.


Why do you claim that "What is the not color of an apple?" is a term
that you are defining? It ain't no term. It's a question. Well, a
grammatically malformed question, but still. It does not even _contain_
a term, just common English words.

In the spec I don't see:

"The name 'definition list' is meant literally and strictly and should
only be used for the very special case of providing definitions for
words, even though all of you will be hard-put to figure out why we'd
create a special structure just for that one extremely narrow purpose."

but I do see

"Another application of DL, for example, is for marking up dialogues,
with each DT naming a speaker, and each DD containing his or her words."

which contradicts the notion that "definition list" was meant to be
construed strictly, instead of based on its convenience as a term
understood to connote this kind of general data structure, akin to the
Dictionary object available in at least one programming library, which
is nothing more than a map or hash table, and which is probably only
very rarely used for the purpose of matching up terms to definitions.
 
J

Jukka K. Korpela

Harlan said:
In the spec I don't see:

"The name 'definition list' is meant literally and strictly

Bla bla. It still says <dl> is a definition list, and you can check any
decent dictionary for a definition for "definition" if the word is not known
to you.
which contradicts

It has been said umpteen times that the HTML specs is self-contradictory in
this issue and a few others. It still defines <dl> as definition list, even
though it then contradicts, in descriptive prose, its own normative
definition.

The practical side of the matter is that it is more difficult to style a
<dl> than some other markup for a list of Q/A pairs.
 
C

Chris F.A. Johnson

Bla bla. It still says <dl> is a definition list, and you can check any
decent dictionary for a definition for "definition" if the word is not known
to you.

The definitions given in my dictionaries could easily include
questions and answers.
It has been said umpteen times that the HTML specs is self-contradictory in
this issue and a few others. It still defines <dl> as definition list, even
though it then contradicts, in descriptive prose, its own normative
definition.

The practical side of the matter is that it is more difficult to style a
<dl> than some other markup for a list of Q/A pairs.

That's news to me; I've never seen any difficulty in styling them.
 
D

dorayme

Els said:
I think I'd go for using a <p> for the question, and have the <h3> (or
whichever level of heading is appropriate for it) saying something
like "Poll". It's not a crime to place the question in the <h3>
though, just don't use it in the list, as it is not part of the list.

Perhaps it depends on the exact context. If there are a lot of questions
then the questions could go in a list with the answers as sublists.
 
D

dorayme

"Jukka K. Korpela said:
No it wouldn't.

I agree with JK's instincts here. While there are analogies in 'data
structure' (as Harlan says later and Adrienne obviously noticed), surely
it is better practice to keep a tight reign on definition lists. So we
all really know that it means how it sounds. No matter what the
uncertainties are in the specs. It looks to me like a stretch to bring
this tool in here even if it is somehow not forbidden. It would make it
too waffly an element.

There is no question and answer element, one must look to the context.
In some, a p and an unordered list is appropriate (as Els says), in
other contexts, a list with sub lists (as dorayme said). In yet others,
an ordered list with unordered sublists or even other combinations of
these two types of lists would capture the meaning and purpose of the
communication. We have to see the actual case.

And there is the fine magnificent (ever so often unwelcome) animal in
the room we are all ignoring, the table! This could well be suited.
There are the questions in the left columns and there are the answers in
the right column. The right col associated cell could contain a list.
This list could be ordered or not, depending if the answers have some
sort of ordering characteristic about them. This characteristic could be
mentioned in the table heading. The left col question cells could also
perfectly meaningfully be constructed to rowspan the answer cells.

There is no one answer, there are lots of ways to skin this cat.
 
E

Els

dorayme said:
Perhaps it depends on the exact context. If there are a lot of questions
then the questions could go in a list with the answers as sublists.

True, but I read the OP as using the question as the first list item
of 5. Also, isn't a poll always a single question? (unless he has a
bunch of polls together, then you'd get the list of poll questions of
course)
 
D

dorayme

Els said:
True, but I read the OP as using the question as the first list item
of 5.

You were right, I was just raising another possibility for a broader
case.
Also, isn't a poll always a single question? (unless he has a
bunch of polls together, then you'd get the list of poll questions of
course)

I am not sure there is any one meaning for "poll" that limits it to
this. Some people might mean this following some internet trends, others
might mean to allow for more questions.

Anyway, it is always a slight challenge how to introduce lists and the
general question of how it is to be done is a bit of a theme that comes
up not so rarely. It is always a bit of a question whether to use a p or
a div where it is not an obvious paragraph. Is "Are you over 6ft 5in
tall?" really any kind of paragraph? I don't think it wrong to use a p
here but perhaps because there is no exact element for this sort of
thing, a div might be better on the grounds that a div is what you turn
to when you are not quite sure. I think JK mentioned this alternative in
this thread and I am sympathetic to this.

You might know, later in the thread, I suggested a table would not be
inappropriate either. All depends.
 
H

Harlan Messinger

Jukka said:
Bla bla. It still says <dl> is a definition list, and you can check any
decent dictionary for a definition for "definition" if the word is not
known to you.


It has been said umpteen times that the HTML specs is self-contradictory
in this issue and a few others. It still defines <dl> as definition
list, even though it then contradicts, in descriptive prose, its own
normative definition.

Blah blah yourself, you blowhard. It has also been pointed out umpteen
times that your arbitrary interpretation of the contradiction is not the
only one that exists, and I already *addressed* your point about their
selection of the word "definition" to name the element, so approaching
the issue backwards by challenging me on whether I know what
"definition" means shows just so much obliviousness on your part.
 
H

Harlan Messinger

dorayme said:
I agree with JK's instincts here. While there are analogies in 'data
structure' (as Harlan says later and Adrienne obviously noticed), surely
it is better practice to keep a tight reign on definition lists.

Why? Why "surely"?
So we
all really know that it means how it sounds. No matter what the
uncertainties are in the specs. It looks to me like a stretch to bring
this tool in here even if it is somehow not forbidden. It would make it
too waffly an element.

Would it be fair to call the form element too waffly because it isn't
called <orderform> and restricted to uses involving the ordering of
merchandise? As I see it, the fact that none of the other structured
elements expresses a restricted purpose in that manner makes it unlikely
that in the case of this one element such a restriction of purpose was
either intended or desirable.
 
D

dorayme

Harlan Messinger said:
Why? Why "surely"?

A fair question question. I do my best to answer it below.
Would it be fair to call the form element too waffly because it isn't
called <orderform> and restricted to uses involving the ordering of
merchandise? As I see it, the fact that none of the other structured
elements expresses a restricted purpose in that manner makes it unlikely
that in the case of this one element such a restriction of purpose was
either intended or desirable.

A form is what you fill in when you apply for things or give answers to
set questions. The purpose *is* general in this respect. Something meant
to be filled in and handed over or sent.

Restricting it to the ordering of merchandise would indeed be too
restrictive. Yes, I know, this is your point. But it does not say
anything at all about a free for all in what a form is. Forms are
already known in many walks of life for all sorts of things. That does
not mean they are *meant* for just some narrow things or for about
anything, however useful (eg, to be rolled up to shoo the cat away).

When teaching someone what a form is, I would have thought that there
would be central cases, paradigm cases. One might mention ordering
merchandise as an example, as well as many other things. But not the
possibility of using paper versions to scare cats away. There are some
things outside of what is reasonable to keep a good common understanding
of its meaning and purpose. What is in the centre is a matter of
judgement.

It seems rather odd to me for a definition list to be anywhere near a
question and answer. It simply is nothing to do with defining terms, as
simple as that. I don't like the idea when there are so many *perfectly
good* means to carry out this task. (Els gave one, JK gave variations, I
gave some, including a table)

We can go your way and seize on that data structure point. Data
structure is your way of seeing a two part structure that one can slot
in a pair of things like a question and an answer, or a more complicated
pair where the first item is an object like a question and the second is
a *set* of answers to the first item. But if you allow this to be the
main reason then you are risking a mindset that makes what would be a
terrifically meaningful element into something vague and less useful.
The idea of a definition list is to expand on something at the very
least. An answer to a question is not an expansion of any kind. It is a
different beast altogether.

Vague and less useful? Yes, less useful. It is very easy to suppose that
a word, for example, becomes more useful the wider its meaning. But I
trust you will see that this is simply not so. In the same way, if you
extend the idea of definition list to include all sorts of things
because of some inviting or tempting structure, then you empty the
element of meaning because it makes it harder for browsers to know how
to present them, how to read them out, how to braille them up. Meaning,
as far as a browser is concerned, *is* presentation and the narrower the
meaning, the easier to present it in a way that humans will recognise.

In all of these things, I reckon we need to keep an eye out for what is
good rather than what is black letter law in 'the specs'. Though,
interestingly, JK paints a picture of contradiction there. But I am nt
relying on that.

Btw, I have thought a little more on my previous suggestion about a list
of questions with sublists to each question for the answer and I am not
altogether happy with it, the answers are not sublists of the questions.
It took what I regard as this not altogether happy suggestion about
definition lists to make me realise my own mistake. I was too quick to
draw on data structure analogies. But I still stand by the div
version/list or table solutions.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top