I am working on a project where I have a diamond div that should be responsive.
The image below shows the diamond in the div that I created, but it does not work in all sizes. I want the diamond to respond to browser size, so it always fits.

I have jsFiddle , but it does not respond. Just to show what I want and I tried to create.
<div id="page"> <div id="main"> <div class="box blue"></div> <div class="box green"></div> <div class="box red"></div> <div class="box yellow"></div> </div> </div>
#page { width:100%; height:100%; min-height:500px; min-width:500px; } #main { height:80px; width:80px; position:relative; display:block; transform: rotate(45deg); -ms-transform: rotate(45deg); -webkit-transform: rotate(45deg); } .box { display: inline-block; height:35%; width:35%; margin-right:5%; margin-top:5%; } .blue { background-color:blue; } .green { background-color:green; } .red { background-color:red; } .yellow { background-color:#ffd54f; }
Any help is much appreciated :-)
html css html5 css3
Mรผnter
source share