在span和table中设置PHP echo的样式

时间:2013-07-28 10:48:26

标签: php styles

创建了以下代码,其中包括背景图像和倾斜表格。该表的竞争对手是使用PHP从数据库中提取的。

除了更改字体外,我没有能力在表格中设置PHP文本的样式,但是改变了类" table"。是否有一种特定的方法在此上下文中使用PHP echo文本来设置样式。我想改变文本的大小和颜色。

非常感谢

 <div class="information_request_form">
  <img src="images/information_request_form.png" width="1051" height="1013" />
  <div class="skewed">
  <div class="table" >
  <?php 
  $array = explode(',', $_SESSION['cart']);
  echo "<span ><table width='835' border = '0'>";
  foreach($array as $cartId) {
  $ship_name = $row_ships['ship_name'];
  $ship_image = $row_ships['image'];
  echo "<tr>";
  echo "<td width='110' height='58'><img src='images/ships/$ship_image'width='83' height='53' /> </td>";
  echo "<td width='620' height='58'>$ship_name</td>";
  echo "<td width='35' height='58'><a href='cart.php?action=delete&ship_id=$cartId'><img src='images/trash.png' width='31' height='42' /></a></td>";
  echo "<td height='58'>$cartId</td>";
  echo "</tr>";
  } 
  echo "</table></div>";
    ?>
  </div>
  </span>
  <div class="table_email">
  <table>
  <tr>
  <td height="54" >
  <input name="email" type="text" onfocus="if(this.value=='enter your email address') this.value = ''" onblur="if(this.value=='') this.value = 'enter your email address'" value="enter your email address" size="50" maxlength="50">
  </td>
  </tr>
  </table>
  </div>
  </div>

1 个答案:

答案 0 :(得分:1)

一种很好的方法是将类/ id添加到你想要样式的那些,并在CSS中添加一些东西。

echo "<td width='35' height='58' class='styled-td'><a href='cart.php?action=delete&ship_id=$cartId'>";

还有一些CSS:

.styled-td { color: blue; }