|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
How do you talk to a CSS file?
I have completed a site that is able to change its own template, color schemes and so forth. What I did was, when user change the settings, different style sheet is called.
And each one of these stylesheet will have pre-defined settings that says, ok, this text is red and that table's border is green with this and that size ....balablaalla..... However, would it be possible to use only just 'ONE' CSS file, and directly change each and every one of its CSS properties like font-style: <?=$font_style?> ???????????? I thought i have seen it being done before.bold
__________________
Beginner |
|
#2
|
|||
|
|||
|
you could call the settings from a database and, echo it out into the format of a style sheet, but you would have to use the .php extension.
|
|
#3
|
|||
|
|||
|
That would be possible if I embed directly my CSS properties at the top of the file.
But how do I do that if I am linking a CSS file in? Can I pass in values to css files? ...like style.css?value1=value2&........... |
|
#4
|
|||
|
|||
|
you could have a linked style sheet something like this
style.php?value1=value2&........... and call that, or you chould call the style.php file and that calls the values from a database |
|
#5
|
|||
|
|||
|
Tim,
Hi! Are you trying to dynamically change style attributes? If so, you can do this using JavaScript and DOM (Document Object Model). If I had a section of font like this: <div id="sample">This is some text.</div> I can change the color of that text to blue with this JavaScript line: document.getElementById("sample").style.color="blue" All of the style attributes can be changed in this manner. Is this what you are looking for? |
|
#6
|
|||
|
|||
|
yeah something like that. thanks. i wiil try both.
|
|
#7
|
|||
|
|||
|
When the user logs in you could save there setting with there username and password in the database.
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > Programming Tools > How do you talk to a CSS file? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|