homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderators: not2easy

CSS Forum

php includes and css
using includes to assemble page = minor hiccups in layout

 9:03 pm on Oct 30, 2008 (gmt 0)

I'm not sure whether this goes here or in the PHP forum, but here's what's up...

I created an html doc that links to an external stylesheet. After I got the layout just right, I moved portions of my html doc into php include files. (The header info is in one include file; the navigation is in another; etc.) I then created a new index file to assemble all of my includes.

When the new index file runs, it assembles just fine. But there are minor layout changes --- a margin or padding as been inserted at the top of the document, and a div that should be centered is not.

The source code of the assembled document is identical to the source code of my original html doc. So what kinds of things could account for these little layout changes?

I didn't want to inundate this thread with code just yet, figuring that there may be a broad answer to this question. I'm happy to post code if needed though.



 10:59 pm on Oct 30, 2008 (gmt 0)

If your CSS incorporates images (esp for borders or similar) there might be issues with the 'relative paths' (the
../ bits)

.myClass {
background:#fff url(
../myFolder/myFile.gif) top repeat-x;
.myClass {
background:#fff url(
../../myFolder/myFile.gif) top repeat-x;


 11:56 pm on Oct 30, 2008 (gmt 0)

I'd triple check if the code delivered to the browser is 100% identical. I've a funny feeling there will be a difference somewhere.


 7:12 pm on Oct 31, 2008 (gmt 0)

I don't have images yet, lavazza, but that's a good thing to keep in mind for when I start adding them. Thank you.

I triple-checked the code, swa66, and did find an empty square in the source of the assembled php page. Tis a character encoding thing, I presume. I can take it from here. Many thanks.


 7:21 pm on Oct 31, 2008 (gmt 0)

What you're talking about are probably browser differences of interpretation. Have you tried looking at it in both IE and FFX to see if this is the case?


 1:23 am on Nov 1, 2008 (gmt 0)

Oh geeze, I thought I had it fixed, but no...

As a simple html doc linked to a css file, the layout is perfect in both FF2 and IE7. When I convert the html file to a php file, and import the html with includes, the layout is still perfect in FF2, but it changes in IE7.

I double, triple and quadruple-checked the source codes from the original html doc, the php file as rendered in FF, and the php file as rendered in IE --- and they are all ABSOLUTELY identical. And they are all linked to the same css file.

Would the problem have anything to do with my hosting company's php install? Should I move this question over to the php forum?


 1:52 am on Nov 1, 2008 (gmt 0)

Found the solution:

Re-saved all files (including my php includes and .css) in Notepad, being sure to select "ANSI" for encoding. The encoding had previously been UTF-8.

Problem solved.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / CSS
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved