![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Have a FAQ page , where have many sets of questions and answers. The questions need to be a different colour / style and the answers different. Was wondering is there a easy way to do this as compared to enclosing each question and answer within divs ? Perhaps , through JavaScript. |
#3
| |||
| |||
|
|
Have a FAQ page , where have many sets of questions and answers. The questions need to be a different colour / style and the answers different. A FAQ can be considered a definition list (name/value pairs). Use CSS to |
#4
| |||
| |||
|
|
A FAQ can be considered a definition list (name/value pairs). |
|
Use CSS to style <dt> and <dd> to taste. |
#5
| |||
| |||
|
|
A FAQ can be considered a definition list (name/value pairs). A dog can be considered a horse, but it ain't no horse. (Besides, it's not even name/value pairs. A question is not a name.) Use CSS to style <dt> and <dd> to taste. In addition to being illogical (semantically wrong) markup, using <dl> wins nothing. It's _more difficult_ to style than simple logical markup such as |
|
h2> for questions. (If you wish to style an answer as a unit, then you had better make it a classed <div>, since it need not consist of a single paragraph, and an answer can contain many different elements in succession.) dd> and <div> are both flow elements. Either way <p>s, <ul>s, etc., are |
#6
| |||
| |||
|
|
dd> and <div> are both flow elements. Either way <p>s, <ul>s, etc., are required for the content. |
* --><!ELEMENT DD - O (%flow
* --><!ENTITY
#7
| |||
| |||
|
|
dd> and <div> are both flow elements. Either way <p>s, <ul>s, etc., are required for the content. |
* -->
* -->
#8
| |||
| |||
|
|
dd> and <div> are both flow elements. Either way <p>s, <ul>s, etc., are required for the content. Sorry. Let me try that again. !ELEMENT DIV - - (%flow * --!ELEMENT DD - O (%flow * --[...] So DIV and DD can both take content without further markup (#PCDATA). True. |
#9
| |||
| |||
|
|
David Trimboli wrote: dd> and <div> are both flow elements. Either way <p>s, <ul>s, etc., are required for the content. Sorry. Let me try that again. !ELEMENT DIV - - (%flow * --!ELEMENT DD - O (%flow * --[...] So DIV and DD can both take content without further markup (#PCDATA). True. But that was not my point. Jukka claimed using a <dl> was illogical, semantically incorrect, and more work than using a combination of hx> and div> because of the layout requirements that answers to FAQs may need. I do not see that the level of difficulty is any different. |
#10
| |||
| |||
|
|
But that was not my point. Jukka claimed using a <dl> was illogical, semantically incorrect, and more work than using a combination of hx> and <div> because of the layout requirements that answers to FAQs may need. I do not see that the level of difficulty is any different. I don't know about level of difficulty, but questions and answers together do not make a definition list. The answer is not the definition of the question. This is why DL is semantically incorrect. That is taking a <dl> literally, in its most narrow sense. Even the spec |
|
It seems to me the most meaningful way to do this is: div class="faq" h1>What is the answer to my question?</h1 p>The answer is no.</p h1>Are you a quack?</h1 p>The answer is yes.</p p>I am a duck.</p /div Or: |
|
Notice that my markup is no more complex than a definition list would be. My point exactly. |
![]() |
| Thread Tools | |
| Display Modes | |
| |