# "Show more" button for a gallery on mobile, but a scrollable div everywhere else

**URL:** <https://forum.freecodecamp.org/t/show-more-button-for-a-gallery-on-mobile-but-a-scrollable-div-everywhere-else/263143>\
**Category:** Curriculum Help\
**Tags:** css, html\
**Created:** [March 6, 2019, 11:40am UTC](https://forum.freecodecamp.org/t/show-more-button-for-a-gallery-on-mobile-but-a-scrollable-div-everywhere-else/263143 "2019-03-06T11:40:17Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Codeissimple](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/codeissimple/32/111823_2.png) [@Codeissimple](https://forum.freecodecamp.org/u/Codeissimple)\
**Post date:** [March 6, 2019, 11:40am UTC](https://forum.freecodecamp.org/t/show-more-button-for-a-gallery-on-mobile-but-a-scrollable-div-everywhere-else/263143/1 "2019-03-06T11:40:17Z")

</div>

Guys, I’m stuck, could anyone help me out, please?

I’m building a books gallery, which should be responsive. That part I have covered.  
But I also want it to be scroll able only on wide devices, and on mobile/small display devices, I want to show only one picture, and have a button “show all books”.

I tried different solutions, but I can’t seem to have both things, if I manage to display the button, than it either stays on the same place on desktop, AND ruins the gallery by misplacing everything, or worse - it disappears on desktop and takes all content with it.

How can I create a “Show All” button after the first image in the gallery on mobile - 600px\<, and have a scrollable fixed-width block (div) everywhere else?

```auto

<div class="container" id="books">

<div class="container">
  <div class="grid">
    
    <div class="cell">
      <img src="http://lorempixel.com/200/300" class="book">
    </div>
    <div class="cell">
      <img src="http://lorempixel.com/200/300" class="book">
     </div>        
    <div class="cell">
      <img src="http://lorempixel.com/200/300" class="book">
    </div>
    <div class="cell">
      <img src="http://lorempixel.com/200/300" class="book">
    </div>
     <div class="cell">
      <img src="http://lorempixel.com/200/300" class="book">
    </div>
     <div class="cell">
      <img src="http://lorempixel.com/200/300" class="book">
    </div>
     <div class="cell">
      <img src="http://lorempixel.com/200/300" class="book">
    </div>
     <div class="cell">
      <img src="http://lorempixel.com/200/300" class="book">
    </div>
     <div class="cell">
      <img src="http://lorempixel.com/200/300" class="book">
    </div>
  </div>
</div>  
  </div>

```

CSS

```auto

.container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0 auto;
  max-width: 1200px;
  padding: 0 1rem;
}
.book {
  max-width: 100%;
}
.cell img {
  display: block;
}

@media screen and (min-width: 600px) {
  .container{
    overflow: auto;
    height: (70vh);
  }
  .grid {
    display: flex;
    flex-wrap: wrap;
    flex-direction: row;
  }
  .cell {
    width: calc(50% - 2rem);
  }
}

@media screen and (min-width: 1000px) {
  .container{
    overflow: auto;
    max-height: 80vh;
  }
  .cell {
    width: calc(33.3333% - 2rem);
  }
}

.cell {
  margin: 1rem;
}

```

---

<div class="post-metadata">

**Author:** ![jenovs](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jenovs/32/60963_2.png) [@jenovs](https://forum.freecodecamp.org/u/jenovs)\
**Post date:** [March 6, 2019, 4:55pm UTC](https://forum.freecodecamp.org/t/show-more-button-for-a-gallery-on-mobile-but-a-scrollable-div-everywhere-else/263143/2 "2019-03-06T16:55:58Z")

</div>

You mean like this: [https://codepen.io/jenovs/pen/qvRpQX](https://codepen.io/jenovs/pen/qvRpQX)

---

<div class="post-metadata">

**Author:** ![Codeissimple](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/codeissimple/32/111823_2.png) [@Codeissimple](https://forum.freecodecamp.org/u/Codeissimple)\
**Post date:** [March 7, 2019, 12:40am UTC](https://forum.freecodecamp.org/t/show-more-button-for-a-gallery-on-mobile-but-a-scrollable-div-everywhere-else/263143/3 "2019-03-07T00:40:56Z")

</div>

Than you!

My original goal was to build it using CSS only, but I asked also on Stackoverflow, as well as few webchats, and apparently, it really needs some JS.  
I have not learned JS yet.

---

<div class="post-metadata">

**Author:** ![jenovs](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jenovs/32/60963_2.png) [@jenovs](https://forum.freecodecamp.org/u/jenovs)\
**Post date:** [March 7, 2019, 5:12am UTC](https://forum.freecodecamp.org/t/show-more-button-for-a-gallery-on-mobile-but-a-scrollable-div-everywhere-else/263143/4 "2019-03-07T05:12:52Z")

</div>

No JS version: [https://codepen.io/jenovs/pen/BbWaPZ](https://codepen.io/jenovs/pen/BbWaPZ)

---

<div class="post-metadata">

**Author:** ![1-1](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/1-1/32/110348_2.png) [@1-1](https://forum.freecodecamp.org/u/1-1)\
**Post date:** [March 7, 2019, 6:41am UTC](https://forum.freecodecamp.org/t/show-more-button-for-a-gallery-on-mobile-but-a-scrollable-div-everywhere-else/263143/5 "2019-03-07T06:41:55Z")

</div>

I really need to learn how these things work…

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [March 9, 2021, 11:19am UTC](https://forum.freecodecamp.org/t/show-more-button-for-a-gallery-on-mobile-but-a-scrollable-div-everywhere-else/263143/6 "2021-03-09T11:19:03Z")

</div>

Closed on March 9, 2021, 11:19am UTC


