473,839 Members | 1,527 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how can one prevent a horizontal list from breaking?

9 New Member
Hi all, i am looking for a way to prevent a horizontal, inline unordered list from breaking into seperate lines once contained inside a element with specific width (shorter than the list). the element has "overflow" set to "hidden".

the only way i found to create that effect is by giving a specific width to the "UL" element but now, i have to create that effect for a list with unknown width!! (user can add items to list). is there any other way? it would help me so much!!

thank you all
Jul 13 '10 #1
10 23758
TheServant
1,168 Recognized Expert Top Contributor
Can you give an example of some (shortened) code of you current HTML and CSS? Also a screenshot if you think it would help.
Jul 13 '10 #2
crippletoe
9 New Member
i will try to post a link to an example page but consider this code in the meanwhile:
HTML:
Expand|Select|Wrap|Line Numbers
  1. <div id="container">
  2. <ul id="list">
  3. <li>item1</li>
  4. <li>item2</li>
  5. <li>item3</li>
  6. <li>item4</li>
  7. <li>item5</li>
  8. <li>item6</li>
  9. <li>item7</li>
  10. </ul>
  11. </div>
  12.  
CSS:
Expand|Select|Wrap|Line Numbers
  1. #container{
  2. width: 200px;
  3. overflow: hidden;
  4. }
  5. #list{
  6. display: inline;
  7. }
  8.  
  9. #list li{
  10. float: left;
  11. }
  12.  
the list is horizontal and if it is wider than the width of the <div> it will break and continue on a new line.
i would like it to go on on the same line beyond the border of the #container DIV.
Jul 13 '10 #3
zorgi
431 Recognized Expert Contributor
If you give #container a height and overflow will be hidden.
Jul 13 '10 #4
crippletoe
9 New Member
i am afraid this does not prevent the UL from breaking it will simply hide the vertical overflow caused by the line breaking.
Jul 14 '10 #5
zorgi
431 Recognized Expert Contributor
Thats how I understood your problem. What exactly are you trying to achive if not to hide overflow?
Jul 14 '10 #6
crippletoe
9 New Member
i am trying to create a horizontal scroller on the container div. overflow will be set to auto than but i cannot even get to that stage because the list keeps breaking to a new line when it reaches the border of the div and so there is no need for the horizontal scroller..
Jul 14 '10 #7
JKing
1,206 Recognized Expert Top Contributor
Expand|Select|Wrap|Line Numbers
  1. #container{
  2. width: 200px;
  3. overflow-y:hidden;
  4. overflow-x:scroll;
  5. white-space:nowrap;
  6. }
  7. #list{
  8.  
  9.  
  10.  
  11. }
  12.  
  13. #list li{
  14. display: inline;
  15.  
  16. }
Is this what you are looking for?
Jul 14 '10 #8
zorgi
431 Recognized Expert Contributor
similar :


Expand|Select|Wrap|Line Numbers
  1.  
  2. #container{
  3.     width: 200px;
  4.     overflow: auto;        
  5. }
  6. #list{
  7.     white-space:nowrap;
  8.     padding: 0;
  9.     margin: 0;
  10. }
  11. #list li{
  12.     display: inline;
  13. }
  14.  
  15.  
Jul 14 '10 #9
crippletoe
9 New Member
@JKing
doesnt work. still breaks to a new line.
Jul 14 '10 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

1
5020
by: RugbyTravis | last post by:
I want to have a list that is horizontal and each <li> has different images. I also want them to change on hover. I want the words to be below the images as well. Anyone of you styles gurus have any words of wisdom? Please! :-) Here is what I have so far. <!--styles--> ul#mainNav{ font: bold 80% Verdana;
6
2391
by: ciwstudy | last post by:
I'm having problems getting the height to compress for a horizontal list in IE (styled with CSS). It works fine in other browsers. Does anyone know a way to fix this? http://www.uky.edu/Home/Web/newnavbar/
8
13880
by: Nathan | last post by:
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...
1
1702
by: DarthDevilous | last post by:
I've been trying to lay out a list horizontally, like at http://www.w3schools.com/css/tryit.asp?filename=trycss_float5 , but I'm having some problems. The HTML Structure is <div id="page_footer"> <ul id="categories"> <li><div class="category"> Home <ul> <li><a>somelink</a></li> etc
9
3346
by: Verona Busch | last post by:
Hi everybody, I am very happy to find this group. I am searching for a solution to make a horizontal list menu with submenu on hover. I found a lot of examples for horizontal lists which open vertical lists on :hover i.e. http://phoenity.com/newtedge/horizontal_nav/ But what I am looking for is a horizontal list that opens another horizontal list and both need to be right-floated.
1
1639
by: irq3 | last post by:
I want to make a horizontal list elements, whose widths are determined by their "width" property. "width" doesn't work on inline elements, so I can't use <spanas I normally would if the width was determined by content. I played around with float: left, display: block, position: absolute, trying to get them to work properly and I've had some level of success, but I'm looking for some advice from the gurus on how to do this properly.
1
6183
by: nitinpatel1117 | last post by:
i am using an unordered list to display my horizontal navigation. i am using something link <ul> <li>link 1</li> <li>link 2</li> </ul>
1
5500
by: Jason | last post by:
I have an application that sends HTML emails. The HTML is basically a template that I provide, but part of the HTML is supplied by the user. Sometimes the user inadvertently supplies HTML which cause the the email recipient to have to scroll horizontally to see it. Is there any tag that I can use in my template to enclose the user HTML to make sure that doesn't happen? I've tried enclosing it in <table width="100%"but that doesn't...
1
1698
by: icancreate | last post by:
Anyone know how I can achieve the following. I want to place an animated banner into my homepage that extends beyond the width of the viewing area in the web browser without the browser displaying a horizontal scroll bar. Any ideas? My homepage is centered in the browser window with a fixed width of 960pixels wide.
0
9856
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10913
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10592
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9434
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7834
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7022
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5684
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4495
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3136
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.