HTML - Help.. Image Not Lining Up
Can someone please help me out. I created a website and in one of the divs the image is going out of place.
This image is placed over a larger image. the code for that div is HTML Code: <div id="bottom_blockl"> <h1>What's hot right now?</h1> <div class="c18"> {% for b in beasts %} <div class="bottom_item"> <img src="{{b.image_url}}" height="40" width="40" class="c14" /> <span class="c20">{{b.name}} found a level {{b.level}} </span> <span class="c16">{{b.race}}</span> <div class="c17"> <div class="att">Att:{{b.attack}}</div> <br /> <div class="def">Def:{{b.defense}}</div> </div> </div></div> </div> div.c18 {width:500px;height:300px;overflow:hidden;} div.c17 {float:right; width:61px;margin-right:15px;margin-top:-24px;} span.c16 {color:#fc2c1a} img.c14 {float:left;} span.c20{margin-right:auto;margin-left:auto;} .bottom_item{ float:none; clear:both; background-image:url(img/bottom-item-box.png); height:86px; font-size:20px; color:#4c4c4c; Similar TutorialsThese image icons are to the left of the corresponding text. The text, lines up on the same line as the image. When viewed, because they line up on the same line, the image is next to the text and bigger than the text (see attached image). How can I line the text up next to the middle of the image rather than how it lines up now, which is next to the bottom of the image? thanks Code: <font face="Arial" color="#000000" size="3"><IMG src="/images/hphone.gif"> <a href="?action=login"> Home</a><br><br> <IMG src="/images/hphone1.gif"><a href="?action=register"> Register</a><br><br> <IMG src="/images/hphone2.gif"> <a href="?action=faq"> FAQ</a><br><br> <IMG src="/images/hphone3.gif"> <a href="? action=terms"> Terms Of Use</a><br><br> <IMG src="/images/hphone4.gif"> <a href="?action=contact"> Contact Us</a><br><br> <IMG src="/images/hphone5.gif"><a href="?action=forgotpass"> Forgot Password</a><br><br> <IMG src="/images/hphone6.gif"><a href="?action=forgotusername"> Forgot Username</a><br></font> http://tbsnyder.com/site/ I have a simple nav background image setup and I tried lining the text up which works perfectly on my Mac browsers (safari and firefox), but when I opened the site up on my Windows machine, I got this: http://tbsnyder.com/site/difference.png Two differences: the text has more weight on the Mac browsers and it doesn't line up correctly in the PC browsers. Anyone understand why this is? I'm just using a standard font family (arial, helvetica, sans-serif) - why would they appear different between Macs/PCs? Am I setting this up incorrectly in css? CSS: Code: .homeBtn { padding: 0px 12px 0px 0px; } .theSystemBtn { padding: 0px 12px 0px 0px; } .workoutsBtn { padding: 0px 11px 0px 0px; } The html is just an unordered list as you can see from the source. I like the look of the heavier weighted text if I can keep it like that. I would really appreciate any kind of knowledge or assistance in the issue of correctly matching text to background images in a nav bar. Hi I am new here. I play an online game that involves layouts. I had someone make me a layout (here is link: <a href="http://img.photobucket.com/albums/v72/raindrop/Layouts/acreswestlayoutcopy.jpg" target="_blank" rel="nofollow">http://img.photobucket.com/albums/v72/rain...tlayoutcopy.jpg</a>) for the site. In this the blue text box above the horse, when you go to write, you can put text in it. How is that possible. I am trying to make my own, so how do you line it up, that when you type, it goes into that box? Please let me know. Thanks! -AW- Me again! One more question: If you look at: http://www.studio209.com/stumptown_e...youritems.html The words and the form fields are not lining up (we've tried everything: "align=top, middle, bottom"... etc.) But, here's another site we did a few months ago: http://www.brownprn.com/requestestimate.htm and they line up!! How did we do it?? Help!! I'm having some trouble with the two scrolls. How do I align them to match up to the picture? This is my code: HTML Code: <table border="0" cellpadding="0" cellspacing="0" width="700" height="700" background="http://img255.imageshack.us/img255/220/noridfg4.jpg"> <tr> <td width="36"></td> <td width="354" valign="bottom"> <div style="overflow: auto; height: 398px; width: 290px; padding: 0px; border: 1px black solid"> </div> </td> <td valign="bottom"> <div style="overflow: auto; height: 292px; width: 220px; padding: 0px; border: 1px black solid; margin-left: auto;"> Write text here </div> </td></tr><tr> <td height="80"></td> <td></td><td></td></tr></td></tr></table> Hello, I'm trying to line up some tables unsuccessfully. What I'm trying to do is create a page with tables of 45% width which are staggered. In other words, I'd have one table in the normal upper-left portion, but the next table would begin about 100px below that one vertically, aligned to the right. The third table would be about 100px below the first, the fourth about 100px below the second (again right-aligned), and so on - staggerd in a zig-zag pattern. I can't achieve anything close to my desired effect. In fact, one of my tables isn't even aligning to the right side of the page! I have overlap, and just many problems. I'd appreciate any help. I obviously need some help with my <tr> and <td>'s. On my basic web page I have a top header, left side column and right side content, but I have the rows or tables wrong. The right side content isn't all the way to the top header, as you can see from my attached image, and code below. Help. thanks. Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>webpage</title> <meta name="description" content=""> <meta name="description" content=""> <meta name="keywords" content=""> <link href="custom.css" rel="stylesheet" type="text/css"> </head> <body> <table width="770" border="0" cellpadding="0" cellspacing="0" id="maintable"> <tr> <td colspan="2" id="topline"> </td> </tr> <tr> <td colspan="2"><img src="images/to.jpg" alt="" width="461" height="134"><img src="images/to.jpg" alt="" width="309" height="134"></td> </tr> <tr> <td><img src="images/greyline.gif" alt="" width="174" height="8"></td> <td><img src="images/orangeline.gif" alt="" width="596" height="8"></td> </tr> <td width="174" align="left" bgcolor="#A30100"> <form method="POST" action="index.php"> <input class='field' type='hidden' name='command' value='account'> <input class='field' type='hidden' name='param' value='login'> <br> <font color="white"><font face="Arial"> User Name</font><br> <input style='height:18px' class='field' type='text' size='18'maxlength="30" name='user_name' value='[user_name]'> <br><br> <font color="white"><font face="Arial"> Password</font><br> <input style='height:18px' class='field' type='password'size='18' maxlength="30" name='password' > <br><SPAN style='font-size:11px'>[login_message]</SPAN> <br><A href='index.php?command=send_pass'> <SPAN style='font-size:11px;'><font color="white"><center><font face="Arial">Forgot Password?</font></SPAN></A><br /><input class='button' type='submit' value='Login'></center> </form> <tr> <td id="menu"><img src="images/bullet.gif" alt="" width="10" height="10"> <a href="index.html">Home</a><br> <img src="images/bullet.gif" alt="" width="10" height="10"> <a href="/catalog"></a><br> <img src="images/bullet.gif" alt="" width="10" height="10"> <a href="faq.html">FAQ</a><br> <img src="images/bullet.gif" alt="" width="10" height="10"> <a href="resume_faq.html"></a><br> <img src="images/bullet.gif" alt="" width="10" height="10"> <a href="about_us.html">About Us</a><br> <img src="images/bullet.gif" alt="" width="10" height="10"><a href="/catalog/index.php?act=contactus" target="_self" class="txtSiteDocs"> Contact Us</a><br> <img src="images/bullet.gif" alt="" width="10" height="10"> <a href="legal.html"></a><br> <td id="maincontent-subpages"> <font face="Arial" color="#000000" size="4"><b> Got Too Much</b><br><font face="Arial" color="#990000" size="4"><b> Change And Go!!!!</b></font><br> <font color="#FF9900">______________________________________________________</font><br> <P><font face="Arial" color="#6B6B6B" size="3"> Turn<br><font face="Arial" color="#000000" size="3"> Change</font><br> </font><br><br> <font face="Arial" color="#000000" size="2"><b> Why</font><font face="Arial" color="#990000" size="2"><br> Turn</b><br></font> <font face="Arial" color="#6b6b6b"size="2"> <br> whenever it's convenient. <br> <br><br> <div style='float:left;width:47%;border:none;'><font face="Arial" color="#EE7600" size="4"> <img src="images/reading.jpg" alt="" width="25" height="25"> <b> TEXT</b></font><font face="Arial" color="#6B6B6B" size="2"> <br> is great, but requires everything that <br> your full <br> your day.</div> <div style='float:left;width:47%;border:none;margin-left:1%;border-left:0px black solid;'><font face="Arial" color="#EE7600" size="4"><img src="images/listening.jpg" alt="" width="25" height="25"><b> </b></font><font face="Arial" color="#6B6B6B" size="2"><br> while multi-tasking, <br> .</font></div> <br><br> <font color="#990000">________________________________________________________________________</font><br><br> <br> <font color="#000000"> 1..<br> 2. <br> 3. Download ).</font><br> <font color="#990000">________________________________________________________________________ </font><br><br><br> <font face="Arial" color="#6B6B6B" size="2"> productive and accomplish more.<br> </font> <br><br><font face="Arial" color="#303030" size="2"><b> . <font face="Arial" color="#990000" size="2">.</font> Right Now!</b></font><P> </td> </tr> <tr> <td><img src="images/greyline.gif" alt="" width="174" height="8"></td> <td><img src="images/orangeline.gif" alt="" width="596" height="8"></td> </tr> <tr> <td id="footer" colspan="2"></td> </tr> </table> </body> </html> Rather than re-write this page and the css, I'd just like to fix what I'm working with, please. This page is not lining up correctly, as you can see from the attached image. All the text content should be to the right of the (left) red column and the red column is supposed to be the width of the gray bar above it. (The header is a separate piece of this page) Can you help me get the left red column to the correct width and all the text content to the right of the red column? thanks. Here's my code: Code: <table valign='top' align="right" cellpadding="0" width="100%" height="80%"> <table style="background-color:#ffffff; font-family:Arial, Helvetica, sans-serif; width:100% height:80%> <table width="770" border="0" cellpadding="0" cellspacing="0" id="maintable" align="center"> <link href="custom.css" rel="stylesheet" type="text/css"> <tr><td id="menu" align="left"> <img src="images/bullet.gif" alt="" width="10" height="10"><a href="index.php"><font color="#DDCEA2"><font face="Arial" size="2">Home</a></font><br> <img src="images/bullet.gif" alt="" width="10" height="10"><A href='index.php?command=signup_page'><font color="DDCEA2"><font face="Arial" size="2">Sign Up</font></A><br /> <img src="images/bullet.gif" alt="" width="10" height="10"><a href="faq.html"><font color="DDCEA2"><font face="Arial" size="2">FAQ</a><br> <img src="images/bullet.gif" alt="" width="10" height="10"><a href="legal.html"><font color="DDCEA2"><font face="Arial" size="2">Terms of Use</a><br><br><br><br><br><br><br><br> </tr> <form method="POST" action="index.php"> <input class='field' type='hidden' name='command' value='account'> <input class='field' type='hidden' name='param' value='renew'> <input class='field' type='hidden' name='account_id' value='[account_id]'> <td colspan='2' class='pageTitle'><div class='hLine'><font face="Arial" color="#EE7600" size="3"> Choose a Transaction</font></div></tr></td> <tr><td class='fieldLabel' width="30%"><font face="Arial" color=#000000" size="3" Style="padding: 5px;"> <font face="Arial" color="#000000" size="2"> Transaction Type:</font></td> <td align="left"><font face="Arial" color="#EE7600" size="2">[account_type_panel]</font></tr> <tr> <tr><td> </td></tr> <tr><td align="left"> </td> <td align="left"><input name="submit" type='submit' class='button' value='Next' /> </td> </tr> </form> <tr height='30%' ><td colspan="2"><div class='hLine'> </div></td></tr> </table> im ne to html and css, im going to be redoing some sites and just playing around ith some things, can someone give me a quick fix for this: http://lilions.com/testnew/ Im trying to line up this backound with the banner its lines up in IE but not fixfox Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <html> <body background ="http://lilions.com/home/images/bbck.jpg"> <center><div style="text-align:center; width:1000px; margin-left:auto; margin-right:auto;"> <img id="Image-Maps_5201103220251287" src="http://lilions.com/home/images/newban.jpg" usemap="#Image- Maps_5201103220251287" border="0" width="1000" height="500" alt="" /> <map id="_Image-Maps_5201103220251287" name="Image-Maps_5201103220251287"> <area shape="rect" coords="8,433,70,460" href="http://lilions.com/home/" alt="" title="" /> <area shape="rect" coords="73,433,135,460" href="http://lilions.com/news/" alt="" title="" /> <area shape="rect" coords="145,433,212,460" href="http://lilions.com/roster" alt="" title="" /> <area shape="rect" coords="227,434,360,461" href="http://lilions.com/coachingstaff" alt="" title="" /> <area shape="rect" coords="373,435,482,462" href="http://lilions.com/frontoffice" alt="" title="" /> <area shape="rect" coords="500,434,578,461" href="http://lilions.com/schedule" alt="" title="" /> <area shape="rect" coords="593,433,683,460" href="http://lilions.com/standings" alt="" title="" /> <area shape="rect" coords="697,434,784,461" href="http://lilions.com/statistics" alt="" title="" /> <area shape="rect" coords="798,434,872,461" href="http://lilions.com/history" alt="" title="" /> <area shape="rect" coords="889,433,974,460" href="http://lilions.com/fieldinfo" alt="" title="" /> <area shape="rect" coords="15,467,84,494" href="http://lilions.com/fanzone" alt="" title="" /> <area shape="rect" coords="104,466,179,493" href="http://lilions.com/gallery" alt="" title="" /> <area shape="rect" coords="199,467,269,494" href="http://lilions.com/tickets" alt="" title="" /> <area shape="rect" coords="287,468,372,495" href="http://lilions.com/calander" alt="" title="" /> <area shape="rect" coords="386,467,498,494" href="http://lilions.com/sponsorship" alt="" title="" /> <area shape="rect" coords="519,468,632,495" href="http://lilions.com/applications" alt="" title="" /> <area shape="rect" coords="654,466,745,493" href="http://lilions.com/contact" alt="" title="" /> <area shape="rect" coords="763,466,982,493" href="http://fivestarfootballleague.com/" alt="" title="" /> </map></div></center> </body> </center> </html> Hi everyone. I just joined up in hopes that someone here can help me figure something out that's been driving me nuts for days. I am trying to create some content boxes for the sidebar of my blog. I've managed to create the actual boxes, but then I want to make a new one with two columns to put link badges in. Below is the code I have so far.... <style type="text/css"> <!-- .container_sidebar_about { width:225px; height:64px; background-image:url(http://dougcloud.net/show/headlinklove.png); } .container_sidebar { width:203px; background:#FEF6D2; font-family:Arial, Helvetica, sans-serif; border-width: 0px 1px 1px 1px; border-spacing: 0px; border-style: none solid solid solid; border-color: #4F3314; padding:10px; margin:0 0 20px 0; font-family: 'Trebuchet MS', sans-serif;color: #4F3314; font-size:11px; } a:link {font-family: 'Trebuchet MS', sans-serif;color: #4F3314;} a:visited {font-family: 'Trebuchet MS', sans-serif;color: #ba742a;} --> </style> <div class="container_sidebar_about"></div> <div class="container_sidebar"> <div style="width:100px;float:left;text-align:center;">I have always had the uncanny knack of visualizing how something should look and in 1998, after purchasing my first computer, I started making small graphic things for friends - web buttons, guest book designs, etc.</div> <div style="width:100px;float:right;text-align:center;">I have always had the uncanny knack of visualizing how something should look and in 1998, after purchasing my first computer, I started making small graphic things for friends - web buttons, guest book designs, etc.</div> </div> With this code the text displays in two columns, but it does not appear to be inside the main div with the background color and 1 pixel border. I would like to know what I'm doing wrong so I can make this work properly. I appreciate any help. My images that I now want to line up horizontally are lining up vertically, But the cache is I want them centered where they are, just next to each other. I tried CSS and the only way I found was to align them left. This defeats the whole purpose. Any idea? Also, when I set img {display: inline; } it works, but I'm using that to fix another problem in which it needs to be set to block. Code: <div id="icons"><a href="http://www.facebook.com/group.php?gid=29231967389"><img src="images/icons/facebook.png"/></a> <a href="mailto:"><img src="images/icons/email.png"/></a> <a href="/news/rss.php"><img src="images/icons/feed.png"/></a></icons></div> Code: #icons { display: inline; } Sorry for posting in possibly the wrong forum, but it is HTML and CSS? I'm trying to build a website in frames and am currently just putting together some test stuff for it. I'm trying to build a background, but when I place the separate parts of the overal image, there is spacing between the frames in places I don't want it; for example, the image in the left frame is significantly below the top frame, and there is a gap between it and the center frame. How can I fix this? I have frameborders set to 0, 0 framespacing, 0 margin width and height, and no borders present. Any help would be appreciated. There are 2 images below, to help explain what I mean. The first is how the top and left frames look, and the second is how the overall thing should appear. Hi, I was trying to develop a page in HTML/CSS but having some difficulties. I have created many pages before but this one is giving me a hard time. What I have done differently this time it, i have used Positioning tags. The problem i am having is I can not set any two divs or images side by side. If i set 1 image and 1 div side by side they are being placed on top of each other. But, i may be going crazy here, i was able to place the top two divs side by side (logo and privacy_protected). Can any one please tell me what i am doing wrong or what i should do? Here is the code that i am using: Code: <body> <div id="wrapper"> <div id="bodypic"> <div id="logo"><a href="index.html"><img src="images/transparent.png" width="319" height="100" border="0" /></a></div><!--logo --> <div id="privacy_protected"></div><!--privacy_protected --> <img src="images/transparent.png" height="29" width="1020"/> <div id="728block"> <img src="images/transparent.png" height="89" width="18" style="float:left"/> <div id="728adunit"><img src="images/728x90.jpg" width="728" height="90" /></div><!--728adunit --> <a href="#"><img src="images/transparent.png" height="89" width="23" style="float:left"/></a> <a href="#"><img src="images/transparent.png" height="45" width="219" style="float:left"/></a> <a href="#"><img src="images/transparent.png" height="43" width="202" style="float:left"/></a></div><!--728adblock --> </div><!--bodypic --> </div><!--wrapper --> </body> And the CSS Code: #wrapper { height: 1174px; width: 1024px; margin-right: auto; margin-left: auto; } #bodypic { background-image: url(images/wrapper.jpg); float: left; height: 1174px; width: 1024px; } body { background:#FFF; font-family:Arial, Helvetica, sans-serif; text-align:justify; font-size:14px; } a:link { color: #06F; text-decoration: none; } a:visited { text-decoration: none; color: #06F; } #logo { background-image: url(images/Editorial_v3-1_01.gif); float: left; height: 103px; width: 498px; } #privacy_protected { background-image: url(images/Editorial_v3-1_02.jpg); float: left; height: 103px; width: 526px; } #728block { float: left; height: 91px; width: 1024px; } #728adunit { float: left; height: 90px; width: 728px; } a:hover { text-decoration: underline; color: #06F; } a:active { text-decoration: none; } Please help! Hi all -- I'm having an interesting problem. I'm designing a web page that has a navigation banner (home - programs - schedule of events - contact us - downloads) that is made up of a .png for each page (i.e. home.png, programs.png, etc). My page is 1000px wide and all of the navigation banner's images add up to 1000px wide. I'm using JavaScript to create an onMouseOver and onMouseOut effect on each of the images. The problem that I'm having occurs when I tried to add a link (either by <A HREF= or using an image map). Whenever I add a link to the image, a small (3px) area of white space shows up to the right of the image. This shifts all of my other images 3px to the right (and 3 more for each link I add to subsequent images) thus making the total width of the navigation banner over 1000px and the last image gets shoved to a new line. I can find no way to get rid of this white space other than to remove the link from the image. There is no property on the page that adds any sort of padding, margins, or borders to images or links, so I can see no property that has to be changed. Help! How do I get rid of this white space but still keep the link on the image?? [I posted this question on the Adobe forum to no avail, below is a screencap I took of the issue I'm having] Thanks in advance! //kl PS - I am using both IE8 and Chrome to view this webpage. I've set all the margins/padding/borders to 0px. Here is my CSS and the part of the code that pertains to the navigation banner. CSS: Code: <style type="text/css"> <!-- body { font: 100% Verdana, Arial, Helvetica, sans-serif; background: #666666; margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */ padding: 0; text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */ color: #000000; background-image: url(images/blue.bg.png); background-repeat: repeat; background-color: #009; } .oneColFixCtr #container { width: 1000px; /* using 20px less than a full 800px width allows for browser chrome and avoids a horizontal scroll bar */ background: #FFFFFF; margin: 0 auto; /* the auto margins (in conjunction with a width) center the page */ border: 0px solid #000000; text-align: left; /* this overrides the text-align: center on the body element. */ } .oneColFixCtr #mainContent { padding: 0 20px; /* remember that padding is the space inside the div box and margin is the space outside the div box */ } body, td, th { color: #333; } #main_banner2 { margin: 0px; padding: 0px; height: auto; width: 1000px; } --> </style> </head> Nav Banner: NOTE:: below HAS to be all one paragraph because if i insert a carriage return in between images, it also adds the white space... Code: <body class="oneColFixCtr"> <!-- MAIN NAVIGATION BANNER --> <!--HOME--><img src="images/nav/home.png" alt="home" name="home" width="82" height="30" border="0" onMouseOver="document.images.home.src='images/nav/home_over.png'" onMouseOut ="document.images.home.src='images/nav/home.png'"/><!--PROGRAMS--><img src="images/nav/programs.png" width="111" height="30" border="0" name="programs" onMouseOver="document.images.programs.src='images/nav/programs_over.png'" onMouseOut ="document.images.programs.src='images/nav/programs.png'"/><!--SCHEDULE OF EVENTS--><img src="images/nav/scheduleofevents.png" width="189" height="30" border="0" name="scheduleofevents" onMouseOver="document.images.scheduleofevents.src='images/nav/scheduleofevents_ over.png'" onMouseOut ="document.images.scheduleofevents.src='images/nav/scheduleofevents.png'"/><!-- CONTACT US--><img src="images/nav/contactus.png" width="119" height="30" border="0" name="contactus" onMouseOver="document.images.contactus.src='images/nav/contactus_over.png'" onMouseOut ="document.images.contactus.src='images/nav/contactus.png'"/><!--DOWNLOADS--><i mg src="images/nav/downloads.png" width="267" height="30" border="0" name="downloads" onMouseOver="document.images.downloads.src='images/nav/downloads_over.png'" onMouseOut ="document.images.downloads.src='images/nav/downloads.png'"/><!--FACEBOOK--><im g src="images/nav/facebook.png" width="90" height="30" border="0" name="facebook" onMouseOver="document.images.facebook.src='images/nav/facebook_over.png'" onMouseOut ="document.images.facebook.src='images/nav/facebook.png'"/><!--TWITTER--><img src="images/nav/twitter.png" width="67" height="30" border="0" name="twitter" onMouseOver="document.images.twitter.src='images/nav/twitter_over.png'" onMouseOut ="document.images.twitter.src='images/nav/twitter.png'"/><!--BLOGGER--><img src="images/nav/blogger.png" width="75" height="30" border="0" name="blogger" onMouseOver="document.images.blogger.src='images/nav/blogger_over.png'" onMouseOut ="document.images.blogger.src='images/nav/blogger.png'"/><img src="images/home_banner.png" alt="home_border" width="1000" height="7" /><br /> So in January 2006 I posted a question about "making two buttons in one" 3 years and 5 months later i am happy to announce that I have found a solution. Ok, so no I have not spent the last three years looking, but the need for one came around again yesterday so I revisited the project. All I needed was "simple" image toggle. Image 'A' click it once it changes to image 'B' click it again it changes back to image 'A' All the "image toggle" codes I could find were extremely complex. I thought I had finally found one, it wasn't perfect, but it was the smallest and most basic thing I could find. HTML Code: <html> <head> <style type="text/css"> .on {background-image:url(playlist_btn.png); background-repeat:no-repeat;} .off {background-image:url(playlist_btn_x.png); background-repeat:no-repeat;} </style> <script language="javascript"> function togglestyle(el){if(el.className == "on") {el.className="off";} else {el.className="on";}} </script> </head> <body> <div id="onoff" class="playlist_btn"><img src="blank.gif" width="50 height="50" onclick="togglestyle(onoff)"></div> </body> </html> I tested it, it worked, so I considered problem solved. I placed it in my page and nothing. Turns out it wont work with a doc type - so it's useless. Other problems, I'm not big on using "blank gif's" unless I have to, if you want multiple image toggles you need a new JS function for each one, and two lines of css as well. And, though I rarely use image rollovers anymore, it would certainly not be possible in this method. So it was back to the drawing board. Well, I had actually already found the solution a few minuets prior to finding out that the above code is so good. I had coded a button that on rollover shows a tooltip, when you click the button, the text in the tool tip, changes, chick again and it reverts. All done with a simple showHide javascript function, that i am finfing out has many uses. here is the awesome code: Code: function showHide(elementid){ if (document.getElementById(elementid).style.display == 'none'){ document.getElementById(elementid).style.display = ''; } else { document.getElementById(elementid).style.display = 'none'; } } function hideShow(elementid){ if (document.getElementById(elementid).style.display == ''){ document.getElementById(elementid).style.display = 'none'; } else { document.getElementById(elementid).style.display = ''; } } I wont take credit for the showHide code, but I will take credit for the hideShow portion, obviously a monkey could have coded the revers, but iot does make it that much more universal. As the original code was designed to show something that was hidden, add the revers to hide something that is showing and it's perfect. Now I will take a moment to say, though I have yet to find a problem with the code, it seems to work in most browsers, firefox, ie, safari, and validates for WC3 - In sure it has it's flaws. Until now, to show and hide divs I had used the MM_showHideLayers JavaScript function, which by default used the visibility style. It is of course a good script, and has many uses, it's not very big, but it is somewhat complex. The other thing to think about is that invisible objects still take up space. That's what is cool about the display:none: style, is that is not only invisible but it doesn't take up space. So here is how I used the above to JavaScript to make a simple onclick image toggle: HTML Code: <img id="on" src="on.png" width="50" height="50" onClick="javascript:hideShow('on'); javascript:showHide('off')" alt="on"> <img id="off" src="off.png" width="50" height="50" onClick="javascript:hideShow('off'); javascript:showHide('plus')" style="display:none;" alt="off"> Cool huh? Now this example does not have a rollover either, but since it uses to individual images and is not replacing one image wioth another you could easily apply a rollover to both images. But, hold on, look at the above code, isn't that essentially a rollover? Change the first onClick to onMouseOver and the second to onMouseOut and look at that a 'brand new' method for mouseovers. So lets take a look at this for a second, and compare MM_swapImage to this new hideShow method. As far as CSS rollovers I definitely prefer them to the MM_swapImage method, as they use a minimal amount of code. However they actually take a lot of math, construction the buttons is somewhat tedious, because css buttons use 1 image and change it's position, to work well you have to use a "blank.gif" and the the css can really add up if you have a lot of buttons: Also, you can't go directly to a button in the document, you have to fish through the css to make any adjustments. But they are fast, they don't need to be preloaded and... they are pretty cool. But anyway, swapImage and hideShow... The left is the MM_swapImage method. Now when you use the swapImage js you also have to use MM_swapImgRestore, MM_findObj, MM_preloadImages. You don't have to use the preload script but it does make thing work faster... supposedly, but that requires a onload script in the body tag, and if you have a lot of rollovers your body tag can get really long really quick. So what are the advantages, well we know for sure it works, and you only need on image in the document, however actualy having the image you are "swapping" too actually in the document can add functionality. So as you can see, on the right, the showHide method is, in total code, much smaller. True you do need to use two images, so the total code in the body is longer but, it's more than evened out bu the minimal JavaScript, and I think it's worth it. You don't need to use a preloader, you have full control over both images, the up and over state, and unlike the swapImage method, though it's rare you would need to, your up and over images can actually be different sizes, which is kind of cool. So here's the basic code for a rollover: HTML Code: <img id="up" src="up.png" width="50" height="50" onMouseOver="javascript:hideShow('up'); javascript:showHide('over')" alt="up"> <a href="http://google.com"><img id="over" src="over.png" width="50" height="50" onMouseOut="javascript:hideShow('over'); javascript:showHide('up')" style="display:none;" alt="over" border="0"></a> To add a link the button you just apply it to the "over state" image. And unlike swapImage, though it is overkill, you can also add a "downstate" image quite easily. So, back to the on/off button here is how you would code it using showHide with rollovers. HTML Code: <img id="on" src="on.png" width="50" height="50" onMouseOver="javascript:hideShow('on'); javascript:showHide('onover')" alt="on"> <img id="onover" src="on_over.png" width="50" height="50" onMouseOut="javascript:hideShow('onover'); javascript:showHide('on')" onClick="javascript:hideShow('onover'); javascript:showHide('offover')" style="display:none;" alt="onover"> <img id="off" src="off.png" width="50" height="50" onMouseOver="javascript:hideShow('off'); javascript:showHide('offover')" style="display:none;" alt="off"> <img id="offover" src="off_over.png" width="50" height="50" style="display:none;" onMouseout="javascript:hideShow('offover'); javascript:showHide('off')" onClick="javascript:hideShow('onover'); javascript:showHide('off')"alt="offover"> So here is what is going on: you have the upstate on.png image, when you mouse over it on.png is hidden and on_over.png is displayed. When you click on_over.png it is hidden and off_over.png is display, mouse off it and off.png is displayed. Make scene? Now be aware, when you click, you are also in a scene "mousing off" so some flickering can occur. Firefox handles everything pretty well, IE and Safari not so much. When you click the on_over.png the click tells it to hide on_over.png and show the off_over.png, at the same time the mouseoff tells it to hide on_over.png and show the on.png. So fortunately the toggle with rollovers isn't perfect, but perhaps some more tweaking of the code or maybe, in this case swapImage would work better to do the rollovers... But all in all I'd say its a solid concept. If you feel compiled to do so, reply with any comments, concerns or flaws you see. Hey guys. I need a little help with my HTML image rotator. Everything works fine, except the images don't show up on the right slide. All 4 images show up on the first slide. I can't figure out what's wrong. Any help will be greatly appreciated. Code: <!DOCTYPE html> <html> <head> <title>...</title> <style> #sliderwrap { height: 403px; } #sliderleft { width: 10px; height: 100%; float: left; background: #efefef; border: 1px solid #ccc; } #sliderleft div { height: 100px; border-bottom: 1px solid black; } #slidercontent { position: relative; width: 650px; height: 100%; float: left; border: 1px solid black; overflow: hidden; } #sliderimages { position: absolute; -webkit-transition: all .5s ease-in-out; -moz-transition: all .5s ease-in-out; -ms-transition: all .5s ease-in-out; -o-transition: all .5s ease-in-out; transition: all .5s ease-in-out; } #sliderimages img { display: block; } .s0 #slide0, .s1 #slide1, .s2 #slide2, .s3 #slide3 { background: #ccc; } .s0 #sliderimages {top: 0 } .s1 #sliderimages {top: -500px} .s2 #sliderimages {top: -1000px} .s3 #sliderimages {top: -1500px} </style> <script> var slide = 0; var interval_id = 0; function stop_timer() { clearInterval(interval_id); if (this.getAttribute("data-slide")) { slide = parseInt(this.getAttribute("data-slide")); document.getElementById("sliderwrap").className = "s" + slide; } } function start_timer() { clearInterval(interval_id); interval_id = setInterval( function() { slide = (slide + 1) % 4; document.getElementById("sliderwrap").className = "s" + slide; }, 3000 ); } window.onload = function() { start_timer(); var el = document.getElementById("slidercontent"); var divs = document.getElementById("sliderleft").getElementsByTagName("div"); for (var i = 0; i < divs.length; i++) { divs[i].onmouseover = stop_timer; divs[i].onmouseout = start_timer; } el.onmouseover = stop_timer; el.onmouseout = start_timer; } </script> </head> <body> <div id="sliderwrap" class="s0"> <div id="sliderleft"> <div id="slide0" data-slide="0"></div> <div id="slide1" data-slide="1"></div> <div id="slide2" data-slide="2"></div> <div id="slide3" data-slide="3"></div> </div> <div id="slidercontent"> <div id="sliderimages"> <img src="http://i.imgur.com/8iWz6.jpg"> <img src="http://i.imgur.com/1d2U6.jpg"> <img src="http://i.imgur.com/8iWz6.jpg"> <img src="http://i.imgur.com/1d2U6.jpg"> </div> </div> <div style="clear: both;"></div> </div> </body> </html> the title makes it sounds really confusing. Ok im making my first website, and i need help with a code, (as you can see on www.dalekblaster.co.uk) i have got a section at the top where the images change from one to another. The code is - HTML Code: // Set slideShowSpeed (milliseconds) var slideShowSpeed = 5000; // Duration of crossfade (seconds) var crossFadeDuration = 5; // Specify the image files var Pic = new Array(); // to add more images, just continue // the pattern, adding to the array below Pic[0] = 'http://www.dalekblaster.co.uk/images/banner/dalekblasternexttime.jpg' Pic[1] = 'http://www.dalekblaster.co.uk/images/banner/dalekblaster2.jpg' Pic[2] = 'http://www.dalekblaster.co.uk/images/banner/dalekblastersjanexttime.jpg' Pic[3] = 'http://www.dalekblaster.co.uk/images/banner/dalekblaster.jpg' // do not edit anything below this line var t; var j = 0; var p = Pic.length; var preLoad = new Array(); for (i = 0; i < p; i++) { preLoad[i] = new Image(); preLoad[i].src = Pic[i]; } function runSlideShow() { if (document.all) { document.images.SlideShow.style.filter="blendTrans(duration=2)"; document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)"; document.images.SlideShow.filters.blendTrans.Apply(); } document.images.SlideShow.src = preLoad[j].src; if (document.all) { document.images.SlideShow.filters.blendTrans.Play(); } j = j + 1; if (j > (p - 1)) j = 0; t = setTimeout('runSlideShow()', slideShowSpeed); Now i need help because, i want to link each picture on the slideshow to a differnet page or external site, but im not sure how. (but so they can go to different pages not the same one) can anyone help me? I'm not sure if this is an IE issue, css, html... I have all icons and images showing a broken image" red X OVER the actual image? I've never seen this on any other sites or even on any other sites i've done. They are all .png images but I use .png files successfully all the time? Anyone encounter this? Here's the HTML surrounding the image file: HTML Code: <div class="header logo2"> <!-- Logo begins here --> <a href="index.php" title=""><img src="images/logo.png" alt="" /></a> </div> <!-- END Logo --> Here's the CSS surrounding the image with no other images or backgrounds being called??? HTML Code: .header { height: 41px; } .logo2 { text-align: right; } See Image Attached... How do I put another image (websiteheader2.jpg) that will be placed before the current image (websiteheader1.jpg), into this code: #logo-div { background-image:url('http://website.com/ websiteheader1.jpg') !important; background-repeat:no-repeat !important; background-position:10px 60px !important; } |