CSS - Problem Positioning Background Image On An Active Parent
I have a problem I can't resolve as I'm out of my depth with this CSS positioning issue on a joomla site with a bespoke template I have customised.
The problem is that the client (a graphic designer) created a menu design where the top level menu buttons overlap with a curve. I have assigned a background image on hover and it works well. You can see it he I can't post an image of the menu as it won't let me, being a new poster, which is a pain... Code: #horiz-menu a:hover { display: block; z-index: 100; line-height: 22px; left:-53px; position: relative; background: url("../images/style9/menu-bar-hover.png") no-repeat scroll 0 0 transparent; padding-left:63px; height:27px; width:162px; border-bottom:1px solid #fff; margin-bottom:-3px; } To achieve the overlap, the background has to sit behind the button to its left and that is achieved by moving it a fixed amount of pixels leftward. The menu text is then put back in place with the padding. However the client now wants the hovered image to stick in the parent position when the submenu items are hovered over. I've achieved this with: Code: #horiz-menu li.parent.active a { background: url("../images/style9/menu-bar-hover.png") no-repeat scroll 0 0 transparent; z-index: 100; line-height: 22px; left:-53px; position: relative; padding-left:63px; height:27px; width:162px; border-bottom:1px solid #fff; } The trouble is that although the background image is positioned correctly, it has a knock-on effect on all the submenu list items which are being positioned to the beginning of the background image, 53 pixels to the left... I cannot pad the submenu items over to the right as it causes all the other submenus items under the other parents to move to the right too. I suppose my question is twofold: is there any way of setting the active parent list item background image position without the children items inheriting the position change? ; is there a better way of doing what I am attempting to do? If the client had not specified overlapping buttons I would be in the clear but my client was a graphic designer who designed without any thought as to the css implications. The requirements have been signed off and I have to find a way of implementing it. Please, any thoughts? I am not a css coder and I find css to be impenetrable, arcane whilst being slow and difficult to debug. All help really appreciated. Similar TutorialsHi all Having some problems with background image positioning - all CSS/XHTML has been validated See http://community.foe.co.uk/tmp/quote_and_image_test.html Relevant CSS : Code: #imageleft {padding:0px; float:left; width:auto; margin-right:5px; margin-bottom:5px} .imagecaptionleft{padding:0px; margin:0px; text-align:left; font-size:8pt} blockquote { background: transparent url(/images/common/quote1a.gif) left top no-repeat; margin:0px; padding: 0px; font-weight: normal; color:#000; } blockquote div { padding: 2px 30px; background: transparent url(/images/common/quote2a.gif) right bottom no-repeat; } Relevant html Code: <div id="imageleft"> <img src="/images/common/dummy.gif" alt="Test image" width="100" height="100" /> <div class="imagecaptionleft">Caption goes here</div></div> <blockquote><div> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Vestibulum augue odio, condimentum et, iaculis quis, facilisis nec, quam. Aliquam eros. Nulla ut lorem. Cras bibendum orci at ligula lobortis bibendum.</p> </div></blockquote> The opening quote mark is hidden behind the image - as you can see it has a position of left, and for some reason the <div> within the <blockquote> is including the image so is full width. Any help appreciated Hello, I recently started creating websites again and I have been pulling my hair out on this Firefox compatibility issue. The site navigation looks great in IE but in Firefox a couple of the background images are skewed down and to the left. Since all my tricks from years ago are so outdated now, I decided to try CSS for a simplified navigation setup. The code is probably pretty messy since I chopped it together from numerous sources and still am not completely sure how it works. Background: I created a large 794x1200 PNG image that contains two complete border and navigation sets. I am using CSS to both position the appropriate portion in each table/cell as well as switching to a slice on the 2nd image set for rollover purposes. An example of the current test is he (URL address blocked: See forum rules) *not sure if this is okay but would be best to see the example. If it is not allowed as a non-clickable then feel free to delete. It is here - classtime . org / test6 . htm and the navigation image is he (URL address blocked: See forum rules) *classtime . org / navigate . png I would be eternally grateful to anyone that can help me figure out why the site works great in IE but is coming up skewed in Firefox. As a side note, when I pull up the site in Frontpage, it shows the left-most cell as being larger than it is supposed to be even though it is hardcoded. To get my left image bar to show up in the correct place I had to use a value of "left: -40px;" I'm not sure why that is but I suspect it has something to do with the problem. Thank you very much for taking a look. My jumbled code is as follows: Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "(URL address blocked: See forum rules)"> <html> <head> <meta http-equiv="Content-Language" content="en-us"> <title>Ultrasonic Blind Company - Elk Grove Village, Illinois</title> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <style type="text/css" media="screen"> a:link {color: #FFF4D1;} a:visited {color: #FFF4D1;} a:hover {color: #74060c;} a:active {color: #FFF4D1;} .top a { display: block; width: 794px; height: 120px; background-image: url('navigate.png'); } .top a:hover { background-position: 0px -601px; } #left { left: -40px; width: 150px; height: 460px; display: block; background: url('navigate.png'); background-repeat: no-repeat; background-position: 0px -120px; position: relative; } #left li {margin: 0px; padding: 0px; list-style: none; position: absolute; text-align: center; font: bold 18px Batang; line-height: 50px; } #left li, #left a {height: 50px; width: 146px; display: block;} #panel1b {top: 10px;} #panel2b {top: 63px;} #panel3b {top: 116px;} #panel4b {top: 169px;} #panel5b {top: 223px;} #panel1b a:hover {background: transparent url('navigate.png') 0px -730px no-repeat} #panel2b a:hover {background: transparent url('navigate.png') 0px -785px no-repeat} #panel3b a:hover {background: transparent url('navigate.png') 0px -839px no-repeat} #panel4b a:hover {background: transparent url('navigate.png') 0px -890px no-repeat} #panel5b a:hover {background: transparent url('navigate.png') 0px -945px no-repeat} #right { width: 154px; height: 460px; display: block; background: url('navigate.png'); background-repeat: no-repeat; background-position: -640px -120px; position: relative; } #right li {margin: 0px; padding: 0px; list-style: none; position: absolute; text-align: right; font: bold 18px Batang; } #right li, #right a {height: 85px; width: 154px; display: block;} #panel1r {top: 0px;} #panel2r {top: 100px;} #panel3r {top: 200px;} #panel4r {top: 300px;} #panel1r a:hover {background: transparent url('navigate.png') -640px -721px no-repeat} #panel2r a:hover {background: transparent url('navigate.png') -640px -821px no-repeat} #panel3r a:hover {background: transparent url('navigate.png') -640px -921px no-repeat} #panel4r a:hover {background: transparent url('navigate.png') -640px -1021px no-repeat} </style> </head> <body bgcolor=#74060c> <div align=center> <table id="Table_01" width=794px height=600px border=0 cellpadding=0 cellspacing=0> <tr> <td colspan="3" height="120" width="794" bgcolor="#FFF4D1"> <div class="top"> <a href="(URL address blocked: See forum rules)"></a> </div> </td> </tr> <tr> <td align=left valign=top height=674px width=150px bgcolor="#FFF4D1"> <ul id="left"> <li id="panel1b"><a href="(URL address blocked: See forum rules)" style="text-decoration: none">Contact</a></li> <li id="panel2b"><a href="(URL address blocked: See forum rules)" style="text-decoration: none">Residential</a></li> <li id="panel3b"><a href="(URL address blocked: See forum rules)" style="text-decoration: none">Commercial</a></li> <li id="panel4b"><a href="(URL address blocked: See forum rules)" style="text-decoration: none">Coupons</a></li> <li id="panel5b"><a href="(URL address blocked: See forum rules)" style="text-decoration: none">Questions</a></li> </ul> </td> <td align=left valign=top width=490px height=674px bgcolor="#FFF4D1"> aaa</td> <td align=left valign=top width=154px height=674px bgcolor="#FFF4D1"> <p align=right> <ul id="right"> <li id="panel1r"><a href="(URL address blocked: See forum rules)" style="text-decoration: none"></a></li> <li id="panel2r"><a href="(URL address blocked: See forum rules)" style="text-decoration: none"></a></li> <li id="panel3r"><a href="(URL address blocked: See forum rules)" style="text-decoration: none"></a></li> <li id="panel4r"><a href="(URL address blocked: See forum rules)" style="text-decoration: none"></a></li> </ul> </td> </tr> </table> </div> </body> </html> Hi I found it: ********************** Code: #tableLeftCol ul.menu li#current a { background-image: url('../images/menu-active-rect.gif'); background-position: right top; background-repeat: repeat-y; } #tableLeftCol ul.menu li#current ul li a { background-image: none; } *************************** I have a nested list representing a menu. I want the active menuitems (listitem) link to have a background image. When active menuitem is a parent then all the childs also get the background image...... How to I change the CSS so only active menuitems link get the background image set, and not the child links of the parent? If possible, I want to make it work without changing any in the HTML! Here is current CSS and list structu Code: #tableLeftCol ul.menu li#current a { background-image: url('../images/menu-active-rect.gif'); background-position: right top; background-repeat: repeat-y; } #tableLeftCol ul.menu li ul li#current a { background-image: url('../images/menu-active-rect.gif'); background-position: right top; background-repeat: repeat-y; } Code: <div id="tableLeftColPadding"> <ul class="menu"> <li id="current" class="parent active item54"> <a href="/index.php?option=com_content&view=article&id=48&Itemid=54"> <span>Parent</span> </a> <ul> <li class="item57"> <a href="/index.php?option=com_content&view=article&id=50&Itemid=57"> <span>Child-A</span> </a> </li> <li class="item81"> <a href="/index.php?option=com_content&view=article&id=71&Itemid=81"> <span>Child-B</span> </a> </li> <li class="item59"> <a href="/index.php?option=com_content&view=article&id=52&Itemid=59"> <span>Child-C</span> </a> </li> </ul> </li> </ul> </div> Hello! If i need to put background-image at the bottom of display i use such css rule: background-position: bottom; but in my case i need image to be fixed in right bottom corner. apparently i cant use two declarations like: background-position: bottom; background-position: right; so how could i attain this via just CSS? Hi, I learned css a couple of years ago but am real rusty...anyways, here is an image that i wanted as the background to the top of the page. in the white space, i simply want a horizontal menu with 4 links. i cannot figure out how to position my links in that space correctly. any help appreciated! [/IMG]http://img251.imageshack.us/img251/1333/toplogoinfo.jpg[/IMG] here is the code i have so far: Code: !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 http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Precision Truck Painting and Repair</title> <style type="text/css"> .body{ margin:0; padding:0; } #page { width: 800px; margin: 0 auto 0 auto; } #banner { background-image:url(images/jpegs/top_logo_info.jpg); height: 140px; background-repeat:no-repeat; } ul.nav { list-style-type: none; padding-left: 0; margin:0px 0 0 360px; font-family:Arial, Helvetica, sans-serif; } ul.nav li { display: inline; width:115px;} ul.nav a { text-decoration:none; } </style> </head> <body> <div id="page"> <div id="banner"> <div id="top"> <ul class="nav"> <li class="index"><a href="index.html">Home</a></li> <li class="painting"><a href="pages/painting_collision.html">Painting/Collision</a></li> <li class="painting"><a href="pages/body_trailer_repairs.html">Trailer & Body Repairs</a></li> <li class="index"><a href="pages/Contact_us.html">Contact Us</a></li> </ul> </div> </div> </div> </body> </html> I have successfully added a background image to the page but it does not center how I want it to. Right now it is positioned at top center. I would like to move it to Center center of entire page. Using this code instead of center for background-position did not do anything. Neither did 50%, 50%. What can I do to move this over. I have the same problem with a picture file to go above the background file and web links which are all placed at top left of page. It would be nice to move them to top center of page. How is this possible through html code? Here is the code for the background image: <style type="text/css"> body { background-image: url(picture/bamboo.jpg) } body { background-position: center } body {background-repeat: no-repeat } </style> Thank you for your help, Hi all, Okay, so I've got a page with a central column which has a drop-shadow and a background image... The obvious problem is that the repeated background image doesn't always line-up with the background image in the dropshadow. Plus, The backround image changes position whenever the page is resized. So I was looking here, to see if I could find the code to center the background image in the screen, and make it a fixed position, but even then, when you resize the page, the background image seems to move with it. Does anyone know how to fix a background image so that it will stay aligned with the central content/dropshadow of the page? Thanks. Hi there, I'm trying to position a background image (starting 756 pixels from the left) which is repeating horizontally - but of course am running into problems because as soon as you repeat-x an image repeats the whole screen, not taking into account background positions. Does anyone have any ideas how I can possibly avoid this?! The only thing I can think of is to create a huge image to factor in for all screen solutions, and just not repeat it at all. I'd prefer not to do it this way as firstly it's not very clean, and secondly it will result in a large file size. Here is a link to the background image to show you what I'm talking about: http://joshsphotos.com/images/bg.jpg I've also put in the CSS that would show what I'm trying to achieve. Code: body { background-image: url(../images/bg_repeat.jpg); background-position: 756px 0px; background-repeat: repeat-x; } Any help would be most appreciated. I have worked out a section banner. There is one for each section in a column of 4 or 5. The buttons on the left call a JavaScript that move DIVs up and down, reordering the content as the user wishes. Anyway, I'm having trouble figuring out how to make the center section where the Title is, non-fixed (expand to fit the space). I'd like it to spread out to as wide as the container allows, minus the width of the left and right ends, of course. See the actual thingy on a test page he Siliconsatan Here's the styles: Code: <style type="text/css" media="all"> .col_tab_left { position: relative; width: 36px; height: 30px; left: 0px; top: 0px; background-image: url(./images/col_tab_left.gif); } .col_tab_middle { width: 430px; height: 30px; position: absolute; left: 36px; top: 0px; background-image: url(./images/col_tab_bg.gif); text-align: center; } .col_tab_right { width: 26px; height: 30px; position: absolute; left: 466px; top: 0px; background-image: url(./images/col_tab_right.gif); text-align: center; } .col_tab_title { font-family: tahoma,verdana,arial,helvetica,sans-serif; font-size: 10pt; letter-spacing: .05em; color: #003366; font-weight: bold; line-height: 30px } .col_block_up { width: 36px; height: 30px; border: 0px solid #003366; left: 5px; } .col_block_down { width: 36px; height: 30px; border: 0px solid #003366; position: absolute; left: 13px; top: 0px; } .col_image { position: relative; display:block; left: 6px; top: 12px; } </style> Here's the html: Code: <div class="col_tab_left"> <div class="col_block_up"> <img onclick="MoveBlock('ys101','bizJournalCity','Up');" class="col_image" src="images/block_up2.gif" width="11" height="11" border="0" alt="" alt="Move section up" title="Move section up" style="cursor:pointer;" /> </div> <div class="col_block_down"> <img onclick="MoveBlock('ys101','bizJournalCity','Down');" class="col_image" src="images/block_down2.gif" width="11" height="11" border="0" alt="" alt="Move section down" title="Move section down" style="cursor:pointer;" /> </div> <div class="col_tab_middle"><span class="col_tab_title">Business Journal News</span></div> <div class="col_tab_right"></div> </div> It looks like this: Hi I am trying to position a background image in my list, but I can't seem to position it where I want it, heres the example http://dmumford.bizhat.com/test/list.htm I need the bullet to be before the link home, but when I change the padding in the ul class the bullett moves with it, if that makes sense. Could someone please help me! Thank you! I am trying to apply a background to my #container div, but I don't want it to start until 150px down the y-axis (repeating y). Dreamweaver set the code to: Code: #container { padding: 0px; width: 760px; margin-top: 0px; margin-right: auto; margin-bottom: 0px; margin-left: auto; background-repeat: repeat-y; background-position: center 150px; background-image: url(graphics/container-bg.png); } I've even tried it with setting "center" to "0px" and the background image will still not start 150px down, but instead flush to the top and all the way to the end of the content. I would ask if the problem is occurring because I'm mixing "center" with a pixel amount, but like I said it still wouldn't go down with "0px 150px". Any help would be greatly appreciated. Thanks. Hey folks, here's an odd problem that's got me totally stumped. I've got a nine item unordered list, each of which is a link that contains both text and a background image. The background image is a large spritebox. I'm using background-position to shift the spritebox to display the sprite specific to the a:link and also to display a separate a:hover version. Looks great in Safari and CSSEdit, but in Firefox four of the links are misplaced and the sprite is incorrect. The hover state is correct, however. This is hard to explain, but the example should help illustrate the problem. My thought was that it was related the psuedo class of a:link, but nothing I've tried seems to help. Any thoughts? The example file contains both the HTML and the CSS (just to simplify this problem for this forum). The full background image and the file containing the sprites is at my website, artmeetsearth dot org slash 2011 slash codetest dot html. To get the image type socialmediaicons.jpg instead of codetest. Thanks for any help you can offer! Hey Guys, I designed a header logo in the top left corner of my psd document. I am now slicing my design up and I can't seem to be able to position the header into the top left hand corner. Any help would be greatly appreciated. Here is my CSS Code: ul#nav { height: 91px; width: 271px; margin:30 auto; background: url(images/logo.jpg) no-repeat; } Hello, I don't know whether this is the right forum for my issue, so apologies if it isn't. To better understand the problem, kindly visit this page: http://www.lightblu.com/contact.php Basically, you see those 4 social networking logos? They are at the right position. However, when you click "Submit (without writing anything anything in the form), the errors will display, and the logos will shift downwards as a result. I don't want this. I want the logos to be at the same position. Question: how could I do this? I'm trying to find the logic first before implementing it, which I can't even figure out. Thanks guys I have an image I want to use as the header graphic on a website. The image is 800px wide and the table is 700px wide. The graphic is meant to overlap both ends of the table. I am putting the image inside the td of the table and then setting the position to -90px relative to the table to move it across the correct amount. The problem I'm having is that the table changes width to 800px to accommodate the image. I tried putting the image outside the table but can't get the image to maintain its position relative to the table (ie when the screen width changes) Code: <!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 http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled 1</title> <style type="text/css"> html, body { height: 100%; } #maintable { height: 100%; } .logoStyle { position: relative; left: -90px; display: block; top: 0px; visibility: visible; } </style> </head> <body style="margin: 0; background-color: #D1D1D1"> <table style="width: 700px" align="center" bgcolor="#FFFFFF" id="maintable"> <tr> <td valign="top"> <img alt="Logo" src="images/header.png" class="logoStyle" /> </td> </tr> </table> </body> </html> Can anyone let me know what I've done wrong? Hi, I wanted to make active page link as bold and blue. When I hover the menu/link it works but when I click the menu item/link it doesn't. Here is my script. Please help its driving me crazy. #menu { font-family: "trebuchet ms", verdana, sans-serif; font-size: 14px; font-weight: none; position: absolute; height: 27px; top: 60px; left: 0px; width: 100%; padding: 0px; color: #000000; background-color: #eee } a:link { font-weight: none; text-decoration: none; color: #000; } a:visited { font-weight: none; text-decoration: none; border-bottom: 1px dotted #369; color: #000; } a:hover { text-decoration: underline; font-weight: bold; border-bottom: 1px solid #036; color: blue; } a:active { text-decoration: underline; font-weight: bold; border-bottom: 1px solid #036; color: blue; } #menu a:active { text-decoration: underline; font-weight: bold; border-bottom: 1px solid #036; color: blue; } |