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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.