相同的div代码,但无法正常工作

时间:2013-07-20 18:36:11

标签: php mysql fonts html-lists

我正在修改THIS PAGE

如果你看一下,你会看到我遇到的问题。

底部2个链接与前3个链接不匹配。

这是代码:

 <?PHP 
include_once('include/connection.php'); 
include_once('include/article.php');

$category = new category;
$articles = $category->fetch_all();


?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Xclo.mobi</title>

<link type="text/css" rel="stylesheet" href="other.css" />
<link rel="apple-touch-icon" href="homescreen.png" />
<link href="startup.png" rel="apple-touch-startup-image" />


<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-34172259-1']);
  _gaq.push(['_setDomainName', 'xclo.co.uk']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>

</head>
<body>

<?php include_once('header.php'); ?>


<div id="content">
<ul class="pageitem">
<li class="button"><input name="Submit" value="Food" onclick="window.location='food.html' " type="submit" /></li></ul>
<ul class="pageitem">
<li class="button"><input name="Submit" value="Make A Change" onclick="window.location='change.html' " type="submit" /></li></ul>
<ul class="pageitem">
<li class="button"><input name="Submit" value="Finance" onclick="window.location='insurance.html' " type="submit" /></li></ul>

<?php foreach ($articles as $article) { ?>

<ul class="pageitem"><li class="button">    
<a href="list.php?id=<?php echo $article['promo_cat']; ?>">
<input type="submit" name="Submit" value="<?php echo $article['promo_cat']; ?>" style="text-decoration: none;"/>
</li></ul>
          </a> <?php } ?>

</div>
<br><center>
<SCRIPT charset="utf-8" type="text/javascript" src="http://ws-eu.amazon-adsystem.com/widgets/q?rt=tf_sw&ServiceVersion=20070822&MarketPlace=GB&ID=V20070822%2FGB%2Fxclo-21%2F8002%2Fc2cd2f40-ca29-49bc-add9-6cf16307e855"> </SCRIPT> <NOSCRIPT><A HREF="http://ws-eu.amazon-adsystem.com/widgets/q?rt=tf_sw&ServiceVersion=20070822&MarketPlace=GB&ID=V20070822%2FGB%2Fxclo-21%2F8002%2Fc2cd2f40-ca29-49bc-add9-6cf16307e855&Operation=NoScript">Amazon.co.uk Widgets</A></NOSCRIPT></center>

<?php include_once('footer.php'); ?>


</body>
</html>

前3个是手动HTML输入,但是底部2是从我的数据库中获取的。

我的问题是:

这两种类型都有相同的“li”和“ul”标签。那么他们为什么看起来不一样呢?

谢谢你。

修改

底部2的值是:

   <?php foreach ($articles as $article) { ?>

    <ul class="pageitem"><li class="button">
    <a href="list.php?id=<?php echo $article['promo_cat']; ?>">
    <input type="submit" name="Submit" value="<?php echo $article['promo_cat']; ?>" style="text-decoration: none;"/>
    </li></ul>
              </a> <?php } ?>

但它需要删除下划线。

2 个答案:

答案 0 :(得分:0)

您的html格式不正确

<?php foreach ($articles as $article) { ?>
    <ul class="pageitem">
        <li class="button" style="text-align:center;font-weight: bold;">
        <a href="list.php?id=<?php echo $article['promo_cat']; ?>">
        <?php echo $article['promo_cat']; ?>
        </a>
        </li>
    </ul>
<?php } ?>

答案 1 :(得分:0)

我已对此进行了排序。

请再次查看我的链接。

我使用的代码就是这个。

<?php foreach ($articles as $article) { ?>

<style>
a:link, a:visited, a:hover{color:black; text-decoration:none;}
</style>


<ul class="pageitem"><li class="button">   
<a href="list.php?id=<?php echo $article['promo_cat']; ?>">
<input type="submit" name="Submit" value="<?php echo $article['promo_cat']; ?>"/>
</li></ul>
          </a> <?php } ?>

请一个人。

谢谢。