View Full Version : How do I assign different colors to different sections of text?


krausj
06-12-2013, 11:20 AM
Let's say I have two classes of text on one page. How do I make each a different color. Here is what my xhtml and it's corresponding css file look like for reference.

[overlarge image put in spoiler tags - moderator]
http://i.imgur.com/jS57D6j.png

Toxaris
06-12-2013, 12:18 PM
Color in bookview can be done via CSS. Change of color in codeview is not possible.

mrmikel
06-12-2013, 12:57 PM
If it is important to you, you can right click to open your text in an external editor which does have this capability.

krausj
06-13-2013, 09:56 AM
I'm actually doing all of this by hand, not using Sigil or anything. Do you know how to make this happen in an editor?

mrmikel
06-13-2013, 10:32 AM
In notepad++, you can get a similar effect by choosing Language, flash actionscript.

Jellby
06-13-2013, 10:45 AM
What do you exactly want to colour?

The source code? You need some editor with syntax (or ad-hoc) highlight/colouring.

The rendered text? Just add "color: #AA0000;" or whatever to the the CSS class.

mrmikel
06-13-2013, 11:42 AM
Nothing stopping you from creating .green, .yellow classes in the stylesheet, if you want to color the text displayed in the final document. See
http://www.w3schools.com/CSSref/pr_text_color.asp
for details. Click the try it yourself button to see how changes will look prior to committing it to your document, if you are uncertain.

BUT for those of us with e-ink readers, please preview in one. Some orange will just disappear completely against grey, etc.

If you just want to color your code for easier readability see my previous text.