|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Dynamic CSS Problems
Despite looking through the forum, having problems with dynamically creating an external CSS file. Can any one explain?
Basically I currently have a CSS file: Code:
.normal
{
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
}
.userdef
{
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
color: #FF0000;
font-weight: 800;
}
.big
{
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
}
I have set the site up so that the user can define there own colour of text for the userdef style, but im unsure how I can put this colour variable into the CSS file. I'm guessing I have to rename it into a .php file... but how will the browser still know its a CSS file?? Thanks very much for your help |
|
#2
|
||||
|
||||
|
If it is only ONE element, then it would not be wise to read/write to external files.
- Create your normal CSS, then way you like. - In the disaply page, import it ie. <link rel="stylesheet" href="yourcss.css" type="text/css"> - After above entry add a style tag PHP Code:
- The above declaration would override the entry in yourcss.css - Now all you have to do is to feed $user_color ie $user_color = 'FF0000'; or get it from $_POST. This is a quick guide. You have to work on it. Make sure you have a default value and do not pass blank to $user_color Good luck ![]() ps. Better still: PHP Code:
All you have to do is to get $color
__________________
© AZ AZbb :: AZ Bulletin Board - Secure BBS script, Front page CMS, Chat, No database Simple Guide to Apache and PHP installation on Windows Last edited by Clan admin : April 8th, 2004 at 06:32 PM. Reason: Added code |
![]() |
| Viewing: Dev Shed Forums > Web Design > CSS Help > Dynamic CSS Problems |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|