Jump to content

Adding CSS to PHP


mzonas

Recommended Posts

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 ...  :)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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/>';

}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.