HTML - Getting Horizontal Menu To Not Wrap.
Hi folks, I have this menu (generated via menumatic), that needs to not wrap should users decrease the width of their browser too far (or if it does wrap..then I need the div to resize to fit the height properly which it currently does not).
Any tips/suggestions welcome The website url: (click the Available Items which will show the 2nd level menu in question (located in div id='promo') http://www.borrownet.com/ the CSS is as follows (from mm2.css): /* Based partially on Matthew Carroll's keyboard accessible flavor of Suckerfish * Dropdowns by Patrick Griffiths and Dan Webb. * http://carroll.org.uk/sandbox/suckerfish/bones2.html */ /* ----[ LINKS ]----*/ /* all menu links */ #nav a, #subMenusContainer a{ text-decoration:none; display:block; padding: 8px 10px; color: #000; font: 70%/90% arial; -moz-border-radius: 4px; -webkit-border-radius: 4px; } /* Just main menu links --[for non-javascript users this applies to submenu links as well]*/ #nav a{ margin:5; float:left; } /* Just sub menu links */ #subMenusContainer a, #nav li li a{ text-align:left; } /* All menu links on hover or focus */ #nav a:hover, #subMenusContainer a:hover { background-color:#90B557; color:#FFF; /* -moz-border-radius: 7px; -webkit-border-radius: 7px;*/ } /* sub menu links on hover or focus */ #subMenusContainer a:hover, #nav li a:hover { background-color:#B2D281; color:#000; } /* .subMenuParentBtn{ background: url(../img/arrow_right.gif) right center no-repeat; } .subMenuParentBtnFocused{ background: url(../img/arrow_right_over.gif) right center no-repeat; } .mainMenuParentBtn{ background: url(../img/arrow_down.gif) right center no-repeat; } .mainMenuParentBtnFocused{ background: url(../img/arrow_down_over.gif) right center no-repeat; } */ /* ----[ OLs ULs, LIs, and DIVs ]----*/ /* Submenu Outer Wrapper - each submenu is inside a div with this class - javascript users only */ .smOW{ display:none; position: absolute; overflow:hidden; /*the 2px left & right padding lets you have a 1px border on the ul or ol inside since overflow is set to hidden*/ padding:0px 4px; margin:0 0 0 -2px; } /* All ULs and OLs */ #nav, #nav ul, #nav ol, #subMenusContainer ul, #subMenusContainer ol { padding: 0; margin: 0; list-style: none; line-height: 1em; } /* All submenu OLs and ULs */ #nav ol, #nav ul, #subMenusContainer ul, #subMenusContainer ol { /*border around submenu goes here*/ -moz-border-radius: 4px; -webkit-border-radius: 4px; background-color:#90B557; border: 2px solid #C3D46A; top: 0px; left:0; z-index:8; } /* List items in main menu --[for non-javascript users this applies to submenus as well] */ #nav li { /*great place to use a background image as a divider*/ display:block; list-style:none; position:relative; float:left; } #subMenusContainer li{ list-style: none; } /* main menu ul or ol elment */ #nav{ display:block; position: absolute; list-style:none; margin:0 0 0 0; z-index: 5; text-align: center; display:block; } #subMenusContainer{ display:block; position:absolute; top:0; left:0; width:100%; height:0; overflow:visible; z-index:1000000000; } /* --------------------------[ The below is just for non-javscript users ]--------------------------*/ #nav li li{ float:none; } #nav li li a{ /* Just submenu links*/ position:relative; float:none; } #nav li ul { /* second-level lists */ position: absolute; width: 11em; margin-left: -1000em; /* using left instead of display to hide menus because display: none isn't read by screen readers */ margin-top:2.2em; } /* third-and-above-level lists */ #nav li ul ul { margin: -1em 0 0 -1000em; } #nav li:hover ul ul margin-left: -1000em; } /* lists nested under hovered list items */ #nav li:hover ul{ margin-left: 0; } #nav li li:hover ul { margin-left: 10em; margin-top:-2.5em;} /* extra positioning rules for limited noscript keyboard accessibility */ #nav li a:focus + ul { margin-left: 0; margin-top:2.2em; } #nav li li a:focus + ul { left:0; margin-left: 1010em; margin-top:-2.2em;} #nav li li a:focus {left:0; margin-left:1000em; width:10em; margin-top:0;} #nav li li li a:focus {left:0; margin-left: 2010em; width: 10em; margin-top:-1em;} #nav li:hover a:focus{ margin-left: 0; } #nav li li:hover a:focus + ul { margin-left: 10em; } Similar TutorialsUnfortunately I haven't quite solved this horizontal menu that I'm trying to get displayed correctly, just yet. This is my latest code: CSS Code: #headerNavMenuContainer { background: url('images/main_nav_bar2.gif') no-repeat center; float: left; height: 42px; width: 100%; margin: 0 auto; text-align: center; } #headerNavMenu ul { height: 42px; /* the height of the menu bar */ border: 1px solid #000; /* to make sure DIV displays at desired dimensions */ margin: 0 auto; /* i'm not entirely sure what 'auto' does */ text-align: center; /* i don't know how to center vertically in DIV */ } #headerNavMenu li { height: 42px; margin: 0 auto; display: inline; height: 100%; text-align: center; border-right: 1px solid #f00; list-style-type: none; } #headerNavMenu li a { height: 42px; margin: 0 auto; color: #000; text-decoration: none; } HTML Code: <div id="headerNavMenuContainer"> <div id="headerNavMenu"> <ul> <li><a href="#">Home</a></li> <li><a href="#">Products</a></li> <li><a href="#">Encyclopedia</a></li> <li><a href="#">Forum</a></li> <li><a href="#">The Truth</a></li> <li><a href="#">About Us</a></li> <li><a href="#">Contact</a></li> <li><a href="#">Publications</a></li> </ul> </div> </div> The pics below show what I currently have and what I'm trying to get to. I am working on a site with a CSS horizontal drop down menu. On my Contact Us page I added an office locations map that uses java script and links to MapsAlive.com. My menu only has one drop down category, but when testing it, the drop down stops where the office location map starts. Is there a way to make it so the menu is always on top? I am using Dreamweaver, so the menu is part of my template. Here is my code for the menu: <div id="outside"> <ul id="navigation-1"> <li><a href="index.html" title="Home" target="_self" >Home</a> </li> <li><a href="" title="Services" target="_self" >Services</a> <ul class="navigation-2"> <li><a href="air.html" title="Air" target="_self" >Air</a></li> <li><a href="altenergy.html" title="Alternative Energy" target="_self" >Alternative Energy</a></li> <li><a href="civil.html" title="Civil Engineering" target="_self" >Civil Engineering</a></li> <li><a href="environmental.html" title="Environmental" target="_self" >Environmental</a></li> <li><a href="health.html" title="Health & Safety" target="_self" >Health & Safety</a></li> <li><a href="solidwaste.html" title="Solid Waste" target="_self" >Solid Waste</a></li> </ul> </li> <li><a href="presentations.html" title="Presentations" target="_self" >Presentations</a> </li> <li><a href="aboutus.html" title="About Us" target="_self" >About Us</a> </li> <li><a href="careers.html" title="Careers" target="_self" >Careers</a> </li> <li><a href="contactus.html" title="Contact Us" target="_self" >Contact Us</a> </li> </ul> </div> Here is my code for the office locations map: <div id="mainContent" align="center"> <link rel="stylesheet" type="text/css" href="http://tour.mapsalive.com/3854/page1.css" /> <script type="text/javascript" src="http://tour.mapsalive.com/3854/mapsalive.js"></script> <script type="text/javascript">maClient.path="http://tour.mapsalive.com/3854/";</script> <script type="text/javascript" src="http://tour.mapsalive.com/3854/page1.js"></script> </div> I have attached a screenshot of how it looks in a browser so you can see what it is doing. I would appreciate any advice from anyone who can give me direction. Thanks, Tatter I thought for sure that after all the helped I've received so far (many thanks, btw) that I'd be able to setup a horizontal menu using UL/LIs with some CSS. I've studied many other sites that use horizontal menues this way and have tried to figure 'em out but no luck so far Here's my attempted code so far: CSS Code: #headerNavMenuContainer { background: url('images/main_nav_bar2.gif'); float: left; border: 1px solid #000; height: 42px; width: 100%; } #headerNavMenu ul { font-weight: 800; text-align: center; } #headerNavMenu ul a { border-right: 1px solid #dadada; color: #000; text-decoration: none; } HTML Code: <div id="headerNavMenuContainer"> <div id="headerNavMenu"> <ul> <li><a href="#">Home</a></li> <li><a href="#">Products</a></li> <li><a href="#">Encyclopedia</a></li> <li><a href="#">Forum</a></li> <li><a href="#">The Truth</a></li> <li><a href="#">About Us</a></li> <li><a href="#">Contact</a></li> <li><a href="#">Publications</a></li> </ul> </div> </div> So I'm doing a website with horizontal menu that is centered. The page is 100% width, and the menu can be with or without fixed width. The menu is fine otherwise, but the sub items are not next to each other. This is because they only align the width of their parent. However, I'd like them to be centered under their parent regardless of how many sub items there are (so ultimately they could be as wide as the whole menu, provided there were enough sub items). So in the code I now have, the 3 sub items align so that 2 are inline, and the 3rd is under them. These should be inline, stretching over the width of their parent's width. Thanks for the help! Code: <body> <div id="banner"> <div id="centeredmenu"> <ul> <li><a href="#">Item 1</a></li> <li><a href="#">Item with Sub</a> <ul> <li><a href="#">Sub Item 1</a></li> <li><a href="#">Sub 2</a></li> <li><a href="#">Long Sub Item 3</a></li> </ul> </li> <li><a href="#">Menu Item 3</a></li> </ul> </div> </div> </body> </html> Code: #banner { position: absolute; width: 100%; height: 100px; top: 0; } #centeredmenu { height: 55px; float:left; width:100%; overflow:hidden; position:relative; top: 0px; } #centeredmenu ul { float:left; clear: both; list-style:none; margin:0; padding:0; position: relative; left:50%; text-align:center; } #centeredmenu li { width: 180px; display:block; float:left; list-style:none; margin:0; padding:0; position:relative; right:50%; } #centeredmenu a { display:block; margin:0 0 0 0px; padding:0px 10px; background:#C03; color:#fff; text-decoration:none; } #centeredmenu ul ul { position: absolute; width: 100%; display: none; z-index: 400; } #centeredmenu ul ul li { position: relative; width: 50%; z-index: 500; } #centeredmenu ul li a:hover { background: #C03; color: #3FF; } #centeredmenu ul li:hover ul{ display: block; } Help!!!! I have been looking at this for almost 6 hours and I still can't explain why my horizontal menu wrapped using Firefox and not IE. I have firefox 3 installed and some of the categories (on the same tree) wrapped and some doesn't. But if i refresh it a few times, it become normal again. This make no sense. Maybe I need to get some fresh air because i am starting to see spots on the screen. http://208.84.114.15 I am designing a page w/ a horizontal menu and CSS (added in header). For some reason, IE7 dislikes what I am doing (the HOVER doesn't seem to be working...) but it works fine in Opera, FF and Safari . . Perhaps one of the pros here can take a look under the hood? I've been at it for hours and can't seem to find the bug(s)... http://www.huntandfishnj.com/Sterling-G/ Thanks and Best wishes, Xex Hi everyone. I'm new to HTML, so I've been reading a lot online and stuff but I haven't been able to find an answer to my question, so I figured I'd ask here since these forums looked really helpful. I have a mobile site where I have a link. The link is two words and I would like to force the link to wrap on to two separate lines. Am I able to do this? I haven't been able to find anything online like this. I would still like the link to work and everything. Any help and information would be greatly appreciated. Thanks Again, Hi all, I have a long text without any space inside it. I want that it wrapped by the browser. Which code should I use? Thanks in advance. Hi, My code: Code: <div style="width: 100px;"><table style="border-collapse: collapse;" border="0" cellpadding="4" cellspacing="0"> <tbody><tr> <td> <table border="0" cellpadding="0" cellspacing="0"> <tbody><tr> <td> <code><span style="color: rgb(0, 0, 0);"> <span style="color: rgb(0, 0, 187);">$username </span><span style="color: rgb(0, 119, 0);">= </span><span style="color: rgb(0, 0, 187);">$_POST</span><span style="color: rgb(0, 119, 0);">[</span><span style="color: rgb(221, 0, 0);">"username"</span><span style="color: rgb(0, 119, 0);">]; <br></span><span style="color: rgb(0, 0, 187);">$password </span><span style="color: rgb(0, 119, 0);">= </span><span style="color: rgb(0, 0, 187);">$_POST</span><span style="color: rgb(0, 119, 0);">[</span><span style="color: rgb(221, 0, 0);">"password"</span><span style="color: rgb(0, 119, 0);">]; <br></span><span style="color: rgb(0, 0, 187);">$result </span><span style="color: rgb(0, 119, 0);">= </span><span style="color: rgb(0, 0, 187);">mysql_query</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(221, 0, 0);">"SELECT * FROM members WHERE username = '$username' AND password = '$password';"</span><span style="color: rgb(0, 119, 0);">);</span> </span> </code><br> </td> </tr> </tbody></table> </td> </tr> </tbody></table></div> I have a DIV tag around the code which has style="width: 100px;" but for some reason the width is A LOT bigger. How to make it so that it will wordwrap? Problem: I have an image floated right, but my UL list appears below the image instead of next to it. I can get all text to wrap around my images except UL lists.. I have the image in a p tag & my UL list would show below it anyway .... The long way i think would be to place the image & UL list into 2 seperate divs like: 1) <div class="imgRight"><img>xxx/></div> use css to float right 2) div class="ulLeft"><ul>xxx</ul></div> use css to float left I have alot of pages with different size images & UL lists so im looking for the easy way out. here is my html <p><img class="floatRight" alt="" align="right" width="281" height="427" p="" src="...images/Photo_01.jpg" /></p> <p>SCQS Quantity Surveyors can provide full Estimating and Tendering solutions to all our clients, including Main Contractors, Sub-Contractors and Private Clients. Our coverage includes a wide variety of areas including residential, commercial, industrial, sports & recreation facilities, retail facilities and hotels etc...</p> <p>The services which we provide our clients with includes:</p> <h2>Estimating & Tendering for Main Contractors & Sub-Contractors</h2> <ul> <li>The Preparation and Submission of Competitive Tenders for Building Main Contractors and Sub-contractors for all Types & Value Ranges of Projects</li> <li>Negotiating and Tenders / Contracts with the Client's Quantity Surveyor for Agreement & Awarding of Contracts</li> </ul> <h2>Estimating & Tendering for Private Clients</h2> <ul> <li>Pre-Tender Price Estimating</li> <li>Advise on Tendering Procedures, Contractual Arrangements and Select Tenderers</li> <li>Preparation of Tender / Negotiation Documentation – (i.e. Bills of Quantities, Schedules of Rates and Contracts etc...)</li> <li>Tender Analysis</li> <li>Examination and Reporting on Tenders Received from Contractors</li> </ul> any help on the best possible way would be appreciated semaus Hi, I have a huge text that i need to display in a span tag on my page. Currently the words are breaking at the end of the line, i.e. if the word if "Understand" and there is not enough space to display the entire word, half of the word is displayed in the space available, and the remaining on the next line. However, i want that the entire word be displayed on the next line. Please suggest how this can be done. Regards, Ankit!! Hi, I'm working on an ecommerce website, my problem is that I cannot make some text in a cell wrap. Here's the details: The text in this particular cell is page numbers, and it is dynamically generated, so it changes depending on what the user selects in the shop. For example, if they are viewing a category that only has a couple pages of product, it's fine. But if they are viewing a category that has a couple hundred pages of product, the page number goes out horizontal in a straight line, and obviously causes some serious horizontal scrolling. I've tried setting a fixed width for the cell both in the <td> with width="whatever" and that didn't work, I tried setting it in the stylesheet with CSS but it still breaks the table. I just want it to wrap down a line when it gets to a certain width. Any ideas? I want to wrap a long line of text in a table for Firefox, IE 6, 7 and 8, Chrome and Opera. I try 'style="overflow:hidden; width:50px;' but the line is cut off. i.e. I see "longllllllllllllllllllllllllllllllllllllllllllll" but not "longlllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllong". Code: <table border="1" cellpadding="2" cellspacing="0" width="600" style='table-layout:fixed'> <col width=40> <col width=97> <tr valign="top"> <td align="center"><span class="Body2"><a href="index.jsp?ID=21">21<br>(22)</a></span></td> <td style="overflow:hidden; width:50px; max-width:50px;"><a style="text-decoration: none" href="index.jsp?ID=21"><span class="bodySmall">longlllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllong<br></span><span class="Body2"></span></a></td> </tr> </table> First of all hope this is the right forum. I need to know how to wrap text so it flows around this twitter widget that I would like to place on my site in the center of page http://knowingabout.co.uk/bestinhulme/index.html. I have tried the usual way for an image but it doesnt seem to work. Below is a image and below that the actual code. <div id="twtr-search-widget"></div> <script src="http://widgets.twimg.com/j/1/widget.js"></script> <link href="http://widgets.twimg.com/j/1/widget.css" type="text/css" rel="stylesheet"> <script> new TWTR.Widget({ search: 'Manchester', id: 'twtr-search-widget', loop: true, title: 'Who\'s tweeting about...', subject: 'Manchester', width: 250, height: 280, theme: { shell: { background: '#887640', color: '#ffffff' }, tweets: { background: '#f3d2a5', color: '#444444', links: '#1985b5' } } }).render().start(); </script> Thx in advance Hi, I need to wrap the text of button so that it fits in the button's fixed width and doesn't expand the button's width, only it's height. This can be done in a regular text using the WORD-BREAK:BREAK-ALL; attribute But I tried this on the button and it's not working? Is there any work around for that? any css attribut? Hello, I am trying to display an image on the bottom left corner of the text. The text is dynamic. Below is a sample code(the text below is going to be dynamic). Please Advice? <style> .imgst { float:left; text-align:right; overflow:hidden; } </style> <table width="471" border="0" cellspacing="0" cellpadding="0"> <tr><td> <span class="imgst"><img align="baseline" align="top" src="/images/adams.jpg" /></span> lwekjrwekj rweklrjwerl lwekjrwekj rweklrjwerllwekjrwekj rweklrjwerllwekjrwekj rweklrjwerllwekjrwekj rweklrjwerllwekjrwekj rweklrjwerllwekjrwekj rweklrjwerllwekjrwekj rweklrjwerllwekjrwekj rweklrjwerllwekjrwekj rweklrjwerllwekjrwekj rweklrjwerllwekjrwekj rweklrjwerllwekjrwekj rweklrjwerllwekjrwekj rweklrjwerllwekjrwekj rweklrjwerllwekjrwekj rweklrjwerllwekjrwekj rweklrjwerllwekjrwekj rweklrjwerllwekjrwekj rweklrjwerllwekjrwekj rweklrjwerl </td> </tr> </table> I am new to HTML and I need to know how to wrap code when it is too long and keeps going across the page. In VBA you use _. This will wrap the code and you can keep it looking neater. Please help!!! Hi there, I need some help with this page: I can't get the "In this section:" link list to go to the right of the body text of the page and have the body text wrap around it. I'm also having trouble getting all the different headings and paragraphs to work right -- even if I set the CSS to display:block; the different headings display as inline elements. To get around this I've had to assign them all a width of 860 px -- which I think might be contributing to the problem getting the link list to go to the right of the body text, but horizontally aligned with the top heading. Thanks for any help you can give! Michael |