html - 仅隐藏 html 段落中的文本

标签 html css

我想隐藏段落中的文字,但上面有一张图片和一些文字。当我使用 css 不显示时,所有段落都被隐藏了......但我只想隐藏文本而不是图像。 这是代码。

<p>
  <a href="/_blog/News_and_Inspiration/post/Cooking_up_a_storm/"><img alt="" style="border: 0px solid; width: 100px; height: 150px; float: left; margin-right: 10px; margin-bottom: 10px;" src="/images/blog/Shaun-Clouston.jpg" /></a>
    The executive chef of Wellington&rsquo;s award winning  Restaurant, Shaun Clouston is just one of the award winning New Zealand Beef and Lamb Ambassador chefs we have cooking up a storm at our Rural Women New Zealand Beef + Lamb Cooking Demonstrations over the coming months.&nbsp;
</p>

<p>
  <img src="/images/blog/Southland Life Education Trust Car 2.jpg" alt="">
  Two years ago the Southland Life Education Community Trust approached our four Southland Provincials, asking for assistance to replace their educator’s car, as the current one needed major repairs.
</p>

最佳答案

尝试:

p {
    font-size: 0;
}

并为您希望可见的任何后代元素指定字体大小。

关于html - 仅隐藏 html 段落中的文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11325669/

相关文章:

html - 调整 Bootstrap 表单字段的大小和对齐

javascript - 在弹出窗口中打开不同的内容

html - 重叠 <li 元素 - CSS 自定义

css - 子元素延伸过去的容器元素

jquery - 在ie8的同一个元素上添加渐变背景和图片

html - 将 HTML 解析为 NSAttributedText - 如何设置字体?

javascript - 为什么我的 meteor 应用程序创建 "hiddendiv common"div 标签?

javascript - ASP.NET AJAX--styleSheet.insertRule() 未按预期工作

jquery - 链接在我的模板上不起作用

jquery - 重新使用现有的按钮代码在 html 中创建许多按钮?