Click here to Skip to main content
15,911,035 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I wish to learn about implementing one CSS code through which I can make changes to all pages (let's say 250 HTML pages).

I have one line of text which I want to display (and changes every week) to all 250 HTML pages. So instead of opening all 250 HTML pages every week, I want a simple CSS code that is implemented just once in all 250 pages and operated from MAIN CSS file.

Or let's say (another example) I have a javascript that I want to change every month in 250 HTML pages. So rather than opening all pages each month... just one code javascript implementation from CSS MAIN file.

I hope, I made myself clear, thanks

What I have tried:

Researched online for better understanding but not so helpful
Posted
Updated 5-May-20 3:35am

There are 3 elements to a web page:
1. HTML is the actual content of the page
2. Javascript is a scripting language that can interact and alter content within a page,
3. CSS is used to alter the appearance of a page.

So... the reason you can't find CSS to do what you are looking for is because that is not what CSS does.

If you are using a dynamic web application for generating your pages (eg PHP, ASP.NET) they generally have a way for using templates for the main layout. That template could be changed as needed to do what you are looking for.
However, if you don't have this (aka static pages) then this would not be an option.

The last choice is Javascript. This does have the ability to change the HTML, and you would only need to the one line of code to all the pages just one time, and change the javascript as needed to alter what it is changing
 
Share this answer
 
Have a wrapper for your intended message;

HTML
<div id="message"></div>


And use the "content" attribute of "before" in your css

CSS
#message:before {
    content: "Hello world"
}


You can now update the css and the html will update accordingly.

CSS Content | CSS-Tricks[^]
 
Share this answer
 
Comments
Vines O 6-May-20 9:07am    
And what about the javascript???
F-ES Sitecore 6-May-20 9:44am    
if using jquery

$("#message").html("message here");

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900