HighDots Forums  

Horizontal list with no wrapping

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss Horizontal list with no wrapping in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Nathan
 
Posts: n/a

Default Horizontal list with no wrapping - 02-27-2006 , 07:07 PM






I am trying to prevent a horizontal list from wrapping. Each list item
is floated with "float: left".

Currently I use an ugly hack. I set the width of the list to a large
number which is guananteed greater than the total width of all items.

Is there a way to accomplish this without my hack? It would be handy
because I would like to read the total width of all items in
javascript. I looked into white-space: nowrap, but it doesn't work on
floats obviously. I also do not want to use tables.

Any help would be greatly appreciated,

Nathan


Reply With Quote
  #2  
Old   
Chris Beall
 
Posts: n/a

Default Re: Horizontal list with no wrapping - 02-27-2006 , 08:50 PM






Nathan wrote:
Quote:
I am trying to prevent a horizontal list from wrapping. Each list item
is floated with "float: left".

Currently I use an ugly hack. I set the width of the list to a large
number which is guananteed greater than the total width of all items.

Is there a way to accomplish this without my hack? It would be handy
because I would like to read the total width of all items in
javascript. I looked into white-space: nowrap, but it doesn't work on
floats obviously. I also do not want to use tables.

Any help would be greatly appreciated,

Nathan

Nathan,

The use of float: left pretty much guarantees that the items will wrap,
so you could remove that to start. But if the list is inline text it
will wrap anyway.

The best way to present a problem like this is to upload the HTML and
CSS to a server somewhere an give us the URL. That way we can see ALL
that you are doing (including stuff you might have considered to be
irrelevant), and can copy and modify your work to try various solutions.

It also helps to know WHY you want to do what you want. In this case, I
have no idea why you would want to 'read the total width of all items in
javascript'. If we knew why you want to do that, we might be able to
come up with a more elegant solution (especially given that JavaScript
works only when the user has enabled it).

Chris Beall



Reply With Quote
  #3  
Old   
Stephen Poley
 
Posts: n/a

Default Re: Horizontal list with no wrapping - 02-28-2006 , 10:43 AM



On 27 Feb 2006 21:23:59 -0800, "Nathan" <nathan.funk (AT) gmail (DOT) com> wrote:

Quote:
I've put up at page at

http://nathanfunk.dyndns.org/pland/wrapping/

demonstrating the undesired wrapping as well as the desired result
(code attached to this post). The desired result is accomplished by
specifying a large width "width: 2000px;" which is not an elegant way
of solving the problem.
"Not Found. The requested URL /pland/wrapping/ was not found on this
server."

--
Stephen Poley

http://www.xs4all.nl/~sbpoley/webmatters/


Reply With Quote
  #4  
Old   
Jim Moe
 
Posts: n/a

Default Re: Horizontal list with no wrapping - 02-28-2006 , 11:31 AM



Nathan wrote:
Quote:
I've put up at page at

http://nathanfunk.dyndns.org/pland/wrapping/

You mean <http://nathanfunk.dyndns.org/pland/horiz-list/>?
You can use a percentage width for #navcontainer as well. Then it
adjusts with the viewport.
But why do you need to know the width of the unclipped menu?

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)


Reply With Quote
  #5  
Old   
Nathan
 
Posts: n/a

Default Re: Horizontal list with no wrapping - 02-28-2006 , 01:13 PM



Sorry - wrong link. Good link:

http://nathanfunk.dyndns.org/personal/wrapping

Nathan


Reply With Quote
  #6  
Old   
Nathan
 
Posts: n/a

Default Re: Horizontal list with no wrapping - 02-28-2006 , 01:15 PM



I am scrolling the menu left and right by changing the relative
position of the list. In order to know where to stop the scrolling, I
need to know total width of the items.

Nathan


Reply With Quote
  #7  
Old   
Stephen Poley
 
Posts: n/a

Default Re: Horizontal list with no wrapping - 02-28-2006 , 02:01 PM



On 28 Feb 2006 11:13:33 -0800, "Nathan" <nathan.funk (AT) gmail (DOT) com> wrote:

Quote:
Sorry - wrong link. Good link:

http://nathanfunk.dyndns.org/personal/wrapping

Nathan
Well, I see from your answer to Jim that this is for a menu. Speaking as
a user I would much prefer a menu that wraps so that I can see what the
available options are without having to scroll backwards and forwards.
Why do you think that your visitors want to scroll?

--
Stephen Poley

http://www.xs4all.nl/~sbpoley/webmatters/


Reply With Quote
  #8  
Old   
Nathan
 
Posts: n/a

Default Re: Horizontal list with no wrapping - 02-28-2006 , 02:11 PM



I am writing the code on a contract basis and am not making many
decision about functionality myself.

So the question remains whether there is an elegant way of preventing
the list from wrapping. From the responses so far I conclude there is
probably not.

Waiting for CSS4...

Nathan


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.