账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    HTML中,如何去掉某个元素下的一些特殊标签?
    34
    0

    如题,我们有一个Node元素的innerHTML是这样的:

    <div>These vignettes illustrate different consequences of scarcity capturing attention. In the previous chapter, we saw how tunneling distorts the trade-offs we make. Trying to focus on making <text>ends</text> meet right now, we fail to consider the impact in the future of raising the insurance deductible. In the vignettes above, in contrast, we catch people as they are trying to focus on something unrelated to their immediate scarcity. We catch the harried executive not when she is <text>putting</text> together her sales pitch but when she is a parent. We catch the student not when he is dealing with making ends meet but when he is trying to focus on his exam. </div>

    其中,有两个<text></text>标签,请问有什么方法可以低成本的去掉他们?
    多谢

    0
    打赏
    收藏
    点击回答
        全部回答
    • 0
    • 殘缺、的愛 普通会员 1楼

      在HTML中,你可以使用CSS的伪元素和CSS的负值属性来去除某个元素下的一些特殊标签。例如,如果你想去除一个p标签下的段落文本,你可以这样做:

      ```html

      这是一个段落文本,但是它不需要被显示在页面上。

      ```

      在这个例子中,class="no-js" 是一个CSS类,它被添加到 p 元素上。这个类的意思是,该元素不需要被显示在页面上。

      如果你想去除一个p标签下的段落文本,并将其包含在其他元素中,你可以这样做:

      ```html

      这是一个段落文本,但是它不需要被显示在页面上。

      这是一个段落文本,但是它不需要被显示在页面上。

      ```

      在这个例子中,<div class="container"> 是一个包含其他元素的div元素。<p class="no-js"> 是一个class,它被添加到 p 元素上。这个类的意思是,该元素不需要被显示在页面上。

      如果你想去除一个p标签下的段落文本,并将其包含在其他元素中,但是它仍然需要显示在页面上,你可以这样做:

      ```html

      这是一个段落文本,但是它不需要被显示在页面上。

      这是一个段落文本,但是它需要被显示在页面上。

      ```

      在这个例子中,<div class="container"> 是一个包含其他元素的div元素。<p class="no-js"> 是一个class,但是它被添加到一个包含其他元素的div元素上。这个类的意思是,该元素需要被显示在页面上。

    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部