dongyong6332 2015-11-06 07:41
浏览 54

应用CSS样式后,表格右侧对齐

My table is now aligned to the right side after I made some CSS style changes. I try to add in table align="center" but it's also not working. Please let me know what I'm missing.

enter image description here

table {
//font: 11px/24px Verdana, Arial, Helvetica, sans-serif;
border-collapse: collapse;
width: 320px;
}

th {
padding: 0 0.5em;
text-align: left;
}


td {
border-bottom: 1px solid #CCC;
padding: 0 0.5em;
}

td.width {
width: 190px;
}


<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Browse CD</title>
    <link rel="stylesheet" type="text/css" href="CDcss.css" />
</head>
<body>
    <div id="wrapper">
    <div id="banner">        
        </div>

        <nav id="navigation">
            <ul id="nav">
                <li><a href="index.php">Home</a></li>
                <li><a href="DisplayCD.php">Browse</a></li>
                <li><a href="SearchCD.php">Search</a></li>
                <li><a href="Credit.php">Credit</a></li>
            </ul>
        </nav>

 <style> 

 td, th {
 border: 1px solid black;
 }


 th {
 background-color: grey;
 color: white;
 }

 </style> 

 <?php
 header('Content-type: text/html; charset=iso-8859-1');

 include 'database_conn.php';   

$sql = "SELECT nmc_cd.CDID, nmc_cd.CDTitle, nmc_cd.CDYear, nmc_cd.CDPrice, nmc_category.catDesc, nmc_cd.catID
            FROM nmc_cd 
            LEFT JOIN nmc_category ON nmc_cd.catID=nmc_category.catID"; 

$queryresult = mysqli_query($conn, $sql)
or die (mysqli_error($conn));       

    echo '<table class=table>';
    echo '<tr><th>Music Title</th><th>Year</th><th>Price</th>  <th>Category</th><tr>'; 
    echo '</table';

while($row = mysqli_fetch_assoc($queryresult)) {
    $iCDID = $row['CDID'];
    $CDTitle = $row['CDTitle'];
            $CDYear = $row['CDYear'];
    $CDPrice = $row['CDPrice'];
            $CDCat = $row['catDesc'];
            $CDCatID = $row['catID'];

            echo "<table><tr><td>
            <a href = \"editCDForm.php?itemCode=$iCDID\">$CDTitle</a>
            </td><td> $CDYear
            </td><td> $CDPrice  
            </td><td> $CDCat
            </td></tr>
            </table";
}


mysqli_free_result($queryresult); 
mysqli_close($conn);
?>

</body>
</html>
  • 写回答

1条回答 默认 最新

  • doushuo1989 2015-11-06 09:04
    关注

    Provide link of your site or the page where this table is displaying.

    评论

报告相同问题?

悬赏问题

  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。