我需要使用這個形狀並在其中顯示文本。但是,我不知道爲什麼文本是沒有顯示。在DIV中的文本沒有顯示
HTML:
<div id="thebag">
<h3> Shihab Mridha </h3>
</div>
CSS:
#thebag{
position: relative;
overflow: hidden;
}
#thebag::before{
content: '';
position: absolute;
top: 0;
left: 0;
height: 50px;
width: 30%;
background: red;
}
#thebag::after {
content: '';
position: absolute;
top: 0;
left: 30%;
width: 0;
height: 0;
border-bottom: 50px solid red;
border-right: 70px solid transparent;
}
https://jsfiddle.net/kn87syvb/1/
[中的z-index:before或:after是元以下,這可能嗎?]的可能的複製(HTTP:/ /stackoverflow.com/questions/3032856/z-index-of-before-or-after-to-be-below-the-element-is-that-possible) – showdev