CongdonJL
CongdonJL

Reputation: 139

horizontal scrolling website

I am trying to make a horizontal scrolling website and I want the divs to float to the right which I can do. But I don't want to have to define the width of the container because it could be different on different pages.

Any Ideas?

Upvotes: 0

Views: 636

Answers (3)

LightningWrist
LightningWrist

Reputation: 937

make a container that holds your divs.It seems to me that you should float all of those divs left.

<div id="container">
  <div class="floater_divs">
  </div>
  <div class="floater_divs">
  </div>
</div>

#container { width:100%; other stuff you want etc...}
.floater_divs { float:left; other stuff you want etc...}

If you want the floater divs to have different rules, then just make new classes or id's.

Upvotes: 0

Patcouch22
Patcouch22

Reputation: 912

Your best bet might be to use a javascript library (such as jquery) to check for the widths of columns you have, and set the container to the sum of the widths of the columns.

Upvotes: 0

richzilla
richzilla

Reputation: 41972

Firstly, its generally inadvisable to have a website that requires scrolling side to side. Its an unusual movement (users dont come across it very much) and users tend not to like doing it.

To actually answer your question, the only method other than setting a fixed width onto your container is a percentage width, that way you can set it to be the same size (proportionally) for every user. Alternatively, if you dont want to put on a fixed width at all, just leave it. The container will automatically expand to size of whatever you fill it with.

Upvotes: 6

Related Questions