473,651 Members | 2,917 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Applying Different Styles To Alternate Text ?

Hi,

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.

Thanks in advance ..

P.S. this might be a multipost.. :(

Jul 15 '06 #1
13 1491
vivekian wrote:
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.
Use CSS. What if the visitor has JavaScript disabled or not available?

<h1>My FAQ>
<h2>Question 1</h2>
<p>Answer for question 1</p>

<h2>Question2 </h2>
<p>You get the idea...</p>

CSS:

body { font-family: sans-serif; }
h2 { color: red; font-family: serif; }
p { color: black; }

--
-bts
-Warning: I brake for lawn deer
Jul 15 '06 #2
vivekian wrote:
>
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
style <dtand <ddto taste.

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
Jul 15 '06 #3
Jim Moe <jm************ ***@sohnen-moe.comscripsit :
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 <dtand <ddto taste.
In addition to being illogical (semantically wrong) markup, using <dlwins
nothing. It's _more difficult_ to style than simple logical markup such as
<h2for 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.)

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Jul 15 '06 #4
Jukka K. Korpela wrote:
>
> 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 <dtand <ddto taste.

In addition to being illogical (semantically wrong) markup, using <dlwins
nothing. It's _more difficult_ to style than simple logical markup such as
Saying it is illogical does not make it so.
Name/value, term/definition, question/answer. How are these semantically
different? What is illogical about it?
<h2for 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.)
<ddand <divare both flow elements. Either way <p>s, <ul>s, etc., are
required for the content.

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
Jul 16 '06 #5
"Jim Moe" <jm************ ***@sohnen-moe.comwrote in message
news:hL******** *************** *******@giganew s.com...
<ddand <divare both flow elements. Either way <p>s, <ul>s,
etc., are
required for the content.
<!ELEMENT DIV - - (%flow;)* --><!ELEMENT DD - O (%flow;)* --><!ENTITY
% flow "%block; | %inline;"><!ENT ITY % inline "#PCDATA | %fontstyle; |
%phrase; | %special; | %formctrl;">So DIV and DD can both take content
without further markup (#PCDATA).David Stardate 6542.6
Jul 17 '06 #6
"Jim Moe" <jm************ ***@sohnen-moe.comwrote in message
news:hL******** *************** *******@giganew s.com...
<ddand <divare 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;)* -->

<!ENTITY % flow "%block; | %inline;">

