Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-26-2012, 06:45 PM   PM User | #1
benhelmian
New to the CF scene

 
Join Date: Feb 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
benhelmian is an unknown quantity at this point
Question Using CSS how can i set different colours for one piece of text?

The title of my website is 2 words. I want the first word to be a different color to the second.

The editor I am using will not let me do this directly, nor will it let me input HTML into the title (although I can input it in other places on each page).

So I was wondering how I would go about accomplishing this with CSS?
benhelmian is offline   Reply With Quote
Old 02-26-2012, 07:23 PM   PM User | #2
trav5567
New Coder

 
Join Date: Feb 2012
Posts: 23
Thanks: 0
Thanked 1 Time in 1 Post
trav5567 has a little shameless behaviour in the past
Hope this helps. Not quite sure what you wanted or what your able to do with your program.

Code:
div h1:first-child:first-letter { color:#red; }
trav5567 is offline   Reply With Quote
Old 02-26-2012, 07:29 PM   PM User | #3
Riku
New Coder

 
Join Date: Feb 2012
Location: Finland
Posts: 57
Thanks: 3
Thanked 9 Times in 9 Posts
Riku is an unknown quantity at this point
I would do it like this;

Lets pretend for a second your title is Hello World and you want Hello to be red and World to be blue.

I would first write the HTML code something like this;

<p><span class="redtext">Hello</span> <span class="bluetext">World</span></p>


and into css;

.redtext {
color: red;
}

.bluetext {
color: blue;
}


I would also change the font size and so on of course, but this way I would do the color swapping, with span tags.

Hope this helps.

-Riku
Riku is offline   Reply With Quote
Old 02-26-2012, 07:49 PM   PM User | #4
benhelmian
New to the CF scene

 
Join Date: Feb 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
benhelmian is an unknown quantity at this point
Thanks for the fast response.

The problem is, the editor I'm using won't let me put HTML into the title.
benhelmian is offline   Reply With Quote
Old 02-26-2012, 07:56 PM   PM User | #5
tracknut
Regular Coder

 
Join Date: Aug 2006
Posts: 892
Thanks: 4
Thanked 206 Times in 205 Posts
tracknut is an unknown quantity at this point
Are you actually talking about the <title> tag? The content of that is not html, it is text. But if you're talking about an <h1> or other tag the would allow <span> or other tags, then you just need a better editor...

Dave
tracknut is offline   Reply With Quote
Old 02-27-2012, 07:50 AM   PM User | #6
Major Payne
Regular Coder

 
Join Date: Aug 2005
Location: MS
Posts: 745
Thanks: 7
Thanked 65 Times in 63 Posts
Major Payne is an unknown quantity at this point
You are talking about the title tags between the head tags. Can not set CSS rules or change anything as it is text only between the opening/closing tags.
__________________
☠ ☠RON☠ ☠
Major Payne is offline   Reply With Quote
Reply

Bookmarks

Tags
color, colour, css, text, title

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:19 AM.


Advertisement
Log in to turn off these ads.