1

I want to make a triangle using css and i want to give a base according to the width of the parent section width i defined. Below are the id and class i used for it

.Workingon{
    display: block;
    background-color: rgb(23, 23, 36);
    height: 500px;
    width: 95%;
    margin: auto;
    position: relative;
    overflow: hidden;
}
#UpTriangle{
    width: 0;
    height: 0;
    position: absolute;
    border-left: calc(100%-10px) solid transparent;
    border-right: calc(100%-10px) solid transparent;
    border-top:500px solid red;
}

Here below is html code.

  <section class="Workingon">
         <div id="UpTriangle">
         </div>
    </section>
Praveen Kumar
  • 199
  • 11

1 Answers1

0

Unfortunately, border-width cannot use a % value as any % is NOT related to size of the element.

So, basically...NO you can't use calc WITH % for border-width because it doesn't know what it's supposed to be a % of.

Arezou Saremian
  • 508
  • 3
  • 8