Dan Cundy
Dan Cundy

Reputation: 2859

How would i go about having a fixed header with a horizontally scrolling body?

Problem

I want to create a header which is fixed which i can do using CSS

#Header{
        position:fixed;
       }

However i can't seem to get the rest of the page to scroll horizontally!

This is my markup so far.

<div id="Header">

    <div class="title">
      <h1>Bass Clef Photography</h1>
    </div>
    <div class="tagline">Passion 4 Live Music & Passion 4 Photography</div>


  <div id="tabsContainer">
   <div class='tab zero'>
      <ul>
        <li><a href="BassClef.html">Home</a></li>
      </ul>
    </div>
   <div class='tab one'>
      <ul>
        <li><a href="#">Music Gallery</a></li>
      </ul>
    </div>
    <div class='tab two'>
      <ul>
        <li><a href="#">About</a></li>
      </ul>
    </div>
    <div class='tab three'>
      <ul>
        <li><a href="#">Clients</a></li>
      </ul>
    </div>
    <div class='tab four'>
      <ul>
        <li><a href="#">Contact</a></li>
      </ul>
    </div>
      <div class='tab five'>
      <ul>
        <li><a href="members.php">Members</a></li>
      </ul>
    </div>
  </div>

</div>

<div class="spacer"></div>
<div id="photoframe">
      <div class="pics"> <img src="uploads/picture01.jpg" alt=""></div>
      <div class="pics"><img src="uploads/picture02.jpg" alt=""></div>
        <div class="pics"><img src="uploads/picture03.jpg" alt=""></div>
        <div class="pics"><img src="uploads/picture04.jpg" alt=""></div>
         <div class="pics"><img src="uploads/picture05.jpg" alt=""></div>
      <div class="pics"> <img src="uploads/picture06.jpg" alt=""></div>
      <div class="pics"><img src="uploads/picture07.jpg" alt=""></div>
        <div class="pics"><img src="uploads/picture08.jpg" alt=""></div>
   </div>



   </div>
</body>

It's the div photoframe i wish to scroll horizontally. The tricky thing is the "photoframe" contains images that don't have a fixed width. so i don't want to set its CSS property with a fixed width, like so.

#photoframe
{
Width:1000px;
}    

Any help would be greatly appreciated!

Upvotes: 0

Views: 71

Answers (1)

allicarn
allicarn

Reputation: 2919

#photoframe {
    overflow-x: auto;
}

Put up a jsfiddle with what I think you were trying to achieve.

Upvotes: 2

Related Questions