-1

i need a solution guys, i want the two boxes in pink and white to have same height as its parent container in blue box (that is to stop where that blue box stopped) without depending on the content of the div in pink and white boxes. here is my fiddle code https://jsfiddle.net/dcq4bufa/3/

my HTML CODE

<head>
  <title>eco</title>
</head>
<body>
  <header class="header">
    <ul class="nav">
      <li class="nav-items">HOME</li>
      <li class="nav-items">APP</li>
      <li class="nav-items">STORE</li>
   </ul>

   <div class="home">
     <div class="home__right">
       <p class="paragraph">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Sapiente nemo 
     aliquid saepe tempora doloribus dicta quas aperiam, eius odio ipsa culpa ipsam rerum quam vero 
        itaque, recusandae sint perferendis ipsum.</p>
      <h1 class="home__right--sub"> tenetur quidem ducimus quod odit totam, dolor</h1> 
     </div>
     <home class="home__left">
       <h1 class="paragraph">Lorem ipsum dolor sit amet, consectetur ad</h1>
     </home>
   </div>
  </header>
</body>

2 Answers2

0

First you must outline the height of the parent container(blue),then set the two children elements(pink and white)height of 100% since they are in a container that is 100 of your device height.Try this:

.home {
  display: flex;
  height:100vh;

  &__right {
    background-color: pink;
    height:100%;
    flex-basis: 50;

  }

  &__left {
    background-color: white;
    height:100%;
    flex: 1;

  }

}

You can adjust the height of .home if you are not comfortable with the overflow

Robinson Ngecu
  • 168
  • 2
  • 6
0

If you can use flexbox, you may do the following:

.header {
  height: 80vh;
  background-color: blue;
  /* Add flexbox */
  display: flex;
  flex-direction: column;
}

.home {
  display: flex;
  flex: 1; /* Set flex-grow: 1 */
  ...
yinsweet
  • 2,823
  • 1
  • 9
  • 21