• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

css with html and .php


#1
hi.

i have a question that i hope someone can answer for me about CSS if there is any reason that it is styling a page differently for me.

I have a HTML site of which one of the pages i wanted to insert a script. So i changed the perticular page to php, inserted my script and it worked all fine.

The issue i have is that the .php page styles differently than the rest of the HTML pages. Does this happen in general for html and php with css and if so is there any way other than creating a whole new style sheet that i can get this php page to fall inline with the others?

many thanks in advance.

dave
 

br3n

Senior Member
#3
Im no guru by any means but surely anything generated my php (in visual terms) will be html and therefor accessible/styled in the same way by css?
 
#4
The styling should be the same between HTML and PHP, there's not reason for it not to be. Is the outputted source code on both pages exactly the same? I'm thinking you might not have wrapped whatever your echoing in PHP with HTML so the elements won't be styled at all. Examples:

Static HTML file:
HTML:
<html>
<head>
</head>
<body>
<h1>This is my page's main title</h1>
</body>
</html>
PHP file:
HTML:
<html>
<head>
</head>
<body>
<?php echo "This is my page's main title"; ?>
</body>
</html>
Notice in the second block of code there are not header tags.

Post up your code and we'll have a look.