Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

CSS

Options
  • 10-05-2001 1:35pm
    #1
    Registered Users Posts: 4,676 ✭✭✭


    Howdy,
    small question that I was wondering if yee could help me with. I have a list of names and I want to create a CSS such that whenever there is an occurence of one of these names in the webpage, the font changes, or color or whatever.

    Any ideas ? If this works.. it will save me time playing with perl.

    Cheers,
    Gav


Comments

  • Registered Users Posts: 7,626 ✭✭✭smoke.me.a.kipper


    i'd be interested in this if a certain word say 'boards' was automatically made into a link to boards.ie or something like that.

    "It is hard enough to remember my opinions, without also remembering my reasons for them!"
    -Nietzsche


  • Banned (with Prison Access) Posts: 16,659 ✭✭✭✭dahamsta


    To get CSS to work, you have to assign elements a classname or id. Or a HTML tag obviously. I guess it might be possible to do what you suggest with the newer versions of JavaScript that support regular expressions, but I think the script would be fairly complex, as you would need to loop through all the elements on the page. I think a simpler approach would be to do it on the server side, using a regex to scan for the keyword and wrap it in a class. Sorry, best I can do off the top of my head.


  • Registered Users Posts: 12,309 ✭✭✭✭Bard


    As far as I'm aware, the short and simple answer is ... No, you cannot change the appearance of every instance of a word with CSS... at least not without explicitly assigning a 'class' to each instance.



    Bard
    "We do know it was we who scorched the sky..."


  • Registered Users Posts: 1,825 ✭✭✭Gambler


    <font face="Verdana, Arial" size="2">Originally posted by Bard:
    As far as I'm aware, the short and simple answer is ... No, you cannot change the appearance of every instance of a word with CSS... at least not without explicitly assigning a 'class' to each instance.

    </font>

    What He Said smile.gif

    You could get a script (ASP\PHP\CGI) to replace a word in a html page with a CSS Class code if you wanted and use the script as a kinda wrapper. (People would browse http://www.mysexydomain.com/recode.asp?page=page2convert.html

    Basically it would be easier to write the whole site in a script and put a server side include with the Script to find the words and replace them with the code you want...

    Does any-one follow me, because I don't think I do...



  • Registered Users Posts: 1,023 ✭✭✭[CrimsonGhost]


    Like people said it isn't really possible unless you wrap each word you want styly changed for in its own tags assuming you do that then the following would work

    replace all 'myspecialword' with
    <MYSPECIALWORD>myspecialword</MYSPECIALWORD>
    in your html

    and then with your css file something like

    <style type="text/css">
    <!--
    MYSPECIALWORD{ font-size: 12pt; font-family: "Helvetice"; color: 00ff00; }
    MYOTHERWORD { font-family: arial, helvetica, sans-serif; font-size: 10pt; color: 0000ff }
    ANOTHERWORD { font-size: 18pt; font-family: wingdings; color: ff0000; }
    -->
    </style>

    Just in a plain text file and link it into your html by putting something like the following inside your <HEAD> tags.
    <LINK REL=STYLESHEET TYPE=text/css HREF="mySpecialStyles.css">

    Hope that helps.


  • Advertisement
  • Closed Accounts Posts: 33 Robbie Burke


    If you give me the address of your site, and what words etc etc you need changing and what style you want them changed to I could probably whiop up a CGI script complete with admin center, no exact time limit but ~1 week, if that sounds good email me..

    syinide@iol.ie

    [This message has been edited by Robbie Burke (edited 11-05-2001).]


  • Closed Accounts Posts: 39 Bludgeon


    i have a load of css code if u want it dood ... ill send it 3 ya or sumfin .. icq / e-mail me if u wan it


  • Registered Users Posts: 7,739 ✭✭✭mneylon


    You might be able to manage it using XML, but it sounds like a lot of hardwork....
    Suppose it depends on how many instances of the word there are.

    IrishSearch.net


Advertisement