CSS - Image Not Staying Inside Div
This is probably a dumb question, but I have a div, with a floated image inside. When the div doesn't have enough text inside to make it taller than the image, the image will stick out the bottom of the div. I've attached a couple of images to show what's happening. I want div to stretch around the image at all times, even if there's only one line of text next to it.
Code: <html> <head> <style> body { width: 800px; /* change this value */ margin: 20px auto; } #container { border: 1px solid #f00; padding: 10px; } .floatright { float: right; margin: 10px; background-color: #aaf; } </style> </head> <body> <div id="container"> <h3>some latin text</h3> <p> <img class="floatright" src="some_image.jpg" width="100" height="150" alt="Image" /> Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. </p> </div> </body> </html> Similar TutorialsHey, I have a slight problem... http://www.thecolonyrp.net/chris/hca/ The banner is only partially uploaded, just to let you know why there is just a strip. As you can see, the div on the left aligns left, the div in the middle goes to the middle, and the right div goes right. For SOME reason, the container ignores the left div, the right div gets pushed out of the container, and the center div is just right. Goldy Lox anyone? On top of that, in order for me to make my middle div go middle, I have to cheat and use the margin. Is there any way to perfectly center this? I don't know what's wrong. My style page is : http://www.thecolonyrp.net/chris/hca/style.css I thought I closed a div tag too early or something, but I couldn't figure it out. I think I just need a second set of eyes. And this website has to be done ASAP. Can anyone help me? Thanks. I have a two column layout. The left-hand column consists of three elements stacked on top of one another. The right-hand column is a little more complicated. I'm having a problem where when I apply float:left to the bottom item in the left-hand column, it screws everything up and all of the stuff from the right-hand column jumps down below the left-hand column stuff. When that bottom item in the left-hand column doesn't float-left, the stuff in the right-hand column stays to the up and to the right where it's supposed to be. The problem is that I need this bottom item to float:left (it's this semi-complicated thing with an extra border around it), but I also of course need the stuff in the second-column to behave correctly. Is there something I can do to make it so the stuff in the right-hand column doesn't jump down to the left no matter what? I think I might be missing something obvious here to make the two columns truly separate. Link: bitbonton [dot] com For some odd reason, the %100 height on the left column does not seem to work ... the dotted line ends after the content. Also, there is another problem where if the scroller bar appears on the right because the content is too long, it pushes everything leftward. tried to move the content a bit more to the left, but it seems to remain centered? Thank you for your help! Hello. This is the first time I've tried a complete CSS layout, and I just have one bothersome problem. I have everything inside a #container div. I have a min-height set for the container, since in Firefox if I don't have that it just wraps the border around the background image. No matter where I put the footer div, it hangs over the min-height border. However, if I put footer inside another tag called content ( #content #footer { ) it does stay in. But I don't even have a content div in the css! I'm so confused. *lol* Furthermore, by using Float for the navigation div instead of absolute positioning, it shows up with several pixels difference between IE and Firefox. If anyone could help me with this, I would be much obliged. The page is he http://frenziedsilence.com/nygiml/index.php And the CSS: http://frenziedsilence.dom/nygiml/nygiml.css thanks in advance.. -kathryn I've been working on a CSS style for a web site, and I've got a small issue with the right hand column not staying within the bounds of the screen. When using a tool to see where the div's borders the right is about 200 px going off the right of the screen, making the screen horizontally scrolling. I am not a CSS expert. I know enough to get around, but this I don't understand. (I might have posted too much, but I figured if someone needed something more, it's already all there.) Thanks for any assistance that can be provided. HTML 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>Experience Inc. - Warren and Forest Counties Office of Aging</title> <link href="css/grey_style.css" rel="stylesheet" type="text/css"> </head> <body> <div id="header"> <span style="float:left;"> <img src="images/logo.gif" /> </span> <span style="float:right;"> <div style="text-align:center"> <div id="outerFirst"><a href="index.php"><span>Home</span></a></div> <div id="outerFirst"><a href="index.php"><span>Services</span></a></div> <div id="outerFirst"><a href="index.php"><span>Senior Centers</span></a></div> <div id="outerFirst"><a href="index.php"><span>Calendar / Menu</span></a></div> <div id="outerFirst"><a href="index.php"><span>Trips / Events</span></a></div> <div id="outerFirst"><a href="index.php"><span>About / Contact</span></a></div> </div> </span> </div> <div class="CellBackGround"> <table width="100%"> <tr> <td> </td> </tr> </table> </div> <div id="pictureContainer"> <div id="largeHomeText"> Warren and Forest Counties Area Agency on Aging </div> <div class="together"> <img src="images/home_image_bar/image1.jpg" /> <img src="images/home_image_bar/image2.jpg" /> <img src="images/home_image_bar/image1.jpg" /> </div> </div> <div class="CellBackGround"> </div> <div id="wrapper"> <div id="content"> </div> </div> <div id="navigation"> <p> </p> </div> <div id="extra"> </div> <div id="footer"> <p>This is the footer area. </p> </div> </body> </html> CSS Code: body { font-family: "Times New Roman", Times, serif; font-size: 12pt; font-style: normal; font-weight: normal; color:#FFFFFF; background-color:#666666; margin-left:0; margin-top:0; margin-right:0; } #header { width: 100%; background-color: #666666; overflow:auto; vertical-align:top; height:auto; } #menu { height: 54px; margin: 3em 0; padding:0 1em; border-bottom: 0px solid black; overflow:inherit; } #outerFirst { float: left; width: 90px; height: 130px; margin: 0 0px 0 0; background: url( '../images/greyFirst.gif' ) 0 -50px no-repeat; } #outerFirst a { cursor: pointer; display: block; margin: 0; padding:0; width:90px; height:54px; overflow:hidden; font-family: Arial; font-size:0.7em; font-weight:normal; color:#FFFFFF; text-decoration: none; background: url( '../images/greyFirst.gif' ) top left no-repeat; } #outerFirst span { height: 54px; display: block; margin:0; padding: 25px 0px 0px 0px; } #outerFirst a:hover { width:90px; height:54px; background: url( '../images/greyFirstRoll.gif' ) top left no-repeat; color: yellow; } #outerFirst a:active { background: url( '../images/greyFirstRoll.gif' ) top left no-repeat; } .CellBackGround { height:2px; background: url('../images/redPixel.gif') center center; } .CellBack2 { background: url('../images/redPixel.gif') center center; } #pictureContainer { width:100%; background-color:#666666; overflow:auto; height:95px; } #largeHomeText { color:#999999; font-size:13pt; float:left; padding-top:74px; padding-left:3px; } .together img { padding: 0; margin: 0; border: 0; display: inline; float: right; overflow:hidden; } #mainTextContaner { color:#660000; margin-left:-5px; } #footer { color:#666666; } /* This code is straight from http://www.webcredible.co.uk/user-friendly-resources/css/css-round-corners-boxes.shtml */ .bl {background: url(../images/bl.gif) 0 100% no-repeat #FFFFFF; width: 45%;} .br {background: url(../images/br.gif) 100% 100% no-repeat} .tl {background: url(../images/tl.gif) 0 0 no-repeat} .tr {background: url(../images/tr.gif) 100% 0 no-repeat; padding:10px} .clear {font-size: 1px; height: 1px} /* This code is straight from http://www.webcredible.co.uk/user-friendly-resources/css/css-round-corners-boxes.shtml */ .bl2 {background: url(../images/bl.gif) 0 100% no-repeat #FFFFFF; width: 35%;} .br2 {background: url(../images/br.gif) 100% 100% no-repeat} .tl2 {background: url(../images/tl.gif) 0 0 no-repeat} .tr2 {background: url(../images/tr.gif) 100% 0 no-repeat; padding:10px} a:link { font-size: 14pt; color:#999999; } a:hover { font-size: 14pt; color:#660000; } a:visited { font-size: 14pt; color:#999999; } #news { background: url(../images/news.jpg) 100% 0 no-repeat; width:370px; height:600; } div#wrapper{ float:right; margin-right:-30%; width:99%; } div#content{ margin-right:30%; border-left:2px solid #FFFFFF; border-left-color:#660000; padding-left:10px; padding-right:10px; height:400px; padding-top:10px; } div#navigation{ float:left; width:32.9%; padding-top:10px; } div#extra{ float:left; clear:left; width:32.9%; padding-top:10px; } p{ margin:0 10px 10px } div#footer{ clear:both; border-top:2px solid; border-top-color:#660000; border-bottom:2px solid; border-bottom-color:#660000; text-align:left; color:#FFFFFF; } div#footer p{ margin:0; padding:5px 10px; width:10%; } Hoping that this is a no-brainer to someone here! Here is a sample of the code for my menu using suckerfish: Code: <ul class="menu sf-menu sf-horizontal sf-js-enabled"> <li class="parent item3"> <span class="separator"><span>Dealer Info</span></span> <ul style="display: none; visibility: hidden;"> <li class="item13"> <a href=""><span>About Us</span></a> </li> </ul> </li> </ul> Top-level and sub-level nav are both working great, but you will notice when you hover down to the sub-level menu items, the top-level text goes back to white, making it impossible to read... Here is the css code for my menu: Code: /*** ESSENTIAL STYLES ***/ .sf-menu, .sf-menu * { margin: 0; padding: 0; list-style: none; font-weight: bold; } .sf-menu { line-height: 1; } .sf-menu ul { position: absolute; top: -999em; width: 10em; /* left offset of submenus need to match (see below) */ } .sf-menu ul li { width: 100%; } .sf-menu li:hover { visibility: inherit; /* fixes IE7 'sticky bug' */ } .sf-menu li { float: left; position: relative; } .sf-menu a { display: block; position: relative; font-weight: bold; } .sf-menu li:hover ul, .sf-menu li.sfHover ul { left: 0; top: 24px; /* match top ul list item height */ width: 127px; z-index: 99; background: url(../images/subnav-bg.png) no-repeat left bottom; padding: 2px 0 24px; } ul.sf-menu li:hover li ul, ul.sf-menu li.sfHover li ul { top: -999em; } ul.sf-menu li li:hover ul, ul.sf-menu li li.sfHover ul { left: 10em; /* match ul width */ top: 0; } ul.sf-menu li li:hover li ul, ul.sf-menu li li.sfHover li ul { top: -999em; } ul.sf-menu li li li:hover ul, ul.sf-menu li li li.sfHover ul { left: 10em; /* match ul width */ top: 0; } /*** DEMO SKIN ***/ .sf-menu { float: left; margin: 5px 0 0 32px; } .sf-menu a { color: #FFF; text-decoration: none; display: block; } .sf-menu .separator { cursor: pointer; display: block; } .sf-menu .separator:hover { cursor: pointer; color: #000; text-decoration: none; } .sf-menu li:hover > li, .sf-menu li:hover > a { color: #000; } .sf-menu a, .sf-menu a:visited { /* visited pseudo selector so IE6 applies text colour*/ } .sf-menu a:hover { color: #000; text-decoration: none; } .sf-menu li { text-align: center; text-transform: uppercase; background: url(../images/nav-bg.png); height: 19px; line-height: 19px; width: 122px; margin: 0 1px; font-size: 11px; } .sf-menu li li { background: none; font-size: 11px; } .sf-menu li li li { } .sf-menu li:hover, .sf-menu li.sfHover { background: url(../images/nav-bg-over.png); } /* .sf-menu li:hover, .sf-menu li.sfHover, .sf-menu a:focus, .sf-menu a:hover, .sf-menu a:active { background: url(../images/nav-bg-over.png); } */ .sf-menu li li:hover, .sf-menu li li:hover a { background: none; color: #000; } /*** arrows **/ .sf-menu a.sf-with-ul { padding-right: 2.25em; min-width: 1px; /* trigger IE7 hasLayout so spans position accurately */ } .sf-sub-indicator { position: absolute; display: block; right: .75em; top: 1.05em; /* IE6 only */ width: 10px; height: 10px; text-indent: -999em; overflow: hidden; background: url('../images/arrows-ffffff.png') no-repeat -10px -100px; /* 8-bit indexed alpha png. IE6 gets solid image only */ } a > .sf-sub-indicator { /* give all except IE6 the correct values */ top: .8em; background-position: 0 -100px; /* use translucent arrow for modern browsers*/ } /* apply hovers to modern browsers */ a:focus > .sf-sub-indicator, a:hover > .sf-sub-indicator, a:active > .sf-sub-indicator, li:hover > a > .sf-sub-indicator, li.sfHover > a > .sf-sub-indicator { background-position: -10px -100px; /* arrow hovers for modern browsers*/ } /* point right for anchors in subs */ .sf-menu ul .sf-sub-indicator { background-position: -10px 0; } .sf-menu ul a > .sf-sub-indicator { background-position: 0 0; } /* apply hovers to modern browsers */ .sf-menu ul a:focus > .sf-sub-indicator, .sf-menu ul a:hover > .sf-sub-indicator, .sf-menu ul a:active > .sf-sub-indicator, .sf-menu ul li:hover > a > .sf-sub-indicator, .sf-menu ul li.sfHover > a > .sf-sub-indicator { background-position: -10px 0; /* arrow hovers for modern browsers*/ } /*** shadows for all but IE6 ***/ .sf-shadow ul { background: url('../images/shadow.png') no-repeat bottom right; padding: 0 8px 9px 0; -moz-border-radius-bottomleft: 17px; -moz-border-radius-topright: 17px; -webkit-border-top-right-radius: 17px; -webkit-border-bottom-left-radius: 17px; } .sf-shadow ul.sf-shadow-off { background: transparent; } Can anyone tell me what the rule is to keep that top level text black when I hover below? Thanks My page has: 1) a left-sidebar which goes from the top-left corner and stretches down 2) a top-bar which goes from the edge of the left-sidebar and stretches all the way across to the right side of the page 3) a main content which covers the rest of the page I want to place an image in the center of the top-bar but so far it only is centered when the window is maximised...I want it to be centered no matter what size the window is. currently my css rules a Code: #topBar { position: absolute; height:15%; text-align: center; left:30%; margin:0px auto; } the xhtml source code for the topBar and image is: Code: <div id="topBar"> <p><img src="../logo1.jpg" alt="..." id="sirgLogo"/></p> </div> (the image id is just concerned with the size of the image at this time) any suggestions as to how to I can have the image centered within the <div>? some bright spark on Yahoo Answers failed to spot that I'm using xhtml (which tbf is only mentioned once) and told me to try: Code: <div id="topBar"> <p><center><img src="../logo1.jpg" alt="..." id="sirgLogo"/></center></p> </div> or Code: <div id="topBar" align="center"> <p><img src="../logo1.jpg" alt="..." id="sirgLogo"/></p> </div> Unless I'm mistaken, these are possibilities which will cause w3's validator to throw up an error. For the record I'm using XHTML 1.0 Transitional and I presume my doctype declaration is correct as it was automatically generated by dreamweaver when I first made the document! Hi. K, I have NO idea where to begin on this one. I need to display a series of thumbnails (to be selected dynamically from a database) inside 1 <td> tag. I need them to be organized 3 wide by 3 high, with their titles underneath. What would I use for this? I"m assuming I just set up a new class for that, but I don't know what to do for it. Any help is greatly appreciated. Supposing I have an image that is 200x200 pixels, and I have a div that is 100x100 pixels. I want to place the image inside the div AND have all 4 corners of the image visible. How do I do this? The idea is to fit the image inside the div without the image looking like it got "cut off" on any of its edges. I tried simply changing the CSS width and height but that did not achieve the desired effect. I'm hoping I won't need 4 divs, one for each corner? Hi guys, I've been struggling with this for some hours now and can't get this to work... I'm no css expert but this is driving me mad... The problem happens in firefox3, in IE7 it displays fine. My code is (copied from firebug): <div id="mydiv" style="margin: 0px; padding: 0px; position: absolute; z-index: 1; opacity: 0.9; left: 763px; top: 143px;"> <div style="border: 1px solid rgb(68, 68, 68); padding: 2px; font-size: 7pt; color: rgb(68, 68, 68); white-space: nowrap; background-color: rgb(255, 255, 255);" id="otherdiv"> Text goes here </div> <div style="position: relative; top: -1px;" id="yetanotherdiv"> <img src="images/bico_w.png" style="margin: 0px; padding: 0px; width: 14px; height: 7px;"/> </div> </div> This is a balloon like tooltip, with a div on top with the text, and a div on the bottom containing the handle image, all wrapped by another nice div. In Firefox, there's space on top and below the image that I can't figure out where it comes from (no space in IE7). If I put a "vertical-align:top" on the image, it sticks to the top div correctly (both IE and firefox), but then I can't get rid of space BELOW the image. Can you help me figure this out? How do i center the image both horizontally and vertically.... I have read the < ALIGN > has be depreciated and must use style, but STYLE="vertical-align:middle" dpesnt seem to work in either/both the < DIV > and < IMG > tags I am using an external CSS with a hiehgt of 168px, and calling the < DIV > block, then just using a < IMG > tag. How can i align the image int he middle?? Hi, I need some help for aligning text inside a css box. let me first say, that i am using a wysiwyg editor and i am aware of this being a red flag for some folks .... to make my problem better understandable, please see following picture - this is how i want it to be: the area of interest is a 3 column box (left and right are fixed widths, middle column is variable), the middle box (highlighted in blue) is the box, which has a background picture ('Melanie Wanders') on the top/left .... then it has some text (one looong line) and also a picture to the right (alignment: right). what i wanted is, that when the user resizes the window, that the text is able to wrap around the image on the top right - and it does exactly that (you can also view the online version here) well, what happens is this: my problem: when i try to use the 'p' tags to enter a paragraph, it messes up the appearance in FF (completely) and it still shows the text right on the top, above the background image. I also tried to align the text line to the bottom of the box, but it wouldn't do so. i did also try to have the image ('Melanie Wanders') as an actual image aligned Top/Left, but it wouldn't wanna work for me with the other image next to it. i might get it to work, if this is my only option .... finally, here the code used (you will also find the code online, if you follow the above link) Code: .inner_middle_content_row { width: 100%; height:300px ; } .inner_middle_content_row_left { background-image: url(images/inner_table/left.png); background-repeat: repeat-y; background-position: right 0; width:125px; height:300px; float:left; } .inner_middle_content_row_right { background-image: url(images/inner_table/right.png); background-repeat: repeat-y; width:20px; height:300px; float:right; } .inner_middle_content_row_middle { background-color: white; background-image: url(images/about_us/melanie_title.jpg); background-repeat: no-repeat; background-position: left top; width:auto; height:300px; margin-left:125px; margin-right:20px; } Code: <div class="inner_middle_content_row"> <!--agl:cssobject id="inner_middle_content_row" type="Column Middle Scale" /--> <div class="inner_middle_content_row_left"> <p class="submenu_brown">Melanie Wanders</p> <p><a class="submenu_gray" href="wilhelm%20wanders.html" onmouseover="this.className='submenu_brown';return true;" onmouseout="this.className='submenu_gray'">Wilhelm Wanders</a></p> <p><a class="submenu_gray" href="philosophie.html" onmouseover="this.className='submenu_brown';return true;" onmouseout="this.className='submenu_gray'">Philosophie</a></p> <p><a class="submenu_gray" href="history.html" onmouseover="this.className='submenu_brown';return true;" onmouseout="this.className='submenu_gray'">History</a></p> </div> <div class="inner_middle_content_row_right"></div> <div class="inner_middle_content_row_middle"> <img src="images/about_us/melanie_portrait.jpg" alt="" width="160" height="180" align="right" border="0" />Chef Melanie Wanders received her Culinary Arts and Management degree .... their own hand-made chocolate company - Wanders Artisan Chocolaterie.</div> it would be great to find a solution to this - the easy way out would be to just skip the background image and have the text start right on top left .... but i like the idea of having a nice title like this - please tell me your opinion though another thing i realize is, that the whole alignment is off in IE ... this is an issue i think i have read before and it has to do with this 3px or 5px off thing in IE right? i think i will look into this some other time. Thanx for reading this - please bare with me, as my mother-language is not english and i might have expressed myself not clearly I'm pretty new to using CSS so please be gentle I'm trying to hack (develop is to lofty a word at this point) this tableless page and get the bg image to stick to the right/top corner of the "content" div. IE6 renders it pretty well but Firefox (my preferred browser) is horrendous. The image size is 400x392. Any thoughts or a good reference on this would be greaty appreciated. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta name="generator" content="http://www.inknoise.com/experimental/layoutomatic.php" /> <style type="text/css"> #container { width: 760px; width: 780px; width: 760px; border: 1px solid gray; margin: 10px; margin-left: auto; margin-right: auto; padding: 10px; } #banner { padding: 5px; margin-bottom: 5px; background-color: rgb(213, 219, 225); } #content { padding: 5px; margin-left: 215px; background-color: gray; background-attachment: fixed; background-image: url(images/bg_run.jpg); background-repeat: no-repeat; height: 400px; background-position: right top; } #sidebar-a { float: left; width: 200px; \width: 210px; w\idth: 200px; margin: 0; margin-right: 5px; padding: 5px; background-color: rgb(235, 235, 235); } #footer { clear: both; padding: 5px; margin-top: 5px; background-color: rgb(213, 219, 225); } </style> </head> <body> <div id="container"> <div id="banner">Banner</div> <div id="sidebar-a">Sidebar</div> <div id="content">Content</div> <div id="footer">Footer</div> </div> </body> </html> Hey all, I have a position div with a background image that sits just above and to the right of a text box. The image appears higher because I want it to overlap the text box. Most of the area that overlaps the text box is transparent. My problem is the transparent area makes it so you have to click the on the left side of the text box to place the cursor inside. Is their any way to make it so the transparent areas I can click inside the text box while leaving the image appearing over the text box? Thanks I attached an image with an exemple of my problem, left side is from Internet explorer and right side is from Opera and Firefox. The div in which I inserted that image does not expand in height as much as the image height .. only on how much text I insert in that div. How can I fix this in opera and firefox ? PHP Code: .bggrad{ background-image:url(images/bg-gradient-b-w.gif); width:486px; text-align:left; height:auto; /* INITIALY I DID NOT USED HEIGHT BUT IT WAS THE SAME */ } img.img_event{ padding:4px; border:1px solid #FFC91B; background-color:#FFF4CB; margin:10px; } <div class="bggrad"> <img src="images/test.gif" width="117" height="148" border="0" class="img_event" align="left"> text text text text </div> 10x in advance Have some (for me) a mysterious problem when mousing over an image inside a div. I use javascript to change the class of a div when either onMouseOver or onClick of the div. If I use onMouseOver to change the class of the div then the mousing over the image inside div is working fine. If I use onClick to change the class of the div then the mousing over the image inside div is NOT working fine. Why is that? Is there a way to make it work as I want? 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"> <meta http-equiv="Content-Style-Type" content="text/css"> <meta name="Keywords" content="div, bug, onmouseover, onclick, image, "> <meta name="Title" content="DIV onmouseover bug"> <meta name="Description" content="onmouseover over image inside DIV causes div onmouseout event to fire"> <title>onClick event of DIV causes mouseover of image in second example to make DIV hidden</title> <style type="text/css"> body { margin:0; padding:0; } .esmall { display:block; z-index:2; position:absolute; cursor:pointer; height:20px; width:300px; border:0; background-color:#a44; font-family:arial,sans-serif; font-size:12px; color:#fff; overflow:hidden; } .elarge { display:block; z-index:3; position:absolute; cursor:pointer; height:auto; width:300px; border:1px solid black; background-color:#fff; font-family:arial,sans-serif; font-size:12px; color:#000; overflow:hidden; } </style> </head> <body> <div id="div1" class="esmall" onmouseover="this.className='elarge'" onmouseout="this.className='esmall'" style="left:10px; top:50px;"> <div style="display:block; margin:2px;"> MouseOver this div.<br><br>Then try to mouse over the image or the square below. Here it should work fine<br><br> <img src="event-edit.gif" alt="Edit" onclick="alert('Run som function here')" title="" border="1" height="15px" width="15px" style="background-color:red"><br><br> </div> </div> <div id="div2" class="esmall" onclick="this.className='elarge'" onmouseout="this.className='esmall'" style="left:320px; top:50px;"> <div style="display:block; margin:2px;"> Click here. Then try to mouseover image inside DIV<br><br>Then try to mouse over the image or the square below.<br><br> You will see that mousing over image causes the DIV to get its original size, as if you moved the mouse outside the div.<br><br> The only difference between the two divs a First DIV uses onMouseOver and second uses onClick<br><br> I would like this one to work but without the div dissapearing when I mouseover/mouseout of the image below.<br>How do I make it work?<br><br> <img src="event-edit.gif" alt="Edit" onclick="alert('Run som function here')" title="Try to click me if you can" border="1" height="15px" width="15px" style="background-color:red;"><br><br> Tested in: FF, IE, OP NE<br><br> I use the nested divs to cope with some differences in padding behaviour between the browsers. It does not affect what I'm trying to do. </div> </div> </body> </html> Hi http://www.sential.co.uk/releases.html http://www.sential.co.uk/style.css the box model is based on the thrashbox it works fine on the other pages, except the releases page where there is an image at the bottom of the box. It has the incorrect alignment on the left border. And only in IE Any help would be very appreciated. -Luke When clicking on the image in code below the link is not working in IE (6.0), works fine in FF and OP. The odd thing is that in IE when you right-click the image you can open the link by selecting "Open link" or "Open link in new window". So the link is there for IE as well, but not working when clicking on the image. Why is it so. Workaround needed... Any fix for this without having to remove my SPAN tags? The HTML also validates without any errors. Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <TITLE>Link over image is not working in IE. (Tested in IE 6.0)</TITLE> </head> <body> <div> <br><br> <span style="display:block; width:200px; background-color:gray;"> <a href="image-link-bug.htm" style="text-decoration:none;"> <span style="cursor:pointer; display:block; text-align:left; padding:10px;"> <span style="display:block; float:left"> <img src="landscape.jpg" width="40px" height="40px" alt=""> </span> <span style="display:block; color:white; font-family:arial, sans-serif;"> When you click on the image to the left the link does not work in IE 6.0. If you click on this text it works fine. Why is that. It works great in FF and OP though.<br><br> Is there a fix for this without having to remove my SPAN tags?<br><br> NOTE: If you right-click on the image in IE and select Open link, or Open link in new window it works, also in IE.<br><br> For me this looks like a bug in IE.<br><br> I'm looking for a fix/workaround to make it work, and yes, with the span tags :-)<br><br> And please, do not bother about the other code here, e.g. the input at the end of page etc. </span> </span> </a> </span> </div> <br><br> Name:<input type=text size=30 value=""> </body></html> I've tried a few combinations of position properties for this and can't figure out how to do it, or whether it is possible. What I want to do is put an image inside a div which has a property of 'overflow:auto'. I want the image to be positioned so a particlar point is inside the visible area, but so the user can still scroll around to see the whole of the image. Could somebody point me in the right direction please? |