我在Prestashop 1.7.3中有以下代码。我希望在每个nl2br.后面都有一条虚线。我通过css删除br。
所以所有项目都在一行中。我要用虚线(-)分隔项目
<section class="product-features">
<p class="page_heading">{l s='Data sheet' d='Shop.Theme.Catalog'}</p>
{foreach from=$product.grouped_features item=feature}
<dl class="data-sheet flex_container">
<dt class="name">{$feature.name}</dt>
<dd class="value flex_child">{$feature.value|escape:'htmlall'|nl2br nofilter}</dd>
</dl>
{/foreach}
</section>
<style>
br{display: none;}
</style> 发布于 2019-07-29 19:57:23
我认为,也许最简单的方法就是使用css。只需在<dl>标记的底部添加一个虚线边框。
.product-features dl {
border-bottom: dotted 1px red;
padding-bottom: 16px;
}
.product-features dl:last-child {
border-bottom-width: 0px;
padding-bottom: 0px
}<section class="product-features">
<p class="page_heading">{l s='Data sheet' d='Shop.Theme.Catalog'}</p>
<dl class="data-sheet flex_container">
<dt class="name">{$feature.name}</dt>
<dd class="value flex_child">{$feature.value|escape:'htmlall'|nl2br nofilter}</dd>
</dl>
<dl class="data-sheet flex_container">
<dt class="name">{$feature.name}</dt>
<dd class="value flex_child">{$feature.value|escape:'htmlall'|nl2br nofilter}</dd>
</dl>
<dl class="data-sheet flex_container">
<dt class="name">{$feature.name}</dt>
<dd class="value flex_child">{$feature.value|escape:'htmlall'|nl2br nofilter}</dd>
</dl>
</section>
如果你不想让最终的<dl>有一个底部边框,就把它关掉吧。
附注:我真愚蠢,没有使用精简的语法,而是对我的答案进行了轻微的改进。当然,您可以使用border-bottom: dotted 1px red;
发布于 2019-07-29 20:01:47
Border-bottom是一个简单的方法
.product-features dl {
border-bottom: dotted 1px black;
padding-bottom: 20px;
}<section class="product-features">
<p class="page_heading">{l s='Data sheet' d='Shop.Theme.Catalog'}</p>
<dl class="data-sheet flex_container">
<dt class="name">{$feature.name}</dt>
<dd class="value flex_child">{$feature.value|escape:'htmlall'|nl2br nofilter}</dd>
</dl>
<dl class="data-sheet flex_container">
<dt class="name">{$feature.name}</dt>
<dd class="value flex_child">{$feature.value|escape:'htmlall'|nl2br nofilter}</dd>
</dl>
<dl class="data-sheet flex_container">
<dt class="name">{$feature.name}</dt>
<dd class="value flex_child">{$feature.value|escape:'htmlall'|nl2br nofilter}</dd>
</dl>
</section>
https://stackoverflow.com/questions/57253200
复制相似问题