我想在div左边放置一个伪选择器(首字母)
我试着给父DIV位置Relative和pseduo选择器(div::first-letter)位置absolute,但没有成功
font-family: "Franklin Gothic Medium", "Arial Narrow", Arial, sans-serif;
text-align: center;
line-height: 55px;
width: 300px;
height: 60px;
background-color: #d4d4d4;
color: black;
margin: auto;
position: relative;
}
div::first-letter {
position: absolute;
top: 50px;
left: 60px;
color: white;
left: 90px;
}
1条答案
按热度按时间8wtpewkr1#
position
不是可用于::first-letter
的属性之一。一些可用的属性可用于推送文本,例如padding
和line-height
。