mzonas Posted September 4, 2007 Share Posted September 4, 2007 Hello. I have a problem again ... I want to add some CSS to PHP, and I have external file for CSS. Why some elements work, and most element don't work with PHP/CSS files? Here are examples: CSS working elements: .maintable { width: 90%; border-style: solid; border-width: 1px; border-color: #000000; background: #FFFFCC; } .headline { background: #009999; color: #FFFFFF; font-size: 12px; font-family: helvetica, sans-serif; text-align: center; } .mainrow { background: #FFFFCC; color: #000000; font-size: 12px; font-family: helvetica, sans-serif; text-align: left; } input { background: #FFFFCC; border: 1px solid #009999; color: #000000; size: 12px; font-size: 11px; font-family: helvetica, sans-serif; } a, a:visited, a:active { color: #000000; font-size: 12px; font-family: helvetica, sans-serif; text-decoration: none } a: hover { color: #000000; font-size: 12px; font-family: helvetica, sans-serif; text-decoration: underline; } .mainrow2 { background: #FFFFCC; color: #000000; font-size: 12px; font-family: helvetica, sans-serif; text-align: center; } .mainrow3 { background: #FFFFFF; color: #000000; font-size: 12px; font-family: helvetica, sans-serif; text-align: center; } And here are elements that do not work: .main { width: 90%; border-style: solid; border-width: 1px; border-color: #000000; background: #FFFFFF; } .forumtable { width: 100%; border-style: solid; border-width: 1px; border-color: #FFFFFF; } .forumrow { background: #FFFFCC; color: #000000; font-size: 12px; font-family: helvetica, sans-serif; text-align: left; } And here is PHP page: if ($pid == '') { $topic = mysql_query("SELECT * FROM cst_forum_topics") or die (mysql_error()); WHILE ($topic2 = mysql_fetch_array($topic)) { print '<table class="maintable">'; print '<tr class="headline2">'; print '<td>Topic Title: '.$topic2[topic].'</td>'; print '</tr>'; print '<tr class="forumrow">'; print '<td>By: '.$topic2[starter].', '.$topic2[date].'</td>'; print '</tr>'; print '</table>'; print '<br/>'; } } Element .maintable work perfectly just like .headline. However, .headline2, .forumrow do not work for me. Why ? Thank you for any help ... Quote Link to comment https://forums.phpfreaks.com/topic/67914-adding-css-to-php/ Share on other sites More sharing options...
php_tom Posted September 4, 2007 Share Posted September 4, 2007 How did you add the CSS to the PHP file? Like this? <?php echo "<link rel='stylesheeet' href='myCSS.css' />"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/67914-adding-css-to-php/#findComment-341352 Share on other sites More sharing options...
samoht Posted September 4, 2007 Share Posted September 4, 2007 The problem seems to be with the html output not php/css I noticed that the only class that was in your css and your php was forumrow the other classes I didn't see in your code example. anyway you may have a css conflict. try styling the table with an HTML mockup first, then if all works - make it dynamic. Quote Link to comment https://forums.phpfreaks.com/topic/67914-adding-css-to-php/#findComment-341357 Share on other sites More sharing options...
ccrevcypsys Posted September 4, 2007 Share Posted September 4, 2007 there is no class='main' or class='forumtable' Quote Link to comment https://forums.phpfreaks.com/topic/67914-adding-css-to-php/#findComment-341362 Share on other sites More sharing options...
mzonas Posted September 4, 2007 Author Share Posted September 4, 2007 but they also don't work ... ??? Quote Link to comment https://forums.phpfreaks.com/topic/67914-adding-css-to-php/#findComment-341364 Share on other sites More sharing options...
ccrevcypsys Posted September 4, 2007 Share Posted September 4, 2007 they dont work because they arent in ur code anythere (php code) if ($pid == '') { $topic = mysql_query("SELECT * FROM cst_forum_topics") or die (mysql_error()); WHILE ($topic2 = mysql_fetch_array($topic)) { print '<table class="maintable">'; print '<tr class="headline2">'; print '<td>Topic Title: '.$topic2[topic].'</td>'; print '</tr>'; print '<tr class="forumrow">'; print '<td>By: '.$topic2[starter].', '.$topic2[date].'</td>'; print '</tr>'; print '</table>'; print '<br/>'; } Quote Link to comment https://forums.phpfreaks.com/topic/67914-adding-css-to-php/#findComment-341371 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.