I have a number of data points that I want to display on a web page. At the moment I use Imagemagick and place the data items on a base
image and just display the image. the data gets updated every 5 minutes. Data is for instance temperatures and pressures.
I was thinking if I could just write the data values into a very simple CSS sheet and get a form control (text box) on my web page, to
show the value from the CSS. I ahve about 20 floating point numbers to show.
As I am new to CSS and forms, I was hoping someone could just show me how I declare a variable in the CSS and then show this variable
in my web page text box.
thanks
CSS is not for variables, CSS is to tell the browser how to display the HTML of the site.
If you want a green background on your page, the CSS would be
body
{
background-color: #00FF00;
}
No such thing as variables in CSS, sorry.
If you want a textbox to show a value, maybe this is what you’re looking for?
<input type="text" name="firstname" value"Pete" />
CSS is used by a HTML page (web page ) . You can create the graph in MSWORD and save as a HTML page . I hope that will solve your problem !
The only way I could think of to do it is if you are trying to create a bar graph for instance, and you create a div with a background color of perhaps red, a width of say, 50px, and then a height of 1 px. Then, you could use php to obtain the value from your data source, and stick that value into a javascript function that dynamically adjusts the height of the div, which would create the proper value for the height.
Well there’s nothing that stops him from using php variables to structure the css …
Yes, instead of using styles.css as the filename, you can just use styles.php and then, at the top of the page, before anything is output to the browser, you can put a header like so:
header ("Content-type: text/css");
Then, you can use php to output your css code in a similar manner to how you would use it to generate html. The only problem I see to this approach is that if the content changes, you would have to reload the entire page in order to see the changes. Better to pass php values to javascript functions to make the changes happen sans reload.