Solved

Issue with CSS and UL

Posted on 2013-02-05
6
234 Views
Last Modified: 2013-02-06
I cannot figure out why the css I have set for my #menubar div is being picked up for all ul elements all through my site?  I have the css for #menubar ul etc so it should just be the #menubar element.

Here is a page where you can see the ul is picking up the code
http://loveofsimple.com/easy-vegetable-soup/

Please help!

CSS Code
/*   
Theme Name: Retro
Author: Susan Shropshire
Author URI: http://www.loveofsimple.com
*/

/* Default Styles
---------------------------------------------------------*/
* { margin: 0; padding: 0; }
body { background: #fbf8ef; font: 13px Georgia, Serif; color: #000; }
.clear { clear: both; }
img a {border-style: none;}

.attachment-page-single {
    float: left;
    margin: 12px 10px 10px 0px;
}
 
.attachment-index-categories {
    float: left;
    margin: 12px 10px 10px 0px;
}

.blog-line {width: 100%; border-bottom: 2px dashed #333; clear:both; padding: 10px 0 10px 0;}

h1 {font-size:24px;}
h2 {font-size:36px; font-family: sweetheartscriptregular; font-weight:normal; margin: 0 0 10px 0;}
h3 {font-size:18px;}
h4 {font-size:16px;}
h5 {font-size:14px;}
h6 {font-size:12px;}
.green-dream {background: #BAC42E; -moz-border-radius: 20px; -webkit-border-radius: 20px; -khtml-border-radius: 20px; border-radius: 20px; behavior: url(/css/border-radius.htc); border-radius: 20px; padding: 8px; color: #000;}
a {text-decoration:none;color:#fc4792;}
a:hover{color:#333;}
blockquote {padding: 0 30px 0 30px;}
.pink {color: #fc4792; font-weight: bold;}
.center {margin: auto;}
table {border-style: none;}
td {border: 0;}

.blog-image {width: 630px; text-align:center;}


/*Style Login Page*/
body.login  {background: #000;}
.login form {background: #fc4792;}
.login label {color: #fff;}
input.button-primary, button.button-primary, a.button-primary {background: #000; border: 1px solid #000;}
.login #nav a, .login #backtoblog a {color: #ffffff !important; text-shadow:none;}
.login #nav a, .login #backtoblog a:hover {color: #fc4792 !important; text-shadow: none;}



/* Structure Styles
---------------------------------------------------------*/
#logo-wrap {width: 980px; margin:auto;}
#logo {width: 655px; height: 63px; background:url(images/logo.png) no-repeat; margin: 12px 0 0 0;}
#page-wrap {width: 980px; margin: 15px auto 0 auto; background: #fff; border: 1px #333333 solid;}
#content-sidebar-wrap {float: left; width: 940px; padding: 20px;}
#content {float: left; width: 630px; margin: 0 10px 0 0;}
#sidebar {float: left; line-height: 24px; width: 300px;}
#sidebar h2 {background: #ec519d; color: #fff; padding: 8px; margin: 0 -18px 10px 0; font-family:Georgia, "Times New Roman", Times, serif; font-size: 18px; font-weight:normal;}
#content-page {width: 920px; padding: 30px;}
#footer {width: 950px; height: 65px; margin:auto; background: #9ad5d3; clear:both; padding: 15px;}


/* Menu Styles
---------------------------------------------------------*/
#menubar {width: 980px; background: #9ad5d3; margin: 0 0 20px 0;}
#menubar ul {margin: 0 0 0 200px; width: 980px; background: #9ad5d3; padding: 8px 0 8px 0;}
#menubar ul a { display:block; color: #000; font-family: Georgia, "Times New Roman", Times, serif; font-size: 14px; text-decoration: none;}
#menubar ul, ul li, ul ul { list-style: none; margin: 0; padding: 0; background: #9ad5d3; color: #fff;}
#menubar ul { position: relative; z-index: 597; float: left; }
#menubar ul li { float: left; line-height: 1.3em; vertical-align: middle; zoom: 1; padding: 5px 10px; }
#menubar ul li.hover, ul li:hover { position: relative; z-index: 599; cursor: default; background: #fff; }
#menubar ul ul { visibility: hidden; position: absolute; top: 100%; left: 0; z-index: 598; width: 195px; background: #555; border: 1px solid #2ad6d0; }
#menubar ul ul li { float: none; }
#menubar ul ul ul { top: -2px; left: 100%; }
#menubar ul li:hover > ul { visibility: visible }

#content-page ul {background: #fff;}



/* Font Styles
---------------------------------------------------------*/
@font-face {
    font-family: 'tangerinebold';
    src: url('fonts/tangerine_bold-webfont.eot');
    src: url('fonts/tangerine_bold-webfont.eot?#iefix') format('embedded-opentype'),
         url('fonts/tangerine_bold-webfont.woff') format('woff'),
         url('fonts/tangerine_bold-webfont.ttf') format('truetype'),
         url('fonts/tangerine_bold-webfont.svg#tangerineregular') format('svg');
    font-weight: normal;
    font-style: normal;

}


@font-face {
    font-family: 'tangerineregular';
    src: url('fonts/tangerine_regular-webfont.eot');
    src: url('fonts/tangerine_regular-webfont.eot?#iefix') format('embedded-opentype'),
         url('fonts/tangerine_regular-webfont.woff') format('woff'),
         url('fonts/tangerine_regular-webfont.ttf') format('truetype'),
         url('fonts/tangerine_regular-webfont.svg#tangerineregular') format('svg');
    font-weight: normal;
    font-style: normal;

}


@font-face {
    font-family: 'sweetheartscriptregular';
    src: url('fonts/sweetheartscript-webfont.eot');
    src: url('fonts/sweetheartscript-webfont.eot?#iefix') format('embedded-opentype'),
         url('fonts/sweetheartscript-webfont.woff') format('woff'),
         url('fonts/sweetheartscript-webfont.ttf') format('truetype'),
         url('fonts/sweetheartscript-webfont.svg#sweetheartscriptregular') format('svg');
    font-weight: normal;
    font-style: normal;

}

@font-face {
    font-family: 'centeria_script_demoregular';
    src: url('fonts/centeriascriptdemo-webfont.eot');
    src: url('fonts/centeriascriptdemo-webfont.eot?#iefix') format('embedded-opentype'),
         url('fonts/centeriascriptdemo-webfont.woff') format('woff'),
         url('fonts/centeriascriptdemo-webfont.ttf') format('truetype'),
         url('fonts/centeriascriptdemo-webfont.svg#centeria_script_demoregular') format('svg');
    font-weight: normal;
    font-style: normal;

}




@font-face {
    font-family: 'freshmannormal';
    src: url('fonts/freshman-webfont.eot');
    src: url('fonts/freshman-webfont.eot?#iefix') format('embedded-opentype'),
         url('fonts/freshman-webfont.woff') format('woff'),
         url('fonts/freshman-webfont.ttf') format('truetype'),
         url('fonts/freshman-webfont.svg#freshmannormal') format('svg');
    font-weight: normal;
    font-style: normal;

}

Open in new window

0
Comment
Question by:loveofsimple
  • 3
  • 2
6 Comments
 
LVL 16

Expert Comment

by:HagayMandel
ID: 38858368
This is style.css lines #68 - 80:
/* Menu Styles
---------------------------------------------------------*/
#menubar {width: 980px; background: #9ad5d3; margin: 0 0 20px 0;}
#menubar ul {margin: 0 0 0 200px; width: 980px; padding: 8px 0 8px 0;}
#menubar ul a { display:block; color: #000; font-family: Georgia, "Times New Roman", Times, serif; font-size: 14px; text-decoration: none;}
#menubar ul, ul li, ul ul { list-style: none; margin: 0; padding: 0; background: #9ad5d3; color: #fff;}
#menubar ul { position: relative; z-index: 597; float: left; }
#menubar ul li { float: left; line-height: 1.3em; vertical-align: middle; zoom: 1; padding: 5px 10px; }
#menubar ul li.hover, ul li:hover { position: relative; z-index: 599; cursor: default; background: #fff; }
#menubar ul ul { visibility: hidden; position: absolute; top: 100%; left: 0; z-index: 598; width: 195px; background: #555; border: 1px solid #2ad6d0; }
#menubar ul ul li { float: none; }
#menubar ul ul ul { top: -2px; left: 100%; }
#menubar ul li:hover > ul { visibility: visible }

Open in new window


As you can see, you apply the css not only to the #menubar com[ponent.
In general, check your css.
0
 
LVL 43

Accepted Solution

by:
Chris Stanyon earned 500 total points
ID: 38859025
This rule:

#menubar ul, ul li, ul ul {} //line 73

styles the following:

a UL within #menubar //#menubar ul
all LIs within all ULs // ul li
all ULs within all ULs // ul ul

If you only want to style the UL within #menubar, then your rule should look like this:

#menubar ul {}
0
 

Author Comment

by:loveofsimple
ID: 38860410
I need to add that style to the #menubar ul li and the ul li ul since this is a dropdown menu so I'm not sure how I would do that?

I have always just started with the #divname and then everything after that styles just under that div?

So how would I write the CSS for the #menubar ul, ul li, ul ul ?
0
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 

Author Comment

by:loveofsimple
ID: 38860477
Got it... I have to add the #menubar after each comma.
Thanks
0
 
LVL 43

Expert Comment

by:Chris Stanyon
ID: 38860479
The question was 'why does the style I've applied to my menubar apply to all my ULs through my site'. The reason is because your style rule selects the #menubar UL as well as all UL LIs in your site, plus all UL ULs.

#menubar ul, ul li, ul ul {  }

I have always just started with the #divname and then everything after that styles just under that div?
Until you add commas, and then they become separate rules. For example:

#menubar, ul, p  { color:red; }

will style an element with an ID of menubar PLUS all ULs, PLUS all Ps. You would probably need something like this

#menubar ul, #menubar ul li, #menubar ul ul {  }
0
 
LVL 43

Expert Comment

by:Chris Stanyon
ID: 38860484
;)
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When applying CSS to your HTML, there are many different ways to select which element(s) the CSS applies to.  Some of these selectors are more commonly known and used than others - Here are the more common ones: #X - Matches an ID of X .X - Matche…
Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
The purpose of this video is to demonstrate how to manually back up a WordPress Database. This will be demonstrated using a Windows 8 PC. The Host used will be IPage.com Log into your Hosting account. IPage will be used for demonstration : Locat…
The purpose of this video is to demonstrate how to prevent comment spam on a WordPress Website. This will be demonstrated using a Windows 8 PC. Plugin Akismet will be used. Go to your WordPress login page. This will look like the following: myw…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question