<!ENTITY % inline "#PCDATA | %fontstyle; | %phrase; | %special; |
%formctrl;">
So DIV and DD can both take content without further markup (#PCDATA).

David
Stardate 6542.6
Jul 17 '06 #7
David Trimboli wrote:
> <ddand <divare 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 <dlwas illogical,
semantically incorrect, and more work than using a combination of <hxand
<divbecause of the layout requirements that answers to FAQs may need. I
do not see that the level of difficulty is any different.

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
Jul 17 '06 #8
"Jim Moe" <jm************ ***@sohnen-moe.comwrote in message
news:Fe******** *************** *******@giganew s.com...
David Trimboli wrote:
>> <ddand <divare 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 <dlwas
illogical,
semantically incorrect, and more work than using a combination of
<hxand
<divbecause 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.

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>

Now you can style the questions and answers as you like.

div.faq h1 {color: red; background-color: white; font-weight: bold;}
div.faq p {color: black; background-color: white; font-weight:
normal;}

Notice that my markup is no more complex than a definition list would
be.

David
Stardate 6545.2
Jul 18 '06 #9
David Trimboli wrote:
> But that was not my point. Jukka claimed using a <dlwas
illogical,
semantically incorrect, and more work than using a combination of
<hxand <divbecause 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 <dlliterally, in its most narrow sense. Even the spec
[1] has this to add: "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 is a question/answer example!
This brings me back to one of my questions: Name/value,
term/description, question/answer. How are these semantically different
and incorrect for definition list? From the spec [1]: "Definition lists
vary only slightly from other types of lists in that list items consist of
two parts: a term and a description." Two parts, hmm.
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:
<dl class="faq">
<dt>Are you a quack?</dt>
<dd>
<p>The answer is yes.</p>
<p>I am a duck. Quack!</p>
</dd>
</dl>
If a definition term is not a question, then how is a heading a
question? "A heading element briefly describes the topic of the section it
introduces."[2]
>
Notice that my markup is no more complex than a definition list would
be.
My point exactly.

________
[1] <http://www.w3.org/TR/html4/struct/lists.html#edef-DL>
[2] <http://www.w3.org/TR/html4/struct/global.html#ede f-H1>

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
Jul 18 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
4191
by: Geoff Cox | last post by:
Hello, I publish some web pages using large fonts and would like to give the user the opportunity to print the pages using a smaller font. I believe that this is possible using different style sheets? I am not clear how the user would select the different .css files? Seems to be easier than having duplicate html files ...
3
3364
by: Armand Karlsen | last post by:
Is it possible to apply the same styling code as is used on my web page to a CGI-based hit-counter, where the script is a pre-made one supplied by the ISP? The webpage in question is: http://www.zen62775.zen.co.uk The code used to siaplay the hit-counter is: <img src="http://homepages.zen.co.uk/cgi-bin/counter/USERNAME/counter.num">
7
3494
by: sasquatch | last post by:
Hi, I've a a site with nested master pages and content pages. I tried using a theme with a stylesheet in the app_themes directory referencing it in the web.config file from a pages tag theme attribute. This works for the content pages, but it doesn't seem able to apply the styles to the top master page even though I did set the master head tag to runat server. Is this by design? If so, what is the best way to apply styles to the top...
1
4345
by: Eric Lindsay | last post by:
I am trying to understand the differences between and uses of persistent, default and alternate styles. I have read http://www.w3.org/TR/REC-html40/present/styles.html section 14.3.2 on specifying external style sheets in link using combinations of rel and using or not using the title attribute. I think I sort of understand rel="alternate stylesheet". It seems to be able to act something like the media="print" or media="handheld" or...
4
1614
by: leegold | last post by:
I use "core" styles from w3. But at the time of this email time W3 is down ie. i cannot connect via browser to w3.org and any web page the uses the core styles will freeze/hang. Is there a way when w3 is site's slow or down to stop trying to connect and just show the page? Or use an alternate css? This has never happened before but when it did as now it freezes everything. <link rel="stylesheet"...
4
1729
by: Philipp Reiss | last post by:
Hello group, I'm new in this topic and I run into problems where google can't help me. I have a XML-file, wich is bound to a XSLT-file, and this works fine in a browser. How do I show the same XML-file with an other XSLT-file? Thanks for your help! Philipp
2
1648
by: viveklinux | last post by:
Hi, 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. Thanks in advance ..
5
1875
by: Dinsdale | last post by:
Without using CSS styles or linked stylesheets, I need to apply formatting to text links that use rollover effects. I can NOT get the underline to show using this technique: <A onmouseover="this.style.color='#000000'" style="FONT-SIZE: 12pt; COLOR: #000000; FONT-FAMILY: Arial, Helvetica; TEXT-DECORATION: underline;" onmouseout="this.style.color='#000000' TEXT-DECORATION: none;" href="#">Search</A>
3
2227
by: Jukka K. Korpela | last post by:
Some time ago in this group, someone suggested that we should develop a "different" user style sheet to demonstrate what a user style sheet or a browser style sheet _could_ do. I guess the idea was that the style would be rather different from common browser defaults, yet sensible and potentially useful. Partly for that reason, partly to demonstrate the idea that web page rendering _could_ be different from what people are used to, I...
9
4463
by: Guillaume Dargaud | last post by:
Hello all, I have a strange problem with a new install of Gallery2: Firefox does not display the style of the pages while IE does (but nobody I know uses IE). I'm not familiar with the way Gallery2 generates its pages but my config uses Apache (on Windows), php5, MySQL, etc... There are several themes available in Gallery2 but none display in FF. It's like the CSS is ignored. The pages I get in the browser contain the following CSS...
0
8357
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8277
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8465
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8581
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7298
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6158
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5612
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4285
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1588
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.