I want to create a square and a triangle on the top of it with css only, so
- I could write some dynamic text in the triangle
- It would be easy to dynamically set the triangle color with css at runtime.
I want to create a square and a triangle on the top of it with css only, so
 
    
    Here's one way of doing it:
HTML
<div class="container">
    <div class="content">Hello World</div>
    <div class="triangle"></div>
</div>
CSS
.container{
    border:1px solid #000;
    position:relative;
}
.content{
    z-index:500;
    position:absolute;
    top:230px;
    left:120px;
    color:#fff;
}
.triangle{
    border-color: #fff #fff red #fff;
    border-width:160px;
    border-style:solid;
    width:0;
    height:0;
    position:absolute;
    top:0;
    left:0;
    z-index:2;
}
