0

On the snippet it looks pretty fine, but when I do this on my browser it doesn't work at all. When you resize the browser window to 500px or under, the text in the middle and right row are out of the container div I have, even though the container div's height is 100%, and I'm not too sure why the height is not increasing so as to fit the text in the middle and right 'row'. Below is the image, but notice the text is outside of the entire container. One last thing is I can't understand why the images are on different rows even though the flex basis for left is 100%. Both images should be in left and wouldn't that mean they'd be in the same row? I know on the image they're huge, but I just made them 80 pixels and I'm experiencing the same problem. It's as if the media query isn't working or something. I'm ultimately after a mobile version with three rows. First row has the two pictures, last two rows would just be text, and I'm looking for the middle column to be twice the height of the others, which is why I made it's flex grow 2.

enter image description here

* {
    margin: 0;
}

html,
body {
    height: 100%;
    background-color: green;
}



#bigwrap {
    position: relative;
    height: 100%;
}

.container {
    display: flex;
    //position: absolute;
    position: relative;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    height: 70%;
    width: 70%;
    margin: auto;
   // top: 40%;
    //left: 50%;
   // transform: translate(-50%, -50%);  /* http://stackoverflow.com/q/36817249/3597276 */
    background-color: white;
}

.left, .middle, .right{
    border-right: 1px solid blue;
}







.left {
    display: flex;
    flex-flow: column wrap;
    align-items: center;
    justify-content: space-around;
    order: 1;
    //background: red;
    flex: 1 20%;
    height: 100%;
}

.left img {
    max-width: 100%;
}

.middle {
    display: flex;
    flex-flow: column wrap;
    order: 2;
   // background: green;
    flex: 2 20%;
    height: 100%;
}

.right {
    text-align: center;
    order: 3;
    //background: yellow;
    flex: 1 20%;
    height: 100%;
}

.right .headbox{
    border-bottom: 1px solid orange;
    margin: auto;
    width: 60%;
    height: auto;
}

.right .list{
    text-align: center;
    margin: auto;
    width: 60%;
    height: auto;
}

.list ul{
    list-style: none;
    padding: 0;
}

.list a{
    text-decoration: none;
    color: inherit;
}

.headbox h3{
    color: orange;
}


/*
@media screen and (min-width: 600px) {
    .container {
        flex-wrap: nowrap;
    }
    .left {
        flex-basis: 20%;
        flex-grow: 1;
        order: 1;
    }
    .middle {
        flex-basis: 20%;
        flex-grow: 2;
        order: 2;
    }
    .right {
        flex-basis: 20%;
        flex-grow: 1;
        order: 3;
    }
}

*/

@media all and (max-width: 500px) {

  .container {
    flex-flow: row wrap;
    height: 100%;
    
  }
  .left img {

    height: 80px;
    width: 80px;

  }

  .left, .right, .middle {
    flex: 1 100%;
  }

}
    <div id="bigwrap">


   
       <div class="container">
        <div class="left">
            <img src="cat1.jpeg" alt="Picture of kid">
             <img src="cat1.jpeg" alt="Picture of kid">
            
           
        </div>
        <div class="middle">
            <div class="box">
              <p>
                 Sample text. Sample text. Sample text. Sample text. Sample text. Sample text. Sample text. Sample text. Sample text.
                 Sample text. Sample text. Sample text. Sample text. Sample text.  Sample text. Sample text. Sample text. Sample text.
              </p>


            </div>

              <div class="box">
              <p>
                Sample text. Sample text. Sample text. Sample text. Sample text. Sample text. Sample text. Sample text. Sample text.
                 Sample text. Sample text. Sample text. Sample text. Sample text.  Sample text. Sample text. Sample text. Sample text.
             </p>

             </div>
            
            <div class="box">
            <p>
               Sample text. Sample text. Sample text. Sample text. Sample text. Sample text. Sample text. Sample text. Sample text.
               Sample text. Sample text. Sample text. Sample text. Sample text.  Sample text. Sample text. Sample text. Sample text.
            </p>
              


            </div>

        </div>

        <div class="right">
            <div class="headbox">
                <h3>Visit Us</h3>
              
            </div>

            <div class="list">
                   <ul>
                       <li><a href="#">Home</a></li>
                       <li><a href="#">Hours</a></li>
                       <li><a href="#">Plan</a></li>
                       <li><a href="#">Directions</a></li>

                   </ul>
            </div>


            
            

        </div>
    </div>

</div>
Shinji-san
  • 971
  • 4
  • 14
  • 31
  • Please post actual images in the code so we can reproduce the problem. – Michael Benjamin Jul 21 '16 at 03:58
  • Ok here we go https://jsfiddle.net/79u7p1g0/ Try resizing the browser smaller to see the problem I'm getting. I'm experiencing the same issue, only my text is not passing the blue border, it's just going straight down outside of the white background which is the container div. – Shinji-san Jul 21 '16 at 04:29
  • Take a look at [**these posts**](https://www.google.com/search?q=css+container+height+100%25+viewport+cut+off&oq=css+container+height+100%25+viewport+cut+off&aqs=chrome..69i57.1453j0j4&client=ms-android-att-us&sourceid=chrome-mobile&ie=UTF-8). – Michael Benjamin Jul 21 '16 at 06:17
  • Thanks @Michael_B it works. Do you know what I'm doing wrong with my images though? If you make the images even a small amount like 80 x 80px and make flex: 1 50% for the '.left' column, the images are still not sharing a row, they're wrapping regardless of their size, and every where I look that's how they do it but I'm still facing the issue. Also if you try flex-wrap: nowrap for .left that still doesn't work. I know that container is set for wrap but .left is also a flexbox and I thought setting nowrap should do the trick but I guess not. – Shinji-san Jul 21 '16 at 12:01

0 Answers0