html - efficient and responsive way of text alignment bottom -


i trying position"the answer thee" text bottom of page, works.

the problem arises when resize screen "big text" , "answer text" falls out of alignment "big text" element full height (depending on text amount). "answer text" not set height responsive height depending on size of content area "big text"

link fiddel here

html

<head>   <link href="https://get.gridsetapp.com/35679/" rel="stylesheet" /> </head>  <li class="aside-open-close active">   <a class="aside-opener" href="#">q1. question here.</a>   <div class="slide">     <div class="columns">        <div class="d1-d3">         <p>one</p>         <p>two</p>         <p>three</p>         <p class="answer-box">three - answer three</p>       </div>        <div class="d4-d6 grey-border">         <p>big text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text           herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig           text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig           text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig           text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig           text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig           text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig text herebig           text herebig text herebig text herebig text herebig text here</p>       </div>      </div>   </div> </li> 

css

.aside-opener {   font-size: 16px !important;   font-weight: 600 !important; }  .answer-box {   display: flex;   align-items: flex-end;   /* width: 100%; */   height: 290px; }  .grey-border {   border: 1px solid rgba(68, 68, 68, .54);   margin-top: 15px; }  .grey-border p {   padding: 0 10px 0 10px;   font-size: 16px;   font-weight: 600;   line-height: 19px; } 

the image bellow correct, got set height, need height responsive or 100%

enter image description here

you need nested flexbox columns.

nested child 'sectionsinside yourlineeds flex-container withflex-direction:column`.

the .columns section given display:flex (each child flex:1) children queal height.

once have achieved can push final paragraph (answer text) bottom of column margin-top:auto.

* {    margin: 0;    padding: 0;  }  li {    display: flex;    flex-direction: column;  }  .slide {    flex: 1;    display: flex;    flex-direction: column;  }  .columns {    flex: 1;    display: flex;  }  .d1-d3 {    flex: 1;    display: flex;    flex-direction: column;  }  .aside-opener {    font-size: 16px !important;    font-weight: 600 !important;    background: lightgrey;  }  .answer-box {    margin-top: auto;    text-align: right;  }  .grey-border {    border: 1px solid rgba(68, 68, 68, .54);    flex: 1;  }  .grey-border p {    padding: 0 10px 0 10px;    font-size: 16px;    font-weight: 600;    line-height: 19px;  }
<ul>    <li class="aside-open-close active">      <a class="aside-opener" href="#">q1. question here.</a>      <div class="slide">        <div class="columns">            <div class="d1-d3">            <p>one</p>            <p>two</p>            <p>three</p>            <p class="answer-box">three - answer three</p>          </div>            <div class="d4-d6 grey-border">            <p>lorem ipsum dolor sit amet, consectetur adipisicing elit. aspernatur labore qui tenetur officia, hic illum fugit deleniti</p>          </div>          </div>      </div>    </li>  </ul>

jsfiddle demo


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -