Forum Moderators: coopster

Message Too Old, No Replies

.php pages displayed differently than .htm

CSS and .php pages

         

TomJones

2:50 pm on Sep 5, 2003 (gmt 0)

10+ Year Member



Hi, Everybody!

I'm experiencing some funny things on my site when my .php pages are displayed. I am using the same CSS style sheets as the .htm pages but, on all of .php pages the font is larger and the main content div is a few pixels lower than my .htms in IE6.

I open the same pages in Mozilla and, no problem. The fonts stay the same and, the div stays similiarly placed as my htm pages.

Has anyone ever encountered something like this when using CSS? I guess I could create a seperate CSS sheet for my php pages. I'm just pretty clueless as to why the .php pages are being displayed this way. Thanks

TJ

AprilS

10:52 pm on Sep 5, 2003 (gmt 0)

10+ Year Member



I've never experienced a problem with style sheets and php. I suggest viewing the html source in your browser.. there is most likely an inconsistancy you're not seing when viewing just your php. See exactly what html is being produced.

In fact, if you really want to see that it isn't the php, take your html from a page you know is working correctly and put it in a test PHP page and simply do a print or echo. It should spit out the exact same stuff....lets hope ;-)

<?
print "PASTE YOUR EXACT HTML HERE";
?>

regarding something looking a certain way in one browser and not the other. This is Quite common with style sheets! Its a pain I know (as I've gone through this) but you have to do a lot of testing to see what works in each browser. It may sound too simple, but one browser could disply a font pixel size so slightly different that you may think its the same....but its enough to through off the rest of your page.

I hope I've been some sort of help.

TomJones

6:27 am on Sep 6, 2003 (gmt 0)

10+ Year Member



Thanks for your input.

I've been designing with CSS for several sites now. It's been quite some time since I first opened my beautiful (inIE6) pages in Mozilla and, realized the major drawbacks of CSS. I'd like to think that I know enough about it now to avoid the most common mistakes.

If it was only one php page, your suggestion might make sense. This occurs on every php page and, I converted two of those from htm pages. I'll keep searching in the markup, thanks for the input.

TJ

vincevincevince

8:19 am on Sep 7, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



there is no reason that they should be different...
maybe you're sending no/wrong content type in the header?

as a test - open a .php page in your favourite browser, then save that file (html only) to disk - upload it to your webserver, and open it... i.e. you'll have the end result from the php in static html - if it renders like you find html pages are, not like a php page, then that indicates there is indeed a deeper problem with your server configuration - if however the saved php->html->server-again page displays like the php page it was saved from - then that points to your php being coded differently to your html - maybe the templates you use are different, or tags are not properly built up. i hope this is of some help, and good luck - i'd be interested to hear what you find the problem s.

mylungsarempty

8:25 am on Sep 7, 2003 (gmt 0)

10+ Year Member



I have my fonts displayed slightly differently when an identical file is rendered with the only difference being the extention. It isn't anything inside php code either, just plain HTML. It's definitely a real phenomenon.

TomJones

2:19 pm on Sep 7, 2003 (gmt 0)

10+ Year Member



That's a good suggestion. I'll try that one now. I have a feeling that some browsers DO display content differently just based on the file extension. Since it all could be just based on designer error, I have been working to find the flaw in the code, with no luck so far.

I have another site where two pages with identical mark-up display differently in IE5 Mac & Mozilla. The php page displays fine but, the htm page lines my divs up straight to the bottom of the page. In this case, the php page is doing what I want. I have everything identical in the page so, it has to be something in the browsers' rendering of the php page. I have since fixed the problem by adding a container div but, it still seems strange that the extension caused a different output to the browser.

TomJones

2:37 pm on Sep 7, 2003 (gmt 0)

10+ Year Member



Well, time to eat some crow. Your advice helped me solve the initial problem (one still lingers but, I'll find it). What was throwing everything off was in the Doc Declaration, I should have included "h**p://www.w3.org/TR/html4/loose.dtd" on my php headers.

Thanks, 3xV.