gpt4 book ai didi

html - 摆脱多余的空间

转载 作者:行者123 更新时间:2023-11-27 23:11:07 25 4
gpt4 key购买 nike

在 php 文件中有以下代码:从代码中第一行定义标题(屏幕截图的第一行),第二个城市,第三个和第四个定义城市旁边的 'price_new' 或 'price'(如果存在)(第二行来自截图),五个和六个定义 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

enter image description here

最佳答案

只需将一个类添加到您正在使用的 div/html 标记中。这是一个例子:

.example_class{
line-height:1px;
}

.large_example_class{
line-height:300px;
}
<div class="example_class">
<p> Hello </p>
<p> World </p>
</div>

<div class="large_example_class">
<p>Hello</p>
<p>World</p>
</div>

然而,行高确实会影响 div 中文本行上方和下方的空白。如果你想单独做,你需要这样做:

.line_1{
margin: 0px;
}

.line_2{
margin-top:10px;
}

.line_3{
margin-top:200px;
}
<div>
<p class="line_1">Hello</p>
<p class="line_2">World</p>
<p class="line_3">Hello</p>
</div>

基本上在这里你设置顶部的边距,它只影响给定的行。但是,如果您将此类与其他 itme 重用,它们将以同样的方式受到影响。

在您的示例中,我将使用以下内容:

<?php 
echo'</span><p><a style="display:block; background-color:white;">Hello</a></p>'

但是,您应该使用一个类来更改您的样式属性,以使其更加通用。如果您想了解有关此代码的更多信息,请查看 W3 Schools 等网站。或 tutorialspoint

关于html - 摆脱多余的空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58499986/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com