CSSボタンを作成し、:afterを使用してアイコンを追加しようとしていますが、画像が表示されません。'background'プロパティを'background-color:red'に置き換えると、赤いボックスが表示されるため、ここで何が問題になっているのかわかりません。
HTML:
<a class="button green"> Click me </a>
CSS:
.button {
padding: 15px 50px 15px 15px;
color: #fff;
text-decoration: none;
display: inline-block;
position: relative;
}
.button:after {
content: "";
width: 30px;
height: 30px;
background: url("http://www.gentleface.com/i/free_toolbar_icons_16x16_black.png") no-repeat -30px -50px no-scroll;
background-color: red;
top: 10px;
right: 5px;
position: absolute;
display: inline-block;
}
.green {
background-color: #8ce267;
}
このフィドルをチェックして、私が正確に何を意味するかを確認できます。
ヒントをありがとう。