2

I am building a .chm file using a set of HTML files. Each html has a company name in its text. My problem is this company name needs to be changed for each of our clients. Rather than changing all of the HTML files, is there a way to keep it as a shared variable (Maybe in a .css file)?

j08691
  • 204,283
  • 31
  • 260
  • 272
Lasith Jayaratna
  • 107
  • 1
  • 10

1 Answers1

1

You can replace content inside an html element say <span> using content property of css.

html

<span class="company-name">
   YourCompanyName
</span>

css

.company-name{font-size: 0}

.company-name:after{
      content: "New Company Name";
      font-size: 14px;
 }​

jsFiddle: http://jsfiddle.net/FwKW7/

There are some quirks in it. IE <=8 have limited support for this property and you check out more about it after checking this post on stack overflow.

Alternatively, you can also check-out this answer for replacing text using css link. But it requires an extra div, which is un-necessary.

*Edits
* updated css

Community
  • 1
  • 1
Saurabh Kumar
  • 5,576
  • 4
  • 21
  • 30
  • I tried this but did not work for me. (I think the dash within "company-name" should be removed). When I try this I got "YourCompanyName" as the output. (i HAVE ie9 installed) – Lasith Jayaratna Aug 01 '12 at 02:55
  • ya.. i'll update my answer. there will a dash. Yes!! sorry about that. – Saurabh Kumar Aug 01 '12 at 06:16
  • just check it again.. with my new answer and can u let me know if it works. – Saurabh Kumar Aug 01 '12 at 06:37
  • great... now if you mark this answer as correct it will be helpful for other too... :) and will save some of their time. regards – Saurabh Kumar Aug 02 '12 at 10:47
  • Yes I would like to do that. But could not find a place to do so. The left hand side up/down arrows to say "This answer is useful" is not allowed for me because I do not have enough reputations. Is there any other way to do it ? – Lasith Jayaratna Aug 03 '12 at 11:10