I want to set half background using color in html


.bg_color {
  width: 100vw; /* view width */
  height: 100vh; /* view height */
  padding: 1rem;
  -webkit-box-sizing: border-box;
          box-sizing: border-box;
  Create the diagonal line in the background by setting each color to take 
  up 50% of the space. Setting the break points to 49.9% and 50.1% will minimize 
  the jagged line that is created if gradient colors were to be set to 50%/50%. 
  background-image: -webkit-gradient(linear, right bottom, left top, color-stop(49.9%, #000000), color-stop(50.1%, #1DA1F2));
  background-image: -webkit-linear-gradient(bottom right, #000000 49.9%, #1DA1F2 50.1%);
  background-image: -o-linear-gradient(bottom right, #000000 49.9%, #1DA1F2 50.1%);
  background-image: linear-gradient(to top left, #000000 49.9%, #1DA1F2 50.1%);
<div class="bg_color">
  <h1>Half Background</h1>

I want to set half background like thisenter image description here

in my code, I want to add half the background using color code I have tried following the code but I can’t understand how to set it properly!


i hope this is what your finding

div {
  width: 100vw;
  height: 100vh;
  position: relative;
  /* Permalink - use to edit and share this gradient: https://colorzilla.com/gradient-editor/#6b43fc+0,6b4dc2+100 */
background: #6b43fc; /* Old browsers */
background: -moz-linear-gradient(left,  #6b43fc 0%, #6b4dc2 100%); /* FF3.6-15 */
background: -webkit-linear-gradient(left,  #6b43fc 0%,#6b4dc2 100%); /* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to right,  #6b43fc 0%,#6b4dc2 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#6b43fc', endColorstr='#6b4dc2',GradientType=1 ); /* IE6-9 */

div::after {
  position: absolute;
  content: '';
  top: 50%;
  left: 0;
  right: 0;
  bottom: 0;
  background: #000;
  border-top-left-radius: 80px 40px;

Answered By – khushi

Answer Checked By – Marie Seifert (AngularFixing Admin)

Leave a Reply

Your email address will not be published.