CSS - Css Overriding Javascript Dropdown?
please delete
Similar TutorialsI am using a stylesheet to set some styles on my tables etc. I want to override a table that is inside of a <div> to use a separate style... is this possible and if so how? I tried using div id="idhere" and then setting a style with that ID but it didn't seem to work. Thank you. I'm making changes to a web application and right at the top of the CSS of the common header for the generated HTML there are pseudoclasses for the link colors. a:link a:hover.... etc. I was trying to change the color of a few links further down on the page by creating seperate classes and I was getting very odd results. Some links would change color and some would not. Finally I noticed the pseudoclasses at the top and commented them out. Suddenly all my colors looked GREAT in internet explorer, but it seems that Mozilla is ignoring my seperate classes and making the links into the browser default. Here is a summary of my generated code right now: CSS: a:link,a:active,a:visited { color : #5E6C85; } a:hover { text-decoration: underline; color : #DD6900; } .indnav { font-weight: bold; font-size: 11px; color : #000000; } a.indnav { text-decoration: none; color : #000000; } a.indnav:hover { text-decoration: underline; } HTML: <span class="indnav"><a href="index.php" class="indnav">(link text)</a></span> So what I would really like is for the pseudoclasses to apply for all links, except for when I define a specific class it should override the pseudoclasses. How do I do this? Thanks so much for your time in answering. Hi, Is there a way to tell the browser to replace certain colours with other colours? For example replace #FF0000 with #00FF00? Also is there anyway to refer to the parent of an element? Thanks, Matthew Hi, I am trying to add bottom borders and image bullets to only the first level of unordered lists and no matter what is code, I get them everywhere. Can someone offer some insight (or where I can get some) for targeting specific ul li levels? Thanks... so... having this problem where i have some css styles applied to form inut boxes, and one of them asks for the user to input his/her email address. IE, thinking it's being helpful, is overriding my nice green background with an ugly yellow background. I've done some testing, and if i put the word "email", "e_mail", "e-mail", or even "mail_e" in either the html text NEXT to the blank, or in the name of the INPUT tag, IE assumes i want it to be yellow. any way of overriding this? CSS: Code: .inputBox { border: 1 solid black; background-color: #bcdd4a; font-size: 12; width: 200; height: 16; color: #145e16; font-weight: bold; } HTML: Code: <td valign=top>E-mail:</td> <td valign=top><input type="text" class="inputBox" name="emailAddress" size=20></td> IE Version: 6.0.2800.1106 LINK: http://www.t-2.biz/contact.php please help, frustration setting in. cheers \\ kfancy Hi there! http://pastebin.com/m46dae086 Basically, see line #218? I define a background image for my lists, and it works great. See line #473? I try to erase the background image if the <dl> class has the "forum" class attached to it. That background's not going away. What am I doing wrong? I have this tag in an external css file Code: td { text-align:left; //and yes i know that its left by default } Inside my html file I have a td with alignment set to right, which according to my understanding should override the external css file, however it doesn't. The content is still left aligned. Why is that? Thanks I have one css file which is linked to all my html pages That css file defines a style for all my <a> tags ie - a:link, a:visited, a:hover etc. Theres one html file where i need a different style for some of the <a> tags ive set a sepecific class on these tags ie: <a class="set1" etc and in my css file ive tried the following .set1 a:link { etc } but for some reason this doesnt override the style on the generic a tags ie it seems to keep using a:link { } ignoring the .set1 a:link { etc } help! I am working in Drupal and have a menu with secondary levels. I have coded css on the menu a tag with borders and no background. .primary-menu-inner ul.sf-menu a { color: #FFFFFF; display:block; border-left:1px solid #ffcc33; border-right:1px solid #6f4c23; } I am trying to override the .primary-menu-inner ul.sf-menu li.active-trail .primary-menu-inner ul.sf-menu li.active-trail { background: url(../images/nav.png) no-repeat right -64px; border-bottom:1px solid #a67c52; border-right:1px solid #a67c52; border-left: 1px solid #38230b; visibility: visible; } to where the borders settings on the a tag does not show up on the li.active trail. Any suggestions would be great... On my site, we use CSS to change the appearance of all form fields, using the following: INPUT { font-family: Arial, Verdana, Helvetica, sans-serif; font-size: 13px; color: #484848; background: #EFF4F9; border: 1px solid #484848; padding: 2px; } Unfortunately, I have a single submit button that for various reasons, I want to have looking like the normal, gray, ugly button. Is there some way to turn off the CSS for this single button? Or somehow override the CSS to make it look like a normal button? Hey all, I'm having an issue with the float property. I have 2 nested div tags both floated left, to create two columns, but the div tag holding them doesn't seem to stretch around them. it's looks basically like this... <div id="container"> <div id="leftCol"> stuff </div> <div id="rightCol"> more stuff, WOOT! </div> </div> I only run into the problem with FireFox, so i know that i'm not doing something right! Can anyone help.. thanks! Sorry if this is in the wrong section but i'm not sure if it should be here or in the javascript section. Here is the CSS code that I am making. I am trying to make a javascript drop down but the css is preventing the code from becoming a vertical dropdown. It justs goes to the left. Here is the beggining css for it and I am having trouble making it like that. Sorry if I can't be more descriptive but i've been trying to work for 5 hours and got nothing. Can any one please help. CSS code Code: #nav{ float:left; width:100%; margin:0px; padding:0px; margin-top:-8px; } #nav ul{ float: right; list-style-stype:none; margin:0px; padding:0px; height:27px; overflow:hidden; } #nav ul li{ display: inline; margin: 0px; padding: 0px; height: 27px; overflow:hidden; } #nav ul li a, #nav ul li a:visited{ background-position: centertop; background-repeat:no-repeat; display:block; float: left; height: 0px; margin: 0px 0px 0px 8px; overflow: hidden; padding: 30px 0px 0px 10px; text-decoration:none; } #nav ul li a:link#nav_agency, #nav ul li a:visited#nav_agency { background-image:url(images/agency2.gif); border:0px; width:54px; } #nav ul li a:hover#nav_agency, #nav ul li a:link#nav_agency.active, #nav ul li a:visited#nav_agency.active { background-image: url(images/agencyup2.gif); border: 0px; width: 54px; } #nav ul li a#nav_services, #nav ul li a:visited#nav_services { background-image: url(images/services2.gif); border:0px; width: 56px; } #nav ul li a:hover#nav_services, #nav ul li a#nav_services.active, #nav ul li a:visited#nav_services.active { background-image: url(images/servicesup2.gif); border: 0px; width: 56px; } Java Code Code: window.onload = initAll; function initAll() { var allLinks = document.getElementsByTagName("a"); for (var i=0; i<allLinks.length; i++) { if (allLinks[i].className.indexOf("menuLink") > -1) { allLinks[i].onclick = function() {return false;} allLinks[i].onmouseover = toggleMenu; } } } function toggleMenu() { var startMenu = this.href.lastIndexOf("/")+1; var stopMenu = this.href.lastIndexOf("."); var thisMenuName = this.href.substring(startMenu,stopMenu); document.getElementById(thisMenuName).style.display = "block"; this.parentNode.className = thisMenuName; this.parentNode.onmouseout = toggleDivOff; this.parentNode.onmouseover = toggleDivOn; } function toggleDivOn() { document.getElementById(this.className).style.display = "block"; } function toggleDivOff() { document.getElementById(this.className).style.display = "none"; } Html code Code: <div id="nav"> <ul> <li><a href="agency.html"id="nav_agency" class="" title="Agency">AGENCY</a></li> <li><a href="services.html"id="nav_services" class="active" title="Services">SERVICES</a></a></li> <ul> <li><a href="technology.html" id="nav_technology" class="" title="Technology">TECHNOLOGY</a></li> <li><a href="#.html">As You Like It</a></li> <li><a href="#.html">Love's Labour's Lost</a></li> <li><a href="#.html">The Comedy of Errors</a></li> </ul> </nav> In my main CSS file, the background-color is set to #FFFFFF (white) however this also erased my background images in the cells of my table i have tried to add them with style tags, but the main CSS still overrides Top of the table + cell with bg PHP Code: <table cellpadding="0" cellspacing="0" border="0" align="center"> <tr> <td width="766" height="295" valign="top" style="background-image:url(images/row1.gif); background-repeat:no-repeat "> This is the main CSS: PHP Code: body,td,th { font-family: Tahoma; font-size: 11px; color:#5D5D5D; background-color:#FFFFFF; } body { font-family: Tahoma; font-size: 11px; color:#5D5D5D; background-color:#FFFFFF; } Can anyone give me a hint on why the css/javascript controlled dropdowns don't appear right on this page in Safari: http://spa.american.edu As you can see in the view source the script is very basic and not embedded in an external file. Safari cuts off a portion of the final link. Thanks, Jeremy it's best to get a visual of this one: www.viportals.com i'm talking about the buttons under the top banner. if you hover "Games", a drop down list appears. there is a 1pixel line between the "Games" button and its dropdown list (when you hover the "Games" button) which i want to get rid of, but can't. in IE, there are many horrible problems, probably due to the display:inline-block of the li a. the buttons are too tall and hang down below the bottom line of the horizontal bar, and the dropdown menu appears beside the "Games" button. i tried css Code: Original - css Code #sddm ul li a { padding-top: 0; padding-bottom: 0; margin-top:0; margin-bottom:0; } #sddm ul li a { in my separate ie css file, but its the same here is all the code if you need it to gain a better understanding (css, html, and js). css Code: Original - css Code /* DROP-DOWN NAVIGATION MENU */ #sddm { margin: 0; padding: 0; z-index: 30; } #sddm li { margin: 0; padding: 0; list-style: none; float: left; } #sddm li a { display: inline-block; text-decoration: none; color:#495B20; background-color:#BAD36B; border-left: 2px solid #fff; border-top: 2px solid #fff; border-right: 2px solid #000; border-bottom: 2px solid #000; } #sddm li a:hover { background-color:#495B20; color:#BAD36B; border-left: 2px solid #000; border-top: 2px solid #000; border-right: 2px solid #fff; border-bottom: 2px solid #fff; text-decoration:none; } #sddm li:hover div { position: absolute; visibility: hidden; margin: 0; padding: 0; background: #BAD36B; border-left: 2px solid #fff; border-top: 2px solid #fff; border-right: 2px solid #000; border-bottom: 2px solid #000; } #sddm li div { position: absolute; visibility: hidden; margin: 0; padding: 0; background: #BAD36B; border-left: 2px solid #fff; border-top: 2px solid #fff; border-right: 2px solid #000; border-bottom: 2px solid #000; } #sddm li div:hover { background-color:#495B20; color:#BAD36B; border-left: 2px solid #000; border-top: 2px solid #000; border-right: 2px solid #fff; border-bottom: 2px solid #fff; } #sddm li div:hover a{ background: #495B20; color: #BAD36B; } #sddm li div a { position: relative; display: block; margin: 0; padding: 5px 10px; width: auto; white-space: nowrap; text-align: left; text-decoration: none; border:none; font: 11px arial; } #sddm li div a:hover { text-shadow:#000; text-decoration:underline; border:none; } /* DROP-DOWN NAVIGATION MENU */ html Code: Original - html Code <div id='navbar'> <ul id="sddm"> <?php echo " <li> <a href='".get_home_link()."'> Home</a> </li> <li> <a href='".get_category_link("name=all&page=1")."'"; ?> onmouseover='mopen("m1")' <?php echo " onmouseout='mclosetime()'> Games</a> <div id='m1' onmouseover='mcancelclosetime()' onmouseout='mclosetime()'> "; $categories = get_categories("htmlize=true&order=order&sort=ASC"); foreach ($categories as $category) { $link=get_category_link("name="._sp($category['name'])."&page=1"); echo "<a href='".$link."'>".$category['name']; $category['gamenum'] = count(get_games("thecat="._sp($category['name']))); echo " (".$category['gamenum'].")"; echo "</a>"; } echo " </div> </li> <li> <a href='".get_users_link()."'> Members</a> </li> <li> <a href='".get_news_link()."'> News</a> </li> <li> <a href='".get_submit_link()."'> Submit</a> </li> <li> <a href='".get_links_link()."'> Links</a> </li> <li> <a href='".get_rules_link()."'> Rules</a> </li> <li> <a href='".get_faq_link()."'> FAQ</a> </li> <li> <a href='".get_contact_link()."'> Contact</a> </li>"; ?> </ul> <div style="clear:both"></div> </div> <div id='navbar'> <ul id="sddm"> <?php echo " <li> <a href='".get_home_link()."'> Home</a> </li> <li> <a href='".get_category_link("name=all&page=1")."'"; ?> onmouseover='mopen("m1")' <?php echo " onmouseout='mclosetime()'> Games</a> <div id='m1' onmouseover='mcancelclosetime()' onmouseout='mclosetime()'> "; $categories = get_categories("htmlize=true&order=order&sort=ASC"); foreach ($categories as $category) { $link=get_category_link("name="._sp($category['name'])."&page=1"); echo "<a href='".$link."'>".$category['name']; $category['gamenum'] = count(get_games("thecat="._sp($category['name']))); echo " (".$category['gamenum'].")"; echo "</a>"; } echo " </div> </li> <li> <a href='".get_users_link()."'> Members</a> </li> <li> <a href='".get_news_link()."'> News</a> </li> <li> <a href='".get_submit_link()."'> Submit</a> </li> <li> <a href='".get_links_link()."'> Links</a> </li> <li> <a href='".get_rules_link()."'> Rules</a> </li> <li> <a href='".get_faq_link()."'> FAQ</a> </li> <li> <a href='".get_contact_link()."'> Contact</a> </li>"; ?> </ul> <div style="clear:both"></div> </div> I've developed a dropdown navigation menu from a tutorial. The basic menu works perfect in IE and FF. But I would like to change a few things that for the life of me I can't get to work. First would be that under each item in the dropdown menu I would like there to be a bottom border. So in my css file I added border-bottom to the li li {} section. Now I am faced with two problems. First in firefox the border expends maybe 5px. Apon further investigation I found that for some reason FF has the <li> tags only about 5px wide all over the place! In IE it extends atleast below the text but won't will the entire <li> like it should! FF also doesn't give the border to all the links like it should. The next problem is in the width of the elements. Instead of the dropdown part being a set width, I would like the the part that drops down to stretch so that each link is on one line. But the entire part that drops down would be still remain rectangular like it does now. Code: Ex: [Link1][Link2][Link3] *with the mouse over the link 1 |Url1 | |Url2 | |Much Longer| instead of [Link1][Link2][Link3] *with the mouse over the link 1 |Url1 | |Url2 | |Much| |Longer| I think this has something to do with the width of the li, so I set the width to auto. No change. To recap my lengthy post. Getting a bottom border on the li tags in the dropdown Getting FF to behave with the bottom border and widths Each link should be on only one line I think that getting the <li> width to behave will solve most of my problems. I've attached the original css and html pages. Hi, I'm trying to solve a little CSS issue with, guess what!, IE6. 92 (dot) 48 (dot) 108 (dot) 113 (forward slash) ~anyjob In FF all is good, but when viewed in IE the nav bar has been forced down to misalign with my background red strip. Also the dropdowns don't work. Could anyone point me in the right direction. I don't think this is a float issue and I've read up as much as possible but this is really confusing me. Any help would be very much appreciated. Thanks, Brian I made a drop down menu with css and I can't get it to work with IE6. Can anyone help? You can view an example of what I have at the following url mentalgameofmoney.co.uk/example.html Here is the CSS Code: #menu { position:absolute; background-color:#FF0000; overflow:hidden; height:30px; width:91px; top:0px; left:0px; } #menu:hover{ overflow:visible; } #menu a:link{ text-decoration:none; } #spacer{ height:30px; } #link_box{ background-color:#cbbba2; border-left:#c1ad90 solid 1px; border-right:#c1ad90 solid 1px; border-bottom:#c1ad90 solid 1px; padding-left:5px; color:#51351a; font-family:Arial, Helvetica, sans-serif; font-weight:bold; font-size:12px; text-decoration:none; text-align:left; } #link_box:hover{ background-color:#51351a; color:#FFFFFF; } Here is the HTML Code: <div id="menu"> <a href="#"> <div id="spacer"></div></a> <a href="#"><div id="link_box">Link</div></a> <a href="#"><div id="link_box">Link</div></a> <a href="#"><div id="link_box">Link</div></a> <a href="#"><div id="link_box">Link</div></a> <a href="#"><div id="link_box">Link</div></a> <a href="#"><div id="link_box">Link</div></a> <a href="#"><div id="link_box">Link</div></a> <a href="#"><div id="link_box">Link</div></a> </div> hello, i was reading the well-known suckerfish dropdown tutorial and was trying to do something like it. i thought i had understood the logic behind it, but i can't get it to work. the nested unordered lists appear like so: ITEM1 subitem1 subitem2 subitem3 ITEM2 subitem1 subitem2 subitem3 i wanted them to appear like so: subitem1____subitem1 subitem2____subitem2 subitem3____subitem3 ITEM1_______ITEM 2 the positioning isn't too relevant, all i really wanted was to pull the nested ul out of the flow... i made sure that the li ul part was positioned absolutely, but i can't do anything with it (no styling, no anything). my css/code must be the problem, but i can't see what i'm doing wrong. here's the relevant code: CSS: Code: #menu ul { position: relative; margin: 8em 0 0 0; float: left; background-color: #D60078; list-style-type: none; } #menu li { display: inline; padding: 0 2.5em 0 0; position: relative; } #menu li a:link, a:visited { text-decoration: none; font-family: Arial, Helvetica, sans-serif; font-size: small; color: #FFF; } #menu li a:hover, a:active { text-decoration: underline; font-family: Arial, Helvetica, sans-serif; font-size: small; color: #FFF; } #menu li ul { position: absolute; left: 0; top: 0; background-color: #FFF; display: block; } HTML: Code: <ul id="menu"> <li><a href="">ITEM1</a> <!-- SUBMENU --> <ul> <li><a href="">subitem1</a></li> <li><a href="">subitem2</a></li> <li><a href="">subitem3</a></li> </ul> </li> <li><a href="">ITEM2</a> <!-- SUBMENU --> <ul> <li><a href="">subitem1</a></li> <li><a href="">subitem2</a></li> <li><a href="">subitem3</a></li> </ul> </li> </ul> i hope that made sense (after working on this for hours and trying everything that came to mind, i'm getting a little incoherent). thanks for any help! Hello guys I sure would appreciate some help integrating a css dropdown menu into a site. If you visit in FF, the drop down works find, If you open it in IE9 the dropdown does not work. i am new to css.so cant solve the poblem. Thanks for any help. |