【发布时间】:2019-10-22 08:25:06
【问题描述】:
在 php 文件中有以下代码:从代码中,第一行定义标题(屏幕截图的第一行),第二个城市,第三和第四个定义城市旁边的“price_new”或“价格”(如果存在)(第二行来自截图),五个和六个定义 price_two 和 min_amount(屏幕截图的第三行),最后一个是类别(屏幕截图的第四行):
问题是我无法从屏幕截图中删除第二行和第三行之间的多余空间:
<a class="b" title="<?=$last['title']?>" href="<?="c".$last['id_category']."-".$last['board_id']?>.html"><?=$last['title']?></a><br /><span>
<? if(defined('JBLANG')&& constant('JBLANG')=='en') echo $last['en_city_name']; else echo $last['city_name'];
if(($last['price'] > $last['price_new']) && ($last['price_new'] != 0)) echo " | <s class=\"red\">".$last['price']." ".$last['prise']."</s>.";
if($last['price'] != 0 && $last['price_new'] == 0) echo " | <span class=\"green\">".$last['price']." ".$last['prise']."</span>";
if ($last["price_two"]) echo '</span><br /><a style="display: inline-block;" class="sm_11"><span>Цена Оптом</span> <span class="green">'.$last["price_two"].' '.$last["price_two_currency"].'<span></a>';
if ($last["min_amount"]) echo ' | <a style="display: inline-block;" class="sm_11" style="margin-left: 22%;"><span>Мин. кол-во</span> <span class="green">'.$last["min_amount"].' '.$last["min_amount_currency"].'<span></a>' ?>
</span>
<br /><a style="display: inline-block;" class="sm_11" title="<?=$last[$name_cat]?>" href="<?="c".$last['id_category']?>.html"><?=$last[$name_cat]?></a>
谢谢, S
【问题讨论】:
-
使用css行高或边距
-
(1) 整理并更正您的 html,您有一些未配对的
<span>标签。对于后续问题 (2) 为.sm_11类发布相关 CSS -
@PA。我不擅长 html,你能把正确的代码去掉不成对的 标签吗?谢谢
-
你只需要整理一下你的代码,不匹配的标签就会一目了然。首先,拿一本好的 html 和 php ibook 开始吧!