0

In this case, the dynamic banner appears in some cases only. I have to put the Box div (angular component) at the end of the screen view but due to less height of its container, I am unable to do so. I tried setting the height to 100% which results in appearing the Box out of the screen. Just need a sample code for this layout so I can put it in my design. I have tried setting Box to bottom: 0, position: absolute but no luck.

enter image description here

2 Answers 2

0

You can make the Box parent a flex container and position it's children at the flex-end.

.parent {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

See example below:

.parent {
  width: 200px;
  height: 150px;
  background-color: blue;
  padding: 20px;
  
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.box {
  background-color: red;
  height: 50px;
  width: 100%;
}
<div class="parent">
  <div class="box"></div>
</div>

0

Try this:

*{
  box-sizing: border-box;
}
body{ 
  padding:10px;
}

.div-wrapper{
  border:1px solid #000;
  padding: 20px;
}

.banner{
  min-height:100px;
  line-height:100px;
  background: crimson;
  color:#fff;
  text-align:center;
  border:2px solid green;
  margin-bottom:20px;
}

.content-wrapper{
  border:2px solid green;
  height:auto;
  display:flex;
  padding:20px;
  gap:20px;
}

.left-box,
.right-box{
  padding:20px;
  border:2px solid dodgerblue;
  width:50%;
}

.right-box{
  min-height:300px;
  position:relative;
  display:flex;
  flex-direction:column;
  justify-content:flex-end;
}

.right-box .box{
  width:100%;
  height:50px;
  background: royalblue;
}
<div class="div-wrapper">
  <div class="banner">
    BANNER
  </div>
  <div class="content-wrapper">
   <div class="left-box">
   </div>
   <div class="right-box">
      <div class="box">
      </div>
   </div>
  </div>
</div>

1
  • Could you add to this some information about your approach? How does this solve the problem at hand? What is the main point that future readers could learn from your answer? (If you can do that for all answers, so much the better).
    – halfer
    Commented Feb 4, 2023 at 14:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.