Click to See Complete Forum and Search --> : [RESOLVED] colors


io1313
05-24-2009, 04:07 PM
I have been trying to put a bgcolor in table cells and hex codes don't seem to work. They return a color, just not even close to the one I was expecting. I have tried adding in html code, using # and not. I tried looking up colors for php specifically thing there might be a variation, but couldn't find anything. The only thing it seems to recognize is black 000000. Can anyone point me in the correct direction.

Thanks...

bradgrafelman
05-24-2009, 04:17 PM
Thread moved to Clientside Technologies; outputting hex codes for colors has nothing to do with PHP. PHP is simply outputting text that's interpreted by your browser.

So, how are you determining which hex code goes with the color you want?

NogDog
05-24-2009, 04:17 PM
PHP does not directly have any effect on colors in your browser. It is the HTML that is output by your script that will affect it. Therefore there is nothing special or unique with regard to PHP that you need to know about color codes.

In any case, you should be using CSS to control the display of your pages, rather than deprecated HTML attributes such as "bgcolor". At the most basic, you can use the "style" attribute in your HTML tags:

echo "<td style=background-color:#FF0099'>some text</td>";

Better would be to use as CSS stylesheet, and define a class within it that you can then apply to your HTML elements.

echo "<td class='some_class_name'>some text</td>";

Stylesheet:

.some_class_name {
background-color: #FF3399;
}

io1313
05-24-2009, 06:22 PM
The hex codes come from memorizing them, and photoshop. I'll look into doing it w/ css. Sorry to post on the wrong forum.

bradgrafelman
05-24-2009, 09:46 PM
I've noticed you marked the thread resolved, but feel free to post an example of how using PHP didn't output what you had expected.

io1313
05-25-2009, 12:45 AM
I never could get it to work the way I was trying. I'm sure I had something in the php wrong. CSS solved it though. Thanks for the reply.