![]() |
#1 |
Very Slow Learner
![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 51
Karma: 788
Join Date: Jul 2012
Location: UK
Device: none
|
Single words in different colours
Please can anyone give me some simple HTML code to put individual words in the same paragreaph in different colours? e.g. If I wanted to write 'Richard Of York Gave Battle In Vain' in red, orange, yellow, green, blue, violet, indigo respectively, how would I go about it?
Many thanks (again!) for your advice. |
![]() |
![]() |
![]() |
#2 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,680
Karma: 23983815
Join Date: Dec 2010
Device: Kindle PW2
|
IMHO, the easiest way to achieve this is to define span styles for each color and assign them to each word.
For example, add the following styles to the style section of the .html file or the stylesheet: Code:
<style type="text/css"> span.red { color: red; } span.blue { color: blue; } </style> Code:
<p>This is a <span class="red">red word</span> and this a <span class="blue">blue one</span>.</p> |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,889
Karma: 59840450
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Code:
<p><span style="color: red;">Red</span><span style="color: green;">Green</span><span style="color: blue;">Blue</span><span style="color: yellow;">Yellow</span></p> black silver gray white maroon red purple fuchsia #FF00FF green lime olive yellow navy blue teal aqua for any other shade, you will need to code the RGB values |
![]() |
![]() |
![]() |
#4 |
Very Slow Learner
![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 51
Karma: 788
Join Date: Jul 2012
Location: UK
Device: none
|
Thank you both for your suggestions.
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Background and Font Colours | Brianrh | General Discussions | 1 | 10-23-2012 10:02 AM |
PDF invert colours. | Nexutix | 5 | 06-22-2011 06:51 PM | |
icon colours | Brandobras | Calibre | 2 | 07-22-2010 03:58 AM |
Colours? | griffonwing | Astak EZReader | 29 | 09-13-2009 08:22 PM |
Background 'colours' | AlexBell | Calibre | 3 | 07-15-2009 06:42 PM |