Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jun 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Combining CSS elements properly (drop down menu)

    I am having the worst time trying to incorporate this drop down CSS into my current CSS.

    Basically I took a template, edited it and whatnot to make it pretty solid, but now, I need more than 4 menu items which is all the menu really supports in its current state. So I found a CSS drop down menu tutorial but following it really jacks up my code and the live view doesnt look good at all.

    Is there a way I can combine these 2 code sections into something usable? I used to do notepad HTML back in the day, but now I am so far out of touch with the code, that it all seems pretty foreign to me.

    If you need more info than the code I have posted, let me know. I cant really upload a copy of this, but I can upload the full code places (reasons being this is a company website, and I dont know how much I should be posting before it goes live).

    Heres the code.

    Code:
    /* BE SURE TO INCLUDE THE CSS RESET FOUND IN THE DEMO PAGE'S CSS */
    /*------------------------------------*\
    	NAV
    \*------------------------------------*/
    #nav{
    	list-style:none;
    	font-weight:bold;
    	margin-bottom:10px;
    	/* Clear floats */
    	float:left;
    	width:100%;
    	/* Bring the nav above everything else--uncomment if needed.
    	position:relative;
    	z-index:5;
    	*/
    }
    #nav li{
    	float:left;
    	margin-right:10px;
    	position:relative;
    }
    #nav a{
    	display:block;
    	padding:5px;
    	color:#fff;
    	background:#333;
    	text-decoration:none;
    }
    #nav a:hover{
    	color:#fff;
    	background:#6b0c36;
    	text-decoration:underline;
    }
    
    /*--- DROPDOWN ---*/
    #nav ul{
    	background:#fff; /* Adding a background makes the dropdown work properly in IE7+. Make this as close to your page's background as possible (i.e. white page == white background). */
    	background:rgba(255,255,255,0); /* But! Let's make the background fully transparent where we can, we don't actually want to see it if we can help it... */
    	list-style:none;
    	position:absolute;
    	left:-9999px; /* Hide off-screen when not needed (this is more accessible than display:none;) */
    }
    #nav ul li{
    	padding-top:1px; /* Introducing a padding between the li and the a give the illusion spaced items */
    	float:none;
    }
    #nav ul a{
    	white-space:nowrap; /* Stop text wrapping and creating multi-line dropdown items */
    }
    #nav li:hover ul{ /* Display the dropdown on hover */
    	left:0; /* Bring back on-screen when needed */
    }
    #nav li:hover a{ /* These create persistent hover states, meaning the top-most link stays 'hovered' even when your cursor has moved down the list. */
    	background:#6b0c36;
    	text-decoration:underline;
    }
    #nav li:hover ul a{ /* The persistent hover state does however create a global style for links even before they're hovered. Here we undo these effects. */
    	text-decoration:none;
    }
    #nav li:hover ul li a:hover{ /* Here we define the most explicit hover states--what happens when you hover each individual link. */
    	background:#333;
    }
    ^code from - http://csswizardry.com/2011/02/creat...dropdown-menu/
    And im trying to merge it with...

    Code:
    /*==================list====================*/
    ul { list-style:none;}
    
    #menu {
    	padding:9px 0 28px 0;
    	background:url(images/line-hor.gif) left bottom repeat-x;
    	width:100%;
    	overflow:hidden;
    	margin-bottom:25px;
    }
    #menu ul li { display:inline;}
    #menu ul li a { display:block; float:left; background:url(images/menu-bg.gif) left top repeat-x; margin-right:8px; font-family:"trebuchet ms"; color:#888; text-decoration:none; text-transform:uppercase;}
    #menu ul li a em { display:block; background:url(images/menu-left.gif) no-repeat left top;}
    #menu ul li a b {
    	display:block;
    	background:url(images/menu-right.gif) no-repeat right top;
    	width:82px;
    	text-align:center;
    	font-style:normal;
    	font-size:1.10em;
    	padding:1px 0 3px 0;
    	cursor:pointer;
    }
    #menu ul li a.last { margin-right:0;}
    #menu ul li a:hover { color:#0000FF;}
    #menu ul li a.current { color:#0000FF;}
    
    .list1 dt { padding-bottom:6px;}
    .list1 dd { padding-bottom:21px;}
    If there is a better way of doing it, I am ALL ears. Every time I try and screw with this, it just gets gunked up and doesnt look right.

    Thanks again for any help.

  • #2
    New to the CF scene
    Join Date
    Jun 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Bump for a bit of help please.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •