Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Page 1 of 2 12 LastLast
Results 1 to 10 of 20
  1. #1
    Join Date
    Dec 2006
    Location
    Doncaster, UK
    Posts
    1,251
    Tokens
    5,249

    Latest Awards:

    Default Different word, different colour {CSS}

    Is there any way to have a different word become a different colour (of my choosing) using CSS?

    Like this: different colours see?

    I'm making a Tumblr theme and I want 5 different colours for the "tags" so each one follows a certain colour. Colour 1 = tag 1 etc.

    Cheers and +rep to helpers!

  2. #2
    Join Date
    Jan 2008
    Location
    Wales
    Posts
    3,594
    Tokens
    1,387
    Habbo
    Skizzling

    Latest Awards:

    Default

    Code:
    Hey, we'll add <span style="color: #ffffff">white</span>, and then a bit of <span style="color: #b73c11;">red</span>. Oh and, my favourite colour is <span style="color: #1bb0d5;">blue</span> or if you don't like HEX then <span style="color: blue;">this</span>
    Code:
    <span style="color: green;">green</span>, <span style="color: red;">red</span>, <span style="color: purple;">purple</span>
    Last edited by Calvin; 10-07-2011 at 05:40 PM.

  3. #3
    Join Date
    Dec 2006
    Location
    Doncaster, UK
    Posts
    1,251
    Tokens
    5,249

    Latest Awards:

    Default

    Needs to be dynamic, I'm not that stupid haha

    There's no words to wrap styles around, it's dynamic as no two posts have the same tags... if you catch my drift.

  4. #4
    Join Date
    Jan 2008
    Location
    Wales
    Posts
    3,594
    Tokens
    1,387
    Habbo
    Skizzling

    Latest Awards:

    Default

    Ah my bad. I'm not much good with Tumblr, sorry!

    Have you taken a look at the code in any current themes?

  5. #5
    Join Date
    Dec 2006
    Location
    Doncaster, UK
    Posts
    1,251
    Tokens
    5,249

    Latest Awards:

    Default

    I've had a look around but I can't find a similar thing I want.

  6. #6
    Join Date
    Jan 2006
    Location
    Kent
    Posts
    987
    Tokens
    0

    Default

    You could try using the pseudo selector, nth-child. Only problem is, it isn't supported in IE.

    Completed untested:
    Code:
    ul.tag-list > li:nth-child(1) {color: #7b7b7b;}
    ul.tag-list > li:nth-child(2) {color: #333333;}
    ul.tag-list > li:nth-child(3) {color: #CCCCCC;}
    and so on, I think that's how it works, might be worth double checking though
    This is our situation and we're happy to be here,
    I wouldn't change this place for anything.


  7. #7
    Join Date
    Mar 2009
    Location
    Western Australia
    Posts
    386
    Tokens
    0

    Default

    Dunno if it would work but can't you do this in CSS3?

    HTML Code:
    <span id='tags_area'><!--Tags Here --> </span>
    CSS:
    HTML Code:
    #tags_area(even) {color: /* color */}
    #tags_area(odd)  {color: /* color */}

  8. #8
    Join Date
    Dec 2006
    Location
    Doncaster, UK
    Posts
    1,251
    Tokens
    5,249

    Latest Awards:

    Default

    Quote Originally Posted by Shibby-Shabs View Post
    Dunno if it would work but can't you do this in CSS3?

    HTML Code:
    <span id='tags_area'><!--Tags Here --> </span>
    CSS:
    HTML Code:
    #tags_area(even) {color: /* color */}
    #tags_area(odd)  {color: /* color */}
    If this works, would be possibly to do more than 2 not using odd and even more 1,2,3,4?

  9. #9
    Join Date
    Dec 2007
    Location
    Manchester
    Posts
    2,236
    Tokens
    118
    Habbo
    hamheyelliot

    Latest Awards:

    Default

    Joe's suggestion is perfect for this, using the example above:

    <span class="tags"> </span>

    .tags:nth-child(1) {color: #7b7b7b;}
    .tags:nth-child(2) {color: #333333;}

    and you could go on indefinitely.

    You can also use basic algebra such as :nth-child(2n+1) etc. to do repetitions.

    It only works in more modern browsers though, so IE8 for example will not follow nth-child rules.

  10. #10
    Join Date
    Dec 2006
    Location
    Doncaster, UK
    Posts
    1,251
    Tokens
    5,249

    Latest Awards:

    Default

    Trying this out, I've probably gone wrong:

    www.adamwingie.com

    The tags are on the first post.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •