Thread: Background-color problem
Results 1 to 2 of 2
Related
-
Cell background color Forum: CSS Forum
Replies: 5 -
input boxes background color problem Forum: CSS Forum
Replies: 23 -
background color in classes not appearing Forum: CSS Forum
Replies: 3 -
background-color and NetScape 7 problem Forum: CSS Forum
Replies: 1 -
Problem with Background-color CSS and Netscape -- simplified Forum: CSS Forum
Replies: 2
-
02-05-2005, 09:31 PM #1
Background-color problem
Hi all. I am new to CSS and php and am trying to display a <p> tag with a particular rgb value that I have stored in three variables. However, the background color doesn't change. When I look at the generated HTML it shows that the background-color is actually #26213d52587f even though it was supposed to only use two digits from each value according to my printf... Does anyone know why?
Here's the code:
// these values are actually calculated previously by the code
// but here are their values when it gets to this point.
$secondary_r = 2621;
$secondary_g = 3d52;
$secondary_b = 587f;
// I think this is my problem... am I printing it correctly?
printf( '<STYLE TYPE=\"text/css\"> p {background-color : #%02x%02x%02x;} </STYLE>', $secondary_r, $secondary_g, $secondary_b );
-
02-05-2005, 10:19 PM #2
Hi, welcome to the forums.
forgive my ignorance, whilst I code php for a living yet I have never used printf
Checking the php.net manual page, I see an example of limitng characters:
Code:printf("[%10.10s]\n", $t); // left-justification but with a cutoff of 10 characters
If one of our members helps you, please click theicon to add to their reputation!
No support via email or private message - use the forums!
Before you ask, have you Searched?
Cloudjiffy- PaaS for Developers
10-05-2020, 12:30 AM in Web Hosting Forum