Hall of Famer Posted December 18, 2011 Share Posted December 18, 2011 Well in my project there is a main css file defined for the template, with additional css files stored in a folder called /css. Whenever an additional css file needs to be included, the following php script is called: include("css/additionalcss.css"); Inside the additional css file, the script looks somewhat like this: ?> <style type="text/css"> // css content in here </style> <? It has been working out nicely until I noticed that the font style and size is messed up. Here is a comparison of the two pmessage.php files with and without the additional css called pagination.css. As you can see, the font is seriously screwed with additional css. Oddly enough, this font style/size problem will not be present if I copy/paste css content directly to the main template css file. Why is the font messed up with additional css files? I have absolutely no idea... Please help. If you need more info, the css file pagination.css is provided below: ?> <style type="text/css"> div.pagination { padding: 3px; margin: 3px; font-family:Verdana; font-size:8pt; text-decoration:none } div.pagination a { margin: 2px; border: 1px solid #000000; text-decoration: none; /* no underline */ color: #000000;font-family:Verdana; font-size:8pt; padding-left:5px; padding-right:5px; padding-top:2px; padding-bottom:2px } div.pagination a:hover, div.pagination a:active { margin: 2px; border: 1px solid #800000; background-color: #800000; color: #FFFFFF;font-family:Verdana; font-size:8pt; padding-left:5px; padding-right:5px; padding-top:2px; padding-bottom:2px; text-decoration:none } div.pagination span.current { margin: 2px; border: 1px solid #000000; font-weight: bold; background-color: #000000; color: #FFFFFF;font-family:Verdana; font-size:8pt; padding-left:5px; padding-right:5px; padding-top:2px; padding-bottom:2px } div.pagination span.disabled { margin: 2px; border: 1px solid #999999; color: #999999;font-family:Verdana; font-size:8pt; padding-left:5px; padding-right:5px; padding-top:2px; padding-bottom:2px } a:hover.list { font-family: Verdana; font-size: 8pt; font-variant: small-caps; text-decoration: underline; text-transform: capitalize; color: #006699; line-height: 200%; font-weight: bold } a.list { text-transform: capitalize; font-variant: small-caps; font-family: Verdana; font-size: 8pt; color: #FF0000; text-decoration: underline; line-height: 200%; font-weight: bold } </style> <? Quote Link to comment https://forums.phpfreaks.com/topic/253413-additional-css-files-wont-work/ Share on other sites More sharing options...
floridaflatlander Posted December 18, 2011 Share Posted December 18, 2011 ?> <style type="text/css"> // css content in here </style> <? Are these opening and closing php tags like you have them in your file? Quote Link to comment https://forums.phpfreaks.com/topic/253413-additional-css-files-wont-work/#findComment-1298973 Share on other sites More sharing options...
Hall of Famer Posted December 18, 2011 Author Share Posted December 18, 2011 Well yeah. Like I pointed out before, I use the php include function to import additional css file(the main css is defined through an html page though). In order for the script to work, I have to write in this format: ?> <style type="text/css"> // css content in here </style> <? So yeah, it is because I cannot write css content directly inside php tag. Quote Link to comment https://forums.phpfreaks.com/topic/253413-additional-css-files-wont-work/#findComment-1298975 Share on other sites More sharing options...
floridaflatlander Posted December 18, 2011 Share Posted December 18, 2011 I'm not sure I know what your doing. If this .. <?php include ("css/additionalcss.css"); ?> Take out the php tags in your css and try it Opening and closing php tags should be <?php & ?> I don't know where you're at in your script as far as opening and closing php tags go. Play with it and see what happens Quote Link to comment https://forums.phpfreaks.com/topic/253413-additional-css-files-wont-work/#findComment-1299002 Share on other sites More sharing options...
Hall of Famer Posted December 18, 2011 Author Share Posted December 18, 2011 umm are you saying that it is unnecessary to use the php tags in css file? It actually does not make any difference, the font size/style is still screwed up... Please help. Quote Link to comment https://forums.phpfreaks.com/topic/253413-additional-css-files-wont-work/#findComment-1299048 Share on other sites More sharing options...
floridaflatlander Posted December 18, 2011 Share Posted December 18, 2011 Have you looked at your source to see if anything is being included? Show some of your source php file around the include so we can see what your doing. Quote Link to comment https://forums.phpfreaks.com/topic/253413-additional-css-files-wont-work/#findComment-1299067 Share on other sites More sharing options...
Pikachu2000 Posted December 18, 2011 Share Posted December 18, 2011 Are you sure the path is right? What happens if you change include to require_once? Quote Link to comment https://forums.phpfreaks.com/topic/253413-additional-css-files-wont-work/#findComment-1299068 Share on other sites More sharing options...
haku Posted December 19, 2011 Share Posted December 19, 2011 Why do you have PHP tags in the file with the CSS in it? You shouldn't need those, unless there is other code that we cannot see. Quote Link to comment https://forums.phpfreaks.com/topic/253413-additional-css-files-wont-work/#findComment-1299132 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.