CSS Hide outer Span and show inner span

前端 未结 5 1749
别那么骄傲
别那么骄傲 2020-12-22 03:21
as low as $1,33         


        
5条回答
  •  情歌与酒
    2020-12-22 03:32

    Visibility can help you here.

    .price {
      visibility: hidden;
    }
    
    .price > span {
      visibility: visible;
    }
    as low as 
    
    $1,335.79
    

    If removing the space taken by the hidden text is also require then the font-size:0 is an option in some browsers provided you reset the inner text back to the required size.

    .price {
      visibility:hidden;
      font-size:0;
      }
    
    .price > span {
      visibility:visible;
      font-size:1rem;
      }
    as low as 
    
    $1,335.79
    

提交回复
热议问题