-2

I'm codding new website. How to code this layout? I need a full-width header, but one side is gradient (4 cols) and another is white (8 cols). Layout: https://i.stack.imgur.com/tN2Ec.png

I could use a flexbox, but I can't put a bootstrap grid inside it.

Ivan Ivanov
  • 1
  • 1
  • 4

2 Answers2

0
<div class="header"></div>

just use linear-gradient like this

.header {
  background: linear-gradient(
   to right,
   #ff9e2c 0%,
   #ff9e2c 50%,
   #b6701e 50%,
   #b6701e 100%
  );
  height: 100%; //what height or width u want
  width: 100%;
}


</style>

enter image description here

use can use it like

  background: linear-gradient(
   to right,
   #ff9e2c 0%,
   #b6701e 50%,
   #b6701e 100%
  );

too but effect change

enter image description here

0

You have create col-4 and col-8 in your header and apply background individually. If you apply gradient to your header without column it'll create problem for you in different resolutions. I create a very basic example for you, i hope it'll help you out. Thanks

.white-bg {
 background-color: #fff;
}
.gradient-bg {
 background-image: linear-gradient(red, yellow);
}
<!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">

<header>
 <div class="row">
  <div class="col-4 gradient-bg">Gradient Background</div>
  <div class="col-8 white-bg">White Background</div>
 </div>
</header>
Hassan Siddiqui
  • 2,799
  • 1
  • 13
  • 22