SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Wizard jag5311's Avatar
    Join Date
    Jan 2003
    Location
    Somewhere in Indiana
    Posts
    3,082
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Making a particular word in a sentance a different color

    Lets take this as an example

    <cfoutput>
    <h2>Item #FORM.itemname# #action#!</cfoutput></h2>

    I want to make the #FORM.itemname# a different color then Item and #action#.

    Is this possible with css?

    Thanks
    Bryan

  2. #2
    011521 dbalsdon's Avatar
    Join Date
    Feb 2003
    Location
    North Of Scotland
    Posts
    444
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you would need to surround #FORM.itemname# with <span> tags...

    btw. the nesting of your tags is wrong... it should be

    Code:
    <cfoutput>
    <h2>Item #FORM.itemname# #action#!</h2>
    </cfoutput>
    Edit:


    well.. it aint exactly wrong but you would need to do it that way if you were trying to make your code compliant
    Last edited by dbalsdon; Sep 26, 2003 at 18:01.
    Daniel Balsdon
    My Site

  3. #3
    SitePoint Evangelist ucahg's Avatar
    Join Date
    Apr 2001
    Location
    Sarnia, Ontario, Canada
    Posts
    434
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Actually would that nesting matter? Because cfoutput is parsed before the validator runs.

    But either way it would be better practice and easier to read if you nest the tags properly.
    Love it? Hate it? Helpful? Useless?
    Use the rate button to let me know what you think of my post!

  4. #4
    SitePoint Wizard jag5311's Avatar
    Join Date
    Jan 2003
    Location
    Somewhere in Indiana
    Posts
    3,082
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks. And the span won't effect where the words are positioned, huh? Probably not. So just do a <span class="blah">#FORM.itemname#</span>

    Thanks
    Bryan

  5. #5
    011521 dbalsdon's Avatar
    Join Date
    Feb 2003
    Location
    North Of Scotland
    Posts
    444
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <span> wont affect the positioning...
    Daniel Balsdon
    My Site

  6. #6
    SitePoint Zealot HardinComp's Avatar
    Join Date
    May 2003
    Location
    Boston, MA
    Posts
    171
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, but <span class="foo"> will allow you to change the appearance of one word. The css will include something like this:
    Code:
    .SpotColor {
         color=#000099;
    }
    with the color set to whatever you want. Then make your code:

    Code:
    <h2>Item <span class="SpotColor>#FORM.itemname#</span> #action#!</h2>
    That should do the trick, plus if you have it in an external style sheet you'll be able to apply the SpotColor to anything on your site that uses the style on any element of a page that uses that style sheet.
    J.M. Hardin
    My blog
    Registered Ubuntu User #10980


Bookmarks

Posting Permissions

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