css'内容'功能没有显示

时间:2016-07-22 05:10:55

标签: html css

我有两个按钮(每个按钮内部都有一个旋转的div,可以在页面的底部和顶部创建一个三角形)

<button id="arrow-up">
    <div id="rotate-up"></div>
</button>
<button id="arrow-down">
    <div id="rotate-down"></div>
</button>

CSS

#arrow-down, #arrow-up { 
  display: block;
  position: absolute;
  z-index: 200;
  width: 80px; height: 55px;
}

#rotate-down, #rotate-up {
  border:none;
  position: relative;
  height: 100%; width: 100%;
  transform-origin: center left;
  background-color: #fff;
  margin-left: 20px;
}

#rotate-down {
  border-bottom:none;
  transform:rotate(45deg);
}

#rotate-up {
  border-top:none;
  transform:rotate(-45deg);
}

我想在每个按钮中添加一个向上/向下指向的黑色雪佛龙。我想用css

content: "/..."; 

为了避免添加任何额外的div,以保持简单,但我不能让它显示在我的按钮上尽管我把它放在哪里(我用一个字母测试它)。

1 个答案:

答案 0 :(得分:3)

content属性是:: after(:after)和:: before(:before)选择器所独有的。

#yourElement:before {
    content: "your content";
}