Customizing a text field across a set of html files
Question
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)?
Solution
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