There are three ways to create CSS. Let's take a simple example of having the font color blue.
INTERNAL WITHIN THE HTML FILE
<head>
<style type="text/css">
color: blue;
</style>
</head>
EXTERNAL OUTSIDE THE HTML FILE
<link rel="stylesheet" type="text/css" href="myCssFile.css">
myCssFile.css (external file)
body { color: blue; }
INLINE WITHIN THE HTML FILE USING STYLE TAG ATTRIBUTE
<DIV style="color:blue">This should be blue</DIV>
Note: This is a property/attribute pair and not a class or selector
So if I am reading your question right, you are concerned with this latter approach (Style tag attribute).
Or maybe you are new to CSS too?
I am not sure that the other two responses are correct if your desire is to use the inline style tag attribute (which is what your PHP code shows). I believe those two approaches will force you to resort to using the internal or external approach.
But I would not recommend using inline styling for several reasons. Inline styling forces you to decentralize all the styling information making it very difficult to manage. Imagine having thousands of HTML files with style information in it. What if you wanted to change the font color to orange? You'd have to go through every page and make the inline change.
Another problem with the inline approach is that you also tightly bind the presentation and business logic into the file. Ideally you want to separate the two.
If you want to use inline styling, the problem I believe in your code is that you are using a class selector when a property:value should be used.
It's your call on how you want to do this but I'd recommend changing the approach.
Hope this helps.