PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Q1: The first one (span.wrong) works, but the second one (p.warning) doesn't work. I don't get any error messages, and it gives the built-in margin for the p tag,but the text color doesn't turn red. Why? Is this fixable?
Q2: I wanted to divide the php section into two by using echo '<div id="sbox">'; which did not work. Is there any way that I can use div in php for the styling purpose?
Last edited by mondsteigen on Wed Feb 08, 2012 6:07 pm, edited 1 time in total.
mondsteigen wrote:The first one (span.wrong) works, but the second one (p.warning) doesn't work. I don't get any error messages, and it gives the built-in margin for the p tag,but the text color doesn't turn red. Why? Is this fixable?
Probably inheriting it's color attribute from somewhere else in the style sheet; are those two declarations the only values in your stylesheet?
mondsteigen wrote:Q2: I wanted to divide the php section into two by using echo '<div id="sbox">'; which did not work. Is there any way that I can use div in php for the styling purpose?
What results did you get when trying? I don't understand the second part of the question; styling is done by css only. You can add the div using php (echo '<div>') but you would still have to style it in a css file
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
mondsteigen wrote:The first one (span.wrong) works, but the second one (p.warning) doesn't work. I don't get any error messages, and it gives the built-in margin for the p tag,but the text color doesn't turn red. Why? Is this fixable?
Probably inheriting it's color attribute from somewhere else in the style sheet
Indeed. Use something like Firebug to check which rules are being applied. There's probably something in there with higher specificity.
social_experiment wrote:What results did you get when trying? I don't understand the second part of the question; styling is done by css only. You can add the div using php (echo '<div>') but you would still have to style it in a css file
Sorry for not explaining clearly. In my .css I have
I don't know why, but everything is working now. I didn't touch either .php or .css, but just ran the page again. Honestly, it wasn't working yesterday.
Celauran wrote:Could be that your browser had an older version of the style sheet cached. So long as it's working now.
That's a scary thought. I messed up my machine recently. I don't know the exact damage. So far, it's running without any major problem. Anyway, I want to resurrect the problem from a week or so ago and want to ask you a question.