拥有此代码:
<h4 class="ihf-price" style="margin-right:10px;">
<span class="ihf-for-sale-price"> $16,750,000 </span> (Fee Simple)
</h4> </div> </div>
如何隐藏文字&#34;(费用简单)&#34;从显示?
想要显示价格而不是&#34;费用简单&#34;文本
答案 0 :(得分:3)
您可以使用如下字体大小的技巧:
h4.ihf-price {
font-size: 0;
}
h4.ihf-price span {
font-size: initial;
}
<h4 class="ihf-price" style="margin-right:10px;">
<span class="ihf-for-sale-price"> $16,750,000 </span> (Fee Simple)
</h4>
如果您想要保持h4
的相同内容宽度,请使用颜色技巧:
h4.ihf-price {
color: #fff; /* Should be the same as background */
}
h4.ihf-price span {
color: initial;
}
<h4 class="ihf-price" style="margin-right:10px;">
<span class="ihf-for-sale-price"> $16,750,000 </span> (Fee Simple)
</h4>
答案 1 :(得分:2)
隐藏整个元素中的文字。仅在嵌套元素中显示文本。
.ihf-price {
font-size: 0;
}
.ihf-for-sale-price {
font-size: 16px;
}
&#13;
<h4 class="ihf-price" style="margin-right:10px;">
<span class="ihf-for-sale-price"> $16,750,000 </span> (Fee Simple)
</h4>
&#13;
OR
.ihf-price {
visibility: hidden;
}
.ihf-for-sale-price {
visibility: visible;
}
&#13;
<h4 class="ihf-price" style="margin-right:10px;">
<span class="ihf-for-sale-price"> $16,750,000 </span> (Fee Simple)
</h4>
&#13;