473,748 Members | 10,737 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
2 1658
vi********@gmai l.com said the following on 7/15/2006 10:15 AM:
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.
You could do it with Javascript, but it could get messy, depending on
how your page is laid out. If you are going to try to create some script
to do it, it is simpler to do it manually, wrap each question/answer in
a container and use CSS to change the color.

It would be a simple matter of copy/paste two sets of tags through the
page and you would be finished.

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Temporarily at: http://members.aol.com/_ht_a/hikksnotathome/cljfaq/
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jul 15 '06 #2
JRS: In article <11************ *********@b28g2 000cwb.googlegr oups.com>,
dated Sat, 15 Jul 2006 07:15:02 remote, seen in
news:comp.lang. javascript, vi********@gmai l.com posted :
>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 a Definition List, and have in the Head something like :

<style type="text/css"><!--
dl { background:lime ; padding:0.7ex; margin:0.5ex;}
dt { background:#FFe 4FF; padding:0.7ex; margin:0.5ex;}
dd { background:#CCF FFF; padding:0.5ex;}
--></style>

You'll be enclosing the questions and answers somehow anyway, so that
they are separated : you can apply styles to whatever you use. You
could logically make the questions Headings, and colour those thus.

See <URL:http://www.merlyn.demo n.co.uk/datecalc.htmof today or later.

You can use an external CSS file.

AIUI you could also get javascript, in an external file, to scan each
page onload and set styles where needed; but that seems unnecessary.

*** DO NOT MULTI-POST ***

--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.c om/faq/>? JL/RC: FAQ of news:comp.lang. javascript
<URL:http://www.merlyn.demo n.co.uk/js-index.htmjscr maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 16 '06 #3

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

Similar topics

16
4210
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
3368
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
3509
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
4349
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
1745
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
13
1503
by: vivekian | 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
1882
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
2232
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
4469
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
8991
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
8830
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,...
0
9541
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9321
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,...
1
6796
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
6074
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
4602
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3312
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2215
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.