I am trying to create a response triangle div that will be at the top of the page as a header.
I was able to achieve this with the following code:
div{ width: 0; height: 0; border-style: solid; border-width: 200px 400px 0 0; border-color: #007bff transparent transparent transparent; }
<div></div>
The problem is that I want this triangle to be responsive to page width and vary proportionally in height.
I tried to set the width and height as a percentage, however this created a really small triangle, which you can see here:
http://jsfiddle.net/Ltbzkq0e/1/
How to make borders work with percentages without using web whales? Is this possible, if not so, how can I achieve this effect using web whales?
EDIT:
I would also like to place content in this div. Right now, the only way I can think of is to use absolute positioning and set the height to -20px, etc. Is there a better way to do this?
css css3 css-shapes responsive-design
Bojan
source share