Is it possible to make in pure css background for half square like on the imag
You can use transform if you don't need to worry about old browser support.
.container {
position: relative;
overflow: hidden;
width: 100px;
}
.square {
width: 100px;
height: 100px;
background-color: #E30606;
}
.overlay {
width: 171px;
height: 72px;
background-color: #D0CBCB;
-webkit-transform: rotate(225deg);
-moz-transform: rotate(225deg);
-ms-transform: rotate(225deg);
transform: rotate(225deg);
}
<div class="container">
<div class="square">
<div class="overlay"></div>
</div>
</div>
http://jsfiddle.net/hT9vP/13/
If your divs have fixed sizes, you can use borders to make two triangles as described in How do CSS triangles work?:
div{
display:inline-block;
border-top:100px solid red;
border-right:100px solid grey;
}
<div></div>
To make other sizes, colors, you need to tweak the border properties :
div {
display: inline-block;
}
div:nth-child(1) {
border-right: 100px solid red;
border-top: 100px solid grey;
}
div:nth-child(2) {
border-left: 100px solid red;
border-top: 100px solid grey;
}
div:nth-child(3) {
border-right: 50px solid red;
border-top: 100px solid grey;
}
div:nth-child(4) {
border-right: 100px solid red;
border-bottom: 50px solid grey;
}
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
You can also try linear-gradient
div {
width: 200px;
height: 200px;
background: rgba(248, 80, 50, 1);
background:linear-gradient(to bottom right,grey 50%,red 50%);
}
<div></div>