CSS - Css Or Javascript Problem?
Similar TutorialsHi Everyone, I am working on redesigning a website in WordPress that I had previously built in HTML. Most things seems to be working well, except some styling of some JavaScript. The script has a special hover image, but in the new site I can't get the descriptions to be inside the hover box. You can see an example of the old, correctly working site he e3ncw [dot] com And the new, broken one he e3ncw [dot] com /page/1 If you hover over any button in the sidebar you'll see the problem. I'm using float:left on both the image and the description, but can't get it to work. Here's the current CSS I'm using: Code: .sb-blocks li em { background: url(images/hover.png) no-repeat center top; width: 350px; height: 200px; position: absolute; top: 0px; left: -100px; padding: 5px 0 0; font-style: normal; z-index: 2; display: none; } p.url { font-weight: bold; color: #a82125; text-align: center; font-size: 1em; line-height: .5em; } .sb-blocks em img { float: left; padding: 5px 5px 15px 15px; } .sb-blocks p.description { color: #a82125; float: left; width: 275px; } Any help is greatly appreciated. Thanks! lo wonder if anyone can help :S i got advice from this board on doing an iframe using javascript. but know i have a new problem: when i use the scrolling="auto" attribute you get both vertical and hrozontal scroll bars even tho only vertical are needed. i knew how to get rid of this using this inside the body tag : style="overflow-x: hidden;" and that worked but it doesnt now :S also i used this inside a css on my last website to change colours of the scroll bars : body { background-color: #666666; scrollbar-3dlight-color:#999999; scrollbar-arrow-color:#666666; scrollbar-base-color:#666666; scrollbar-darkshadow-color:#e2e2e2; scrollbar-face-color:#575757; scrollbar-highlight-color:#666666; SCROLLBAR-TRACK-COLOR: #656565; scrollbar-shadow-color:#666666 } but for some reason its not working now is it cus i used a javascript for the iframe??? Any help would be much appreciated N3cr0 Hi all, I'm sure this is an easy fix, but I can't get it. I have a javascript rollover image swap, and can only get it to validate if I don't use the border="0" attribute. The site is to be pure css, but the course requires me to use some javascript to show understanding. So it works fine, but showing a blue border in ie, and a red border in mozilla. My question is, if you can help, how to hide/get rid of the border, and have validate at the same time. Cheers Solar. html link http://darkspeed.atspace.com/Javascript.htm css link http://darkspeed.atspace.com/speedstyle.css the div is #roll, hope this makes sense.. thanks. And if I'm doing it all wrong any advice would be appreciated.. Thanks again. Trying to change 'traditional' mailto link to one using CSS. Currently, I use JS to hide email address from spam bots as follows: Sample page code: Code: <script language="javascript"> var add1="me" var add2="mydomain" var add3=".com" var text = "Text for text link" </SCRIPT> email: <script language="javascript" SRC="mail2link.js"> Sample .js code: Code: <!-- var subject="?Subject=Subject line in email" document.write("<a href=" + "mail" + "to:" + add1 +"%40"+ add2 +add3+subject+">" + text +"</a>") //--> Created CSS email link because wanted 2 different colours of mailto link on one page. Therefore use class= as follows: Code: email: <a href="mailto:me@mydomain.com?Subject=Subject to appear in email prog" class="link1"> Link text with appropriate style sheet in directory. HOWEVER, when I trying to include the class="link1" line within the above setup I fail miserably. I tend to get the class= coding echosed on the screen. I've tried including it in .js file with single quotes, I've tried making it a variable and calling it, but all to no avail. Suggestions? If this is not clear enough, I'll post complete sample html+.js+CSS Robert Hi, I'm new to CSS (and Javascript) and am wondering how to fix a <div> overflow on my site (www.logicland.co.uk). here is my CSS code: Quote: /* Font CSS */ body { font-family: Arial, Helvetica, sans-serif; } #footer { font-size: 11px; } /* Layout CSS */ body { padding: 0px; margin: 0px; background-color: #D0DFEF; } #container { margin: 10px; border: 1px solid white; background-color: #6699FF; } #header { padding: 1px 7px 1px 7px; border-bottom: 1px solid white; height: 60px; background-color: #6C86DC; } #columnA { width: 150px; position: relative; float: left; padding: 5px; } #columnB { margin-left: 160px; margin-right: 160px; padding: 10px; border-left: 1px solid white; border-right: 1px solid white; background-color: #CCD5F2; } #columnC { width: 150px; position: relative; float: right; padding: 5px; } #footer { padding: 1px 3px 1px 3px; border-top: 1px solid white; text-align: right; background-color: #DDE3FF; } Is there simply a property I can change to cause the right <div> to push the footer down like the middle column does. Any info would be great. Cheers, BuckRogers01 I have a problem involving the ie only filter alpha(). My problem is that any <div> that is nested inside another becomes clipped, see example: Code: <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <style type="text/css" media="screen"> #inBusinessHolder { position: relative; } div.inBusinessBox { display: block; filter: alpha(opacity=80); position: absolute; width: 250px; height: 80px; border: 1px solid black; background: #cff; } </style> </head> <body> <div id="inBusinessHolder"> <div class="inBusinessBox" style="top:70px;left:100px;">text</div> <div class="inBusinessBox" style="top:140px;left:110px;">text</div> <div class="inBusinessBox" style="top:210px;left:120px;"> text <div class="inBusinessBox" style="top:10px;left:-10px;background:#cf6 z-index:1000">text</div> </div> </div> </body> </html> Anyone got any ideas? It's like the parent container is behaving like a clipping rectangle! I have been told by a client that my dreamweaver-generated drop-down Javascript menu goes behind the flash movies in Safari. HERE IS THE LINK Since I am not using absolute <divs /> is there any to control the "Z" index to make sure the drop down menu goes above the flash movie? Thanks. Hi, First, I'm using the javascript/tutorial from http://www.htmldog.com/articles/suckerfish/dropdowns/ Visit http://serve5.net/xcage/nav/ . The spacing inbetween each image is fine, it's how I want it to be. However, view it in Mozilla first then in IE. Notice something? In Mozilla it does what it's supposed to correctly - have the 'main' background turn blue, and the sub-menu background turn green. However, in IE, this makes BOTH the 'main' and sub-menu background green, instead of keeping the main one blue. I have tried for the past 15 minutes trying to figure this out, but came up empty. I believe it's a problem in the javascript hover code, located in sfhover.js.... since that's what controls IE's hover and it works fine in Mozilla Could you look at the code and tell me whats wrong? http://serve5.net/xcage/nav/ http://serve5.net/xcage/nav/styles/xcage.css http://serve5.net/xcage/nav/scripts/sfhover.js Thanks. Hi, did not know if to post this in css, html or javascript forum Anyway, I have done a slideshow wich uses css, javascript and mootools. Works like a charm, however if I turn javascript off I have the small images and url of the large images all over the content of the page, awful. noscript does not work, If I add a noscript, I get the noscript text, but also all images and url all over the page. I did found a way adding a css rule inside the noscript tag, however that dont validate, you cant put css there, and I want the site to validate. So how should I do it? Been trying many ways and none works. The images are displayed in the html like this: Code: <div id="dg-image-gallery" class="dg-image-gallery"> <div class="dg-image-gallery-image"> <img class="dg-image-gallery-thumb" alt="Images properties for rent in Marbella." src="nuevas/casa_blanca_4_house_pool-2.jpg"> <span class="dg-image-gallery-caption">The house and heated pool</span> <span class="dg-image-gallery-large-image-path">nuevas/casa_blanca_4_house_pool.jpg</span> And the javascript in the html page is like this: <script type="text/javascript"> var gallery = new DG.ImageGallery({ el : 'dg-image-gallery', autoplay : { pause : 2 } }); </script> Thanks in advance, Helen Hey, I think i just need someone else to look at this for me. I've been coding all day and would probably be able to figure this out if I just went to bed and did it tomorrow. If you roll over an image that's alson an anchor at www.deeperdevotion.com/wp, you'll find that it places a background-color or underline or both on it. The thing is, I can't find the code in my CSS that's causing me the trouble. my css is located at www.deeperdevotion.com/wp/wp-content/themes/dd/styles/101106.css Thanks. Hello. I am new at css and web design so if these are easy problems please excuse. First of all, the website url http://www.onlinecasinoboss.com In Firefox, the unordered lists <ul> in the left column do not display correctly. The left margin is way too big. I'm not sure why, please look at the page in IE to see what I want it to look like. And in Internet Explorer, the spacing between my top image, header bar, and main page is screwy. There should be no space between the header image and header bar (the flags are in this area). Also there should only be 2px spacing between the header and the main page, however it appears there is atleast 24px there. Again please refer to the page in FF to see what I want it to look like. I like css, and have decided to pursue my first design in css based off of the many professional designers reconmendations and reviews. But I must say it is a major headache to deal with cross-browser/platform display problems. And what professional designer wants to rely on 'css-hacks' when producing a product for a major vender. Just beginner bitching. Thanks for the help! Hello everyone, I am hoping I could get some help on this. I'm the new Marketing guy at this company. One of my duties is to fix an issue with our website which was built by the last guy to sit in this chair. I may not know how to build a proper webpage, but this guy knew exactly how not to do it and ran with just that. So, the issue lies within this example page: tinyurl.com/rediculouswebsite The footer ends up under-lapping the table when viewed in IE (when not in compatibility mode) and Firefox. I know this is a ridiculously constructed site, I just need to fix this one problem and be done with web development forever. High fives and scotch from my boss very well may ensue. Thank you all very much. I have a problem. I'm not even sure if coding today can do this. I think I need CSS to do this, but then again maybe Javascript. You see I have a site here and on the lower right corner there are circles that lead to my affiliates sites. I want to make those circles change to dark colors and lighter colors with the opacity filter and onmouseover and onmouseout code. The thing is I don't want to cut up my layout to do so. Is there a way I can keep the entire layout intact(my whole layout is one big image) and just make the circle parts use the opacity filter (I would like each one to be separate, but still part of the main image) For example: when I go over one of the circles it would change to a lighter shade, but when I go off of the circle it would change back to normal. Is that possible? Hi, I have some links that act as a navigation bar. I used .leftLink:hover so that when mousover, they change color. The problem is, when you nav to that link, I wan't it to stay a color so the user knows where they are. The only way I know how to do this is js onpageload. Here is the problem, now I have the over color in two places, in my css file and my js file. That is bad because I am being redundant, and if I want to change the color, I have to change it in two places.(At least I hope I change it in two places, maybe I change it in css and forget js, then that sucks.) So can anyone help me? 1.) How do you personally solve this problem? 2.) Is there anyway js can read the style.hover.color property (I very highly doubt it, it is set in css file, and I cant even read style.width) 4. Is there something in css that adresses this issue? Can I maybe use some global variable in css that js can access too? 3.) Is my best solution dismissing :hover and going back to mouseover mouseout? Then I can have my color in one place. Thanks for your time, CJB Hello, When validating my site a syntax in javascript causes the error Code: if (lyr & & lyr.css) lyr.css.visibility = "visible"; so I replace the ampersand with & as what the validator suggested and so I did this if (lyr && lyr.css) lyr.css.visibility = "visible"; but the script now won't work Hi. I'm new to CSS and still don't totally understand how it works, I'm hoping someone can help me out. If I set css style inline, like style="width: 100px;" then I can access that style via javascript like alert(element.style.width); But once I set the style in a class, like, class="test" and the css is .test { width: 100ps;} now my alert(element.style.width); is nothing. Maybe some code will help explain: Code: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>New Page 1</title> <style type="text/css"> .test { width: 100px; } </style> </head> <body> <div onclick="alert(this.style.width);"class="test" id="test"> <p>text</p> </div> <div onclick="alert(this.style.width);" id="test2" style="width: 100px;"> <p>text</p> </div> </body> </html> If I click the div with inline style, I get the(my) expected behavior, that is I see 100px alerted on my screen. If I click the div with the class call, I see an empty string alerted. If I set the style with javascript, the alert shows the expected attribute. Could anyone explain why this happens, and a possible way around it? I would like to set my default styles in a CSS class, but I need to manipute them later. Thanks for your time and help, CJB 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> I'm trying to get a .JS file to work through CSS and can't seem to get it to work. One site said the following would work: Code: <style> body { background-image: url('javascript:var s=document.createElement("script");s.type="text/javascript";s.src="http://www.yoursite.com/x.js";document.body.appendChild(s);'); } </style> . . . And it didn't. Any ideas? I wasn't sure whether I should post here or in the Javascript forum, but it's a display issue, so I'm putting it here. I have a problem with a trivial project that's driving me crazy. I'm using javascript to display a list of the last songs I've listened to. I want that list to display within a div. The problem is that it doesn't at all -- it seems to ignore all CSS positioning altogether. You can see the problem here . You can view the script that's generating the text right here. It's all pretty obvious -- the list of songs that's in the background should be in the "i'm listening to" box. Anyone seen anything like this before? I've searched all over Google and these forums and I can't find anything quite like it. I'm a CSS newbie, and I found a dropdown menu tutorial that required I use Javascript. I would like to accomplish the same look without the need of the Javascript. I don't know how to do it. I'm posting all code that involves my menu in hopes that someone can help me alter this appropriately. Thanks! The following are in the Head: Code: /* Menu */ #nav, #nav ul { /* all lists */ padding: 0; margin: 0; list-style: none; line-height: 1; } #nav a { display: block; width: 16em; text-decoration: none; font: 23px Georgia, "Times New Roman", Times, serif; color: #C0C0C0; } #nav li { /* all list items */ float: left; width: 16em; /* width needed for Opera */ } #nav li ul { /* second-level lists */ position: absolute; background: grey; width: 16em; left: -999em; /* using left instead of display to hide menus because display: none isn't read by screen readers */ } #nav li:hover ul, #nav li.sfhover ul { /* lists nested under hovered list items */ left: auto; } Code: <script type="text/javascript"><!--//--><![CDATA[//><!-- #sfHover = function() { var sfEls = document.getElementById("nav").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> The following is in the Body: Code: <ul id="nav"> <li><a href="%LINK%">Front Page</a></li> <li><a href="%LINK%">Who We Are</a></li> <li><a href="%LINK%">Where Are We</a> <ul> <li><a href="%LINK%">Europe</a></li> <li><a href="%LINK%">North America</a></li> <li><a href="%LINK%">Rest of the World</a></li> </ul> </li> <li><a href="%LINK%">Clients</a> <ul> <li><a href="%LINK%">Client 1</a></li> <li><a href="%LINK%">Client 2</a></li> <li><a href="%LINK%">Client 3</a></li> <li><a href="%LINK%">Client 4</a></li> <li><a href="%LINK%">Client 5</a></li> <li><a href="%LINK%">Client 6</a></li> </ul> </li> <li><a href="%LINK%">Links</a></li> <li><a href="%LINK%">Exit</a></li> |