Jump to content

Using CSS to stylize a PHP page


huntrguy102

Recommended Posts

CSS doesn't interact with PHP at all. PHP is logic, it isn't actually anything that can be acted on. However, PHP outputs HTML (or rather can output HTML if that's what you tell it to do), and CSS acts on the HTML. Kind of like this:

 

PHP -> HTML <- CSS

 

So you want to write a PHP script that outputs the HTML that you want. Then you set up your CSS the same way you would for an HTML document that is not generated by PHP. CSS doesn't care how the HTML was generated, it just needs that HTML.

 

So run your PHP script, and look at the output. If it's not HTML, you can't use CSS. If it is HTML, then make your PHP script output the HTML the way you want with ID and CLASS attributes, and use your CSS as always.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.