Another Kind Of Css Background Float Trouble - now with a <ul>

free web hosting
Open Discussion > CONTRIBUTE > Computers > Programming Languages > CSS (Cascading Style Sheets)

Another Kind Of Css Background Float Trouble - now with a <ul>

Tyssen
How'd you manage to post a topic with no real content? blink.gif

Reply

Lozbo
i dont know what happened, i did posted my content, anyway if a mod sees this can it be fixed? heres what i wanted to post:

-->

Hope you guys dont mind hehe, i now have another problem (as i did happen to solve the last one about floating)...

This one is about a horizontal menu (based on sucker fish menu from ala (a list apart), inside a containing div... the html is like this:

HTML
<div id="main_menu">
<ul>
<li>Menu Item
<ul>
<li>...</li>
<li>...</li>
<li>...</li>
</ul>
</li>
</ul>


Basically, (of course, with aditional items) this is my menu... and the css:

CODE

div#main_menu ul li {
float:left;
position:relative;
width:10em;
}


And other stuff that sets the menu, but what i want is to add a consistent color for all the menu and of course, as some one told me in the last tread about the floating trouble, the floats are not in the normal flow of the document, so they dont have a reference of where to show its background...

So unless i add a background to each li (becouse even the ul wont show a background), i cant have a color... And what i need is that the containing div (in this case, div#main_menu) shows a background for all the horizontal block where it displays the menu, so that it fits the wide window where its laid...

Aditionally, i notice that by resizing the browser, this particular structure of menu, stops showing the content of the submenu if the window gets too small (horizontally), and the content is fit to the window, so its always showing all of the first menu items, dont know if you understand me, but i dont want the content to stay within the visual part of the browser, i want it to overflow vertically so that it can always show the submenu, if some one has done this tutorial or read it on the above link from a list apart i would apreciate...

Thanks a lot!

 

 

 


Reply

nelimitat
I have used this piece of code in this topic and I like it. You could impove it more but for the beginning it's enough good.

More people should start posting tutorials becaise they are very interesting.

Reply

Lozbo
hehe... this is not a tutorial tongue.gif but good that it works for you, ill post all the css as Tyssen sugested me for you guys to know what im doing...

CSS:
CODE

div#main_menu     {border-bottom:1px solid white;margin:0;font-size:1.1em;background:#2C4554;width:100%;padding:0 20px;}
div#main_menu ul    {padding:0;margin:0;list-style:none;}
div#main_menu li    {background:#2C4554;}
div#main_menu ul a    {width:100%;display:block;}
div#main_menu ul a:link   {color:white;text-decoration:none;padding:5px 0;}
div#main_menu ul a:hover  {background:#296081;}
div#main_menu ul li    {float:left;position:relative;width:10em;}
div#main_menu li ul    {display:none;position:absolute;top:1em;left:0;color:white;text-align:left;margin:0;font-size:.9em;}
div#main_menu li ul a   {color:white;width:100%}
div#main_menu li ul a:link  {padding:0;}
div#main_menu li>ul    {top:auto;left:auto;}
div#main_menu li:hover ul  {display:block;}


The html is just a ul with several sub lists, but i know its good becouse its xhtml valid, besides i made it up with dreamweaver so the markup is good, the problem is that i want a background in this color behind ul... and the css is also good, i checked it with the validator...

Thanks!

Reply

Tyssen
In cases like these, a link to an actual page is much better than just your code because it's hard to tell which bit you actually want colour applied to. Presumably, you've got two levels of menus, but you don't say which one has the problem with the colour or in which browser you're getting the problem.

Reply

Lozbo
Alright then... im trying it here:

http://www.avoid.trap17.com/right.php

Thanks... here's the whole deal..

-10730

Reply

Tyssen
Sorry for not getting back sooner, but try this:

CODE
#main_menu ul {
  padding: 0px;
  height: 25px;
  margin: 0;
  background-color: #2C4554;
  color: #FFF;
  font-family: arial, helvetica, sans-serif;
  clear: left;
  list-style: none;
}
#main_menu li, li li { float: left; }
#main_menu ul li a {
  display: block;
  height: 18px;
  width: 8.5em;
  padding: 0.2em 1em;
  background-color: #2C4554;
  color: #FFF;
  text-decoration: none;
  border-right: 1px solid #fff;
}
#main_menu ul li a:hover {
  background-color: #547CA8;
  color: #fff;
}
#main_menu li ul {
  position: absolute;
  width: 8.5em;
  left: -999em;
}

#main_menu li li {
  position: relative;
  width: 8.5em;
  left: 0;
  border-top: 1px solid #FFF;
}
#main_menu li li a {
  width: 8.5em;
  height: auto;
  font-size: 85%;
  color: #FFF;
}
#main_menu li li a:hover {
  color: #FFF;
  background: #547CA8;
}
/* lists nested under hovered list items */
#main_menu li:hover ul, #main_menu li.sfhover ul { left: auto; }

(I've changed some of the colours cos I cut & pasted from somewhere else.)
Also, to get it to work in IE, you need this in the <head> section:

CODE
<script type="text/javascript">
sfHover = function() {
 var sfEls = document.getElementById("main_menu").getElementsByTagName("LI");
for (var i=0; i<sfEls.length; i++) {
 sfEls[i].onmouseover=function() {
  this.className+=" sfhover";
 }
 sfEls[i].onmouseout=function() {
  this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
 }
}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);
</script>

Reply

henwolf
QUOTE(Lozbo @ Oct 26 2005, 01:53 AM) *

i dont know what happened, i did posted my content, anyway if a mod sees this can it be fixed? heres what i wanted to post:

-->

Hope you guys dont mind hehe, i now have another problem (as i did happen to solve the last one about floating)...

This one is about a horizontal menu (based on sucker fish menu from ala (a list apart), inside a containing div... the html is like this:

HTML
<div id="main_menu">
<ul>
<li>Menu Item
<ul>
<li>...</li>
<li>...</li>
<li>...</li>
</ul>
</li>
</ul>


Basically, (of course, with aditional items) this is my menu... and the css:

CODE

div#main_menu ul li {
float:left;
position:relative;
width:10em;
}


And other stuff that sets the menu, but what i want is to add a consistent color for all the menu and of course, as some one told me in the last tread about the floating trouble, the floats are not in the normal flow of the document, so they dont have a reference of where to show its background...

So unless i add a background to each li (becouse even the ul wont show a background), i cant have a color... And what i need is that the containing div (in this case, div#main_menu) shows a background for all the horizontal block where it displays the menu, so that it fits the wide window where its laid...

Aditionally, i notice that by resizing the browser, this particular structure of menu, stops showing the content of the submenu if the window gets too small (horizontally), and the content is fit to the window, so its always showing all of the first menu items, dont know if you understand me, but i dont want the content to stay within the visual part of the browser, i want it to overflow vertically so that it can always show the submenu, if some one has done this tutorial or read it on the above link from a list apart i would apreciate...

Thanks a lot!


Hi Lozbo

I have this problem with div & ul. Seems like its the one which you encountered and solved before.

This is my html code.

<ul>
<li>
<div>like a float to be displayed once user hover over the li</div>
</li>
<li>xxx</li>
<li>xxx</li>
<li>xxx</li>
</ul>

The problem is that the div is blocked by the other li when displayed.

I hope you can help me.


Reply

Lozbo
Wait, I now remember, henwolf i havent figured it out, I sent you the wrong link on that message, Im sorry the problem you refer to ... i havent seen it in a while...

I dropped this project a long time ago, actually I dont really remember if i solved it or not, but good you remind me of it because i need it again these days and I need to find an answer.

As of now I dont recall what was I doing, but let me dive into the code once more and Ill be posting my progress here (or I'll gladly accept suggestions from you or anybody else who finds a way around this)...

Greetings

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.

Recent Queries:-
  1. css background float - 684.29 hr back. (1)
Similar Topics

Keywords : kind, css, background, float, trouble

  1. Does Anyone Know What Kind Of Dog This Is?
    (6)
  2. Need Help With Javascript Drag And Drop Script
    Having trouble with javascript drag and drop script. (2)
    hi, i have been trying to create a drag and drop menu for my new website, so that the navigation
    menu can be moved around the site. This is the code i have: CODE <html> <head>
    <title>Test run - Right click menu</title> <script
    type="text/javascript"> function coordinates(event) { if
    (event.button==2)   { var x=event.x; var y=event.y; }
    document.getElementById("element").style.left=x;
    document.getElementById("element").style.top=y;
    document.getElementById("eleme....
  3. Having Trouble Accessing Google
    (1)
    I opened my computer this morning very excited about checking my email but to no avail because till
    now I am having a hard time connecting to gmail and google. I already tried a few things like 1.
    reset my modem 2. virus and malware scan my computers but as I found out it's not only a
    problem in my pc. It's a problem in all of the pcs here at home as well. We're all connected
    to the internet via a wireless hub (linksys). Well recently I found out that the firmware of our
    hub is corrupted (meaning people could connect to our network and use our interne....
  4. I'm Having Trouble Registering [resolved]
    (my application is accepted, but not going through) (6)
    I joined the forums here a week or two ago. I worked my credits up to about 39 and applied for an
    account (I became completely approved). However, when I tried registering my account, my browser
    was stuck on the "Xisto" page for about 48 hours. It just kept telling me to wait (it could take a
    "long time"). Eventually, I had to close my browser because it was using exorbitant levels of RAM.
    I lost all my credits anyway. I'm wondering how to fix that. Does my application require human
    input after being approved? I thought it was completely automatic, so I appli....
  5. Browser Compatibility Problem With Firefox - Javascript + Css
    Having trouble making a script work right - any suggestions? (3)
    Hi, Im working on a website, and im trying to make a right-click menu, which opens on right click,
    wherever the cursor is, and closes on mouse out. I wrote the code below, and when i ran it in IE it
    ran fine, just how i wanted it to work. However in firefox, the menu just opened in the top left. im
    presuming this is because it doesnt like my style changing in the javascript. Any ideas, and
    suggestions? If i cant make this work, i will just make it so it works slightly differently when
    viewev in firefox so that it can just open in one place. All ideas appreciated. ....
  6. The Olympics-more Trouble Than It's Worth?
    (6)
    I love watching the Olympics like many other people. It is pretty cool to see athletes from all over
    the world compete in sporting events. However, it seems to me that the Olympics may be causing more
    trouble than what it's worth. The debate over drug involvement, underage gymnasts, tie scores,
    dropping s medal on the ground, and falling on the vault are all examples of things that have been
    debated. It seems to me that all of these things are ruining the Olympics. What's the point in
    winning a gold medal when everyone questions it? It seems to me that the Olympi....
  7. Cms?
    Trouble!!! (2)
    I installed a CMS which is called Slaed. This is the mistake I am getting on the main page: QUOTE
    Warning: unlink(config/counter/sess.txt) : Permission denied in
    /home/alex1985/public_html/function/function.php on line 1607 How can I solve it? Your
    suggestions?....
  8. Kei Igawa: The Story And Analysis
    Background and analysis of Kei Igawa (0)
    December 14th, 2006, the Boston Red Sox officially purchased Daisuke Matsuzaka from the Seibu Lions
    for a $51,111,111.11 posting fee, and afterwards signed him to a six year, $60 million
    contract ($52 million guaranteed). Five days later, the New York Yankees purchased Kei Igawa
    from the Hanshin Tigers. They paid a $26,000,194 posting fee, and signed Igawa to a 5 year,
    $20 million contract (totaling $46,000,194). Was the signing of Igawa an “Oh my God, the
    Sox just got Matsuzaka” PR move, and were there better options? The Bronx Bombers Blog....
  9. Mime Type Trouble
    (3)
    I have been trying to validate my site with xhtml 1.1 and I am supposed to serve it as an
    application vs. text/html... 1. It recommends changing to .xml or .xhtml extension but when I do
    this in my home folder it doesn't recognize the extension and calls is text/generic. 2. Yes, i
    have added the mime type in apache, but I don't know why it doesn't recognize it?? It
    recognized a pearl script I made. 3. I also tried adding a perl script to the top of my pages to
    declare mime type but it doesn't seem to be working. How can I get cpanel to recognize these ....
  10. Gaining Weight (the Good Kind!)
    (11)
    want to not be skinny? want to be big and muscular but not fat? squats and milk is the way to
    go!! a simple but effective way to gain size, strength, but not fat; all you have to do
    is a few simple basic exercises, and drink alot of milk (1%) and eat alot of peanut butter!
    so here it is...... the beast of all lifts, the king of all lifts-- the squat--- the answer to all
    of your skinny problems! in particular, its the 20 rep squat--- ill warn you, this is not for
    the faint hearted! it will hurt, but, hey, no pain, no gain! so what y....
  11. Hover Car
    Not the kind we have now, the kind you see on Starwars and such... (5)
    I have an idea to create a hovercar, not the kind we have now with the giant fans and the blanket of
    air, but the kind of hovercars you see on starwars... Now, if you think that this is impossible
    using current-day technology and are about to click away from this page, DON'T! Because you
    can make one of those hovercars using current day technology... So, I have no idea if this can
    actually be done mass-produced as the technology is currently under development and has lots of
    limitations, that would make it very hard to remove some of the limitations required to ....
  12. Cpanel Help, Trouble Logging In.
    Cannot login as it states "Login Attempt Failed!" (4)
    Before I was able to login within my Cpanel without problem but now I try to login and it states
    "Login Attempt Failed!" which makes no sense. I made sure nothing was written incorrectly within
    the fields but yet I get this error. ;-; I hope I wasn't hacked or anything.... anyone has any
    idea of what this could mean?....
  13. Runescape Through A Proxy
    I'm having trouble running Runescape through a proxy server (2)
    I use GhostGo when I surf the web most of the time because it helps protect my privacy. One
    problem I've encountered, is playing Runescape on it. A picture of my screen is attached. I use
    Safari to play Runescape. I'd rather not, but I will use Firefox if I need to.....
  14. Array Pointers Can Be Backwards
    (Kind of) (8)
    I just found this out today: When you're using arrays, when you reference a certain index, you
    can switch the pointer and the subscript around. I know I'm not explaining that very good, but
    here's and example: CODE int a[] = {1,2,3,4,5,6,7,8,9,10,11}; int b =1; int
    c[] = {0,-5,11,0,0,5,0,0,0}; cout << b[a][c];    //Same as
    c[a[b]]; See? 'b' is actually just an integer, it's not an array,
    or pointer, or anything. Usually, you would have to put the array first, then an integer. Like....
  15. Absract Background!
    Abstract Background! (0)
    Well I made a abstract background for people to use. Background. An example of a sig i no its
    plain. Hope you like....
  16. Tray Info Message
    Kind of popup thingie (7)
    Hi! I'm doing VB for some time now and for last two days I've been looking for a
    tutorial which would show me how to create some kind of notification that would pop up from
    lower-right side of my screen, where the clock is... you know, just like.. when a contact comes
    online on MSN etc. I realized that there's no way to make a balloon pop up like the one in the
    image but is there a way to make anything like that..it doesn't have to be a balloon. A little
    square in the right spot would be good as well /tongue.gif" style="vertical-align:middle" emoid....
  17. What Kind Of Car Do You Have?
    make and model? :D (30)
    I was curious on what kinda car people have o.o; I have a 91' Eagle Talon TSi AWD it has a 6
    cylinder Turbo its automatic and Its Pearl White! well it will be pearl white soon o.o; cause
    i'm getting my dad to repaint it for me~ annd we are getting it registered next week!
    i'm so excited. /laugh.gif" style="vertical-align:middle" emoid=":lol:" border="0"
    alt="laugh.gif" />....
  18. Background Image Swap Script
    Change a Background Image based on clock time (15)
    Background Image Changer Script To swap the background image from your CSS file according to the
    Server Clock Time. 1.) In your CSS file, add the following rule: CODE body {
        background: url(time.png); } 2.) Create a "folder" named time.png. 3.) Into the
    folder, place three images named morning.png, day.png, night.png. 4.) Also, in the same folder,
    create an index.php file and copy/paste the following script. CODE <?php $hour =
    date('H'); if ($hour < 12 ) {     $image =
    "morning.png"; } ....
  19. What Kind Of Games You Like?
    (19)
    i like Strategy Games, which i have played are Command & Conquer Generals , Command & Conquer
    Generals Zero Hour, Rise of Nations, Age of Empires, Red alert and some of them are realy remarkable
    , like zerohour , i am playing now its expention Last Stand.....
  20. Frog Setup
    Not sure what kind? (6)
    Ok so I got some tadpoles in my room right now they are so cool, swimming around nipping at boiled
    lettuce. I need to know what kind of setup I need for them after they get big enough. Also how much
    it was cost. All I know is I need water and a tank. But not just tap water I know that the chemicles
    and chlorine would kill them. So could someone help me out. Right now they are in a jar as they are
    still very small and young. I am guessing they have been out of egg for about 3 days. So any help or
    tips on how to make sure my tadpoles or when they turn into frogs are health....
  21. What Kind Of Script Do You Need ?
    post here and get free script (15)
    Hi everybody sorry if i posting here , i know I want design free PHP script and i dont know
    webmasters what kind of scripts want i think its better to aks here becuase trap17 is very nice
    webmasters forum So , Plz post here what kind of script with details you need ! sorry may en
    is not very well for example you need "upload center" : write "upload center" with upload center
    options ( like Ajax , Fast , multi lan and ... ) with this post we can give script details and
    webmasters idea /smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.....
  22. Trouble With Rpgmaker Xp
    (19)
    I newly installed RPG Maker XP and a message pops up saying. "Failed to obtain a trial activation
    code from the nTitles server!" Now what do I do?....
  23. How To Put Music In The Background Of A Powerpoint Presentation
    without having the viewer download the music file (11)
    Well, i made this power poit presentation in memory of my grandfather as many of you kno, passed
    away exactly a week ago....and i am trying to get this song to play as background music..and i did,
    but there is one humongus problem... in order for the people who are viewing it to hear the
    background music they have to download the music file as well ad the powerpoint presentation, which
    on my DSL conntection taked almost 2 minutes, and i could just imagine what it will be for a dial-up
    user (my grandma who wants to see it)... Some people may say, its impossible, but i kn....
  24. Changing Background Color In Php
    usefull for templating. (5)
    Tutorial on how to change background color with PHP I will be descibing to similiar ways that
    you can change the background color of your website with php and leave it at that till the user
    changes it again. We are going to do this with CSS. You can either have your cSS info on your page
    or in a spereate document. The first thing youll have to do is decide if your going for the linked
    stylesheet or directly on your page. IF you link it you'll need to have this code in you
    tags. CODE <style type="text/css"> <?php include ("st....
  25. Windows Update Trouble
    Office XP Service Pack 3 (7)
    I tried downloading Office XP Service Pack 3 And when I try to download it I Get this box that pops
    up QUOTE Title says: Microsoft Office XP Professional with FrontPage The feature you are
    trying to use is on a network resource that is unavailable. Click ok to try again, or enter and
    alternate path to a folder containing the installation package “PROFLUS.MSI” in the box below Use
    source. C:\Documents and settings\Owner\Desktop (In a drop Down Menu) Then there is
    3 options (OK, Cancel, Browse…) Kind of puzzled as to how I could install the win....
  26. Buying A Cell Phone
    what kind should i get? (11)
    hey im looking to buy a cell phone and I am wondering what is a good kind. I don't have a clue
    what is a good phone or not. The phone is going to be a flip phone if that matters. Any
    Suggestions?....
  27. Having Trouble Installin Half Life 1 On Windows Xp
    help me plz... (8)
    im havin trouble installing half life 1 on my computer it meets all the requirments and stuff but it
    wont install and ive read because im using windows xp but ive also read ppl got it to work even
    though there usin windows xp i tried steam but that didnt really help it installed but kept screwin
    up so if anyone has any suggestions plz post them....
  28. Neomail, Horde, Squirrelmail
    What's the deal?? Having trouble here... (4)
    I'm using an email address under my domain and had been using Neomail to check it for most of
    the time that I've been hosted (less than 2 months now). Not long ago I tried Horde and
    switched to it because it looked nicer. At first, my emails weren't visible in Horde, but later
    they appeared and I couldn't see them in Neomail anymore (I don't know how this happened or
    what I did.) But since using it, Horde was giving me trouble so I decided to switch back to Neomail.
    So I logged into Neomail, but my messages haven't gone back to it. Next, I al....
  29. Flash Movie As Background?
    - Is it possible? (20)
    Can I create a Flash movie, with sound, and set it as my background for my site? I don't want
    this flash movie to be the body background, but in a cell. If somone knows a code for that, do tell.
    , thanx Nickmealey....
  30. What's Your Favorite Kind Of Food?
    (86)
    Well, I'm from Argentina and I like eating meat alot, but I don't like spice food, or
    fattening like Fast food, but well when I'm hungry I'd eat anything, snaks are the worst,
    specially if there's cheese around...I like Italian alot I make pizza all the time, in fact last
    night I made two and they were pretty good. I like Japanese, because I like fish a lot too, Indian
    haven't had a lot so I'm not sure. The healthiest I thinks is, make your own with a little
    bit of everything.....

    1. Looking for kind, css, background, float, trouble

*RANDOM STUFF*





*SIMILAR VIDEOS*
Searching Video's for kind, css, background, float, trouble

*MORE FROM TRAP17.COM*
Similar
Does Anyone Know What Kind Of Dog This Is?
Need Help With Javascript Drag And Drop Script - Having trouble with javascript drag and drop script.
Having Trouble Accessing Google
I'm Having Trouble Registering [resolved] - (my application is accepted, but not going through)
Browser Compatibility Problem With Firefox - Javascript + Css - Having trouble making a script work right - any suggestions?
The Olympics-more Trouble Than It's Worth?
Cms? - Trouble!!!
Kei Igawa: The Story And Analysis - Background and analysis of Kei Igawa
Mime Type Trouble
Gaining Weight (the Good Kind!)
Hover Car - Not the kind we have now, the kind you see on Starwars and such...
Cpanel Help, Trouble Logging In. - Cannot login as it states "Login Attempt Failed!"
Runescape Through A Proxy - I'm having trouble running Runescape through a proxy server
Array Pointers Can Be Backwards - (Kind of)
Absract Background! - Abstract Background!
Tray Info Message - Kind of popup thingie
What Kind Of Car Do You Have? - make and model? :D
Background Image Swap Script - Change a Background Image based on clock time
What Kind Of Games You Like?
Frog Setup - Not sure what kind?
What Kind Of Script Do You Need ? - post here and get free script
Trouble With Rpgmaker Xp
How To Put Music In The Background Of A Powerpoint Presentation - without having the viewer download the music file
Changing Background Color In Php - usefull for templating.
Windows Update Trouble - Office XP Service Pack 3
Buying A Cell Phone - what kind should i get?
Having Trouble Installin Half Life 1 On Windows Xp - help me plz...
Neomail, Horde, Squirrelmail - What's the deal?? Having trouble here...
Flash Movie As Background? - - Is it possible?
What's Your Favorite Kind Of Food?
advertisement



Another Kind Of Css Background Float Trouble - now with a <ul>



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE