【问题标题】:Add css pseudo class on table cell with title attribute [duplicate]在具有标题属性的表格单元格上添加css伪类[重复]
【发布时间】:2020-12-27 03:57:09
【问题描述】:

我有一个使用 API Fetch 填充数据的表。一些单元格将具有“标题”属性,在我的 JSFiddle 中,我将它放在第二列中。 我想为有工具提示的此类单元格添加一个指示器,我尝试使用以下 css,但没有成功:

td[title]:after {
        position: absolute;
        width: 0;
        height: 0;
        top: 0;
        right: 0;
        border-top: 10px solid red;
        border-left: 10px solid transparent;
    }

我应该看起来像这里的图像:

JSFiddle Demo

【问题讨论】:

    标签: javascript html jquery css


    【解决方案1】:

    你必须为它添加内容

    td[title] {
      position: relative;
    }
    td[title]::after {
      position: absolute;
      width: 0;
      height: 0;
      top: 0;
      right: 0;
      content: ' ';
      border-top: 10px solid red;
      border-left: 10px solid transparent;
    }
    

    【讨论】:

      猜你喜欢
      • 2018-11-11
      • 2018-09-15
      • 2019-02-02
      • 2010-09-19
      • 1970-01-01
      • 2019-02-16
      • 1970-01-01
      • 1970-01-01
      • 2012-08-21
      相关资源
      最近更新 更多