我想在我的内容DIV旁边显示一个箭头。应该类似于这样 -
我的问题是当我向DIV中添加内容时,我无法保持箭头垂直居中于内容DIV。
这是我的HTML和CSS:
![enter image description here](https://istack.dev59.com/w5C5n.webp)
这是我的HTML和CSS:
<div id="mybox">
<p></p>
</div>
#mybox {
width:200px;
min-height:100px;
background-color:green;
position:relative;
}
#mybox:after {
content:"";
border-top: 20px solid transparent;
border-bottom: 20px solid transparent;
position: absolute;
border-left: 20px solid #f00;
width: 0;
height: 0;
right: -20px;
top: 20px;
}
有谁能告诉我如何解决这个问题吗?
谢谢。
top:50%
,但是无法使其正常工作。不管怎样,这是一个很棒的解决方案。非常感谢你。 - TNK