CSS - How To Effect Parent Element But Not Its Childreen As Well?
Hi,
Is it possible to change the css properties of a parent element without changing the properties of its childreen? That is, in the following code: Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>ccc</title> </head> <body> <ul> <li>Hello <ul> <li>World</li> </ul> </li> </ul> </body> </html> Is it possible to modify the root UL to have font set to 200% without the child UL also being effected?? Thansk and Regards, Sim085 Similar TutorialsI have an navigation menu that I am building as an unordered list. What I have is an image rollover that appears at the bottom of the navigation menu when the cursor hovers over one of the first level links by using a span within the link that has its display set to none, and then set to absolute positioned directly below the navigation menu on a:hover. Here is an example: Code: <ul> <li> <a href="link1.html" id="link1">Link<span></span></a> </li> </ul> .link a { some link height } .link a span { display: none; } .link a:hover span { position: abolute; top: (some link height * the number of links); background-image: (some image url) width: (image width) height: (image height) } Appearance: ------ Link1 Link2 Link3 Link4 ------- ------- Rollover Image to appear here ------- The problem that I have is that since the rollover image is positioned absolutely, if the size of the list of links changes (IE with sub-links in the list) it slides under or over where I have the rollover image placed. IE ------ Link1 sublink1 sublink2 Link2 Link3 Link4 ------- will break my scheme. Is there a way to get the span within the link to show up relative to the bottom of the <ul> element, or at the bottom of an element that contains the whole shebang? If I cant get this to work, I'm going to be forced to adopt the existing tables/javascript based template for our site, and I'd hate hate hate to do that. thanks. I've been getting quite confused as to why some CSS wasn't doing what I'd expected it to do. I have code like this: Code: .tBox { width: 50px; height: 50px; } .tHeader { opacity: 1 } .tBox:hover .tHeader { opacity: 0.5 } I then have my DIVs like this (simplified) Code: <div class="holder"> <div class="section1"> <div class="tBox"> </div> </div> <div class="section2"> <div class="tHeader"></div> </div> </div> So what I was expecting to happen is that when someone hovered over "tBox" then "tHeader" would switch opacity. But it wasn't. And I believe this is because tBox and tHeader aren't in the same parent. I read somewhere something about using a "+" to do some special selector stuff in the CSS but didn't really understand. Can someone please help me with how I can get this to work outside of them sharing their parent. Thanks. Please look at this page - http://hometown.tmhdesign.com/ask.asp?faq=9 See how the <p> exceeds the containing box at the bottom? I put a border-bottom on the containing div to show you where the issue occurs. It does not happen in IE7 I just noticed it does it also on this page http://hometown.tmhdesign.com/staff.asp Is there a way to style an element's parent with css? I know something like .div1 p { stuff here } takes care of p's that are inside div1 but is there a way to style say any div1 with a div2 inside? Or a ul with a ul inside? Can anyone explain the difference between the two? For example, what is the difference between: this: element element {} div p { } and this: element > element { } div > p { } I don't understand it and have not found an explanation in tireless searching. Thx! My css is at CSS. The site is at site The problem I am having is that on the .maintextdiv or the .subtextdiv if I add any left or right margin values IE6 in strict mode is adding that value to the parent element, #rightbox. I should clarify that if I add margin values to just one of them it displays fine, but if I add margin values to both of them then I end up with the problem of extra space added to the parent element. More wierdness, if those (maintextdiv and subtextdiv) are not floated then the problem doesn't show up at all. It's only once they got floated did I have problems. This behavior doesn't show up in FF or Safari. Anyone with any ideas? Please look at this page - http://www.soarminden.com/glider-soaring-gallery.asp I put a red border on parent element. The children divs appear outside the parent at page bottom? Can someone shed some light please? I think the issue is with the styling of the div(s) innerLeftColumn or LeftColumn Code: <div style='width:670px;margin:0;border:1px solid red;min-height:500px;position:relative;'> <div style='width:175px;height:150px;float:left;margin:20px 0 20px 10px;clear:left;'> <img src='images/gallery/1/tom6.jpg' style='width:175px;height:150px;margin-bottom:3px;'/><br /> <h4 style='text-align:center;font-size:12px;margin:0;padding-bottom:10px'><a href='glider-soaring-gallery2.asp?subject=1' style='color:#00f;line-height:1;text-decoration:undeline !important;'>Tom Hall Soaring</a></h4> </div> <div style='width:175px;height:150px;float:left;margin:20px 0 20px 10px;'> <img src='images/gallery/12/phil-jones2.jpg' style='width:175px;height:150px;margin-bottom:3px;'/><br /> <h4 style='text-align:center;font-size:12px;margin:0;padding-bottom:10px'><a href='glider-soaring-gallery2.asp?subject=12' style='color:#00f;line-height:1;text-decoration:undeline !important;'>Phil Jones Goes Gold & Diamond!</a></h4> </div> <div style='width:175px;height:150px;float:left;margin:20px 0 20px 10px;'> <img src='images/gallery/13/wedding1.jpg' style='width:175px;height:150px;margin-bottom:3px;'/><br /> <h4 style='text-align:center;font-size:12px;margin:0;padding-bottom:10px'><a href='glider-soaring-gallery2.asp?subject=13' style='color:#00f;line-height:1;text-decoration:undeline !important;'>Wolfram and Lydia's Wedding</a></h4> </div> <div style='width:175px;height:150px;float:left;margin:20px 0 20px 10px;clear:left;'> <img src='images/gallery/15/DSC_6547.jpg' style='width:175px;height:150px;margin-bottom:3px;'/><br /> <h4 style='text-align:center;font-size:12px;margin:0;padding-bottom:10px'><a href='glider-soaring-gallery2.asp?subject=15' style='color:#00f;line-height:1;text-decoration:undeline !important;'>Brennan Hall Soaring Lake Tahoe</a></h4> </div> <div style='width:175px;height:150px;float:left;margin:20px 0 20px 10px;'> <img src='images/gallery/16/teresa.jpg' style='width:175px;height:150px;margin-bottom:3px;'/><br /> <h4 style='text-align:center;font-size:12px;margin:0;padding-bottom:10px'><a href='glider-soaring-gallery2.asp?subject=16' style='color:#00f;line-height:1;text-decoration:undeline !important;'>Teresa Luther</a></h4> </div> </div> i have a block that i have the opacity set to .80. within this block i have text. The reason i have the opacity set at .80 is to help increase contrast between the background and text. the heading of the page is within the the block and is inheriting the opacity behaviour. Is there a way to turn this off? like a no-inherit? heres the block: #content { width: 470px; height: 380px; background: #fff; padding: 0px 5px 10px 10px; border: 0px solid yellow; overflow: scroll; float: clear; filter:alpha(opacity=80); -moz-opacity:0.8; opacity: 0.8; } page titles a .pagetitles { font-size: .8em; font-weight: bold; font-family: verdana, Georgia, Times, serif; color: #ffcc00; line-height: .4em ; } The goal of the following code is to have a search box with several tabs above it to narrow down the search. The issue is that the design calls for a little upside down triangle to appear below the tab and bleed into the text box. The code works great in Firefox and even in IE6 where the Doctype was switched to HTML 3.2. I'm using 4.01 Transitional and noticing that the arrow doesn't center itself below the tab, rather it centers itself in the entire page. If I take out the width: 100% from .searchbox li.active .downarrow, then both browsers behave the same, although the downarrow now appears in the left bottom corner of the tab rather than the center. Note that I've stripped most of the code away to narrow down the issue. Code: <style> .searchbox ul { float: left; padding-left: 10px; list-style: none; padding: 0; margin: 10px 0 0 0; } .searchbox li { float: left; } .searchbox li .downarrow { display: none; } .searchbox li a { display: block; float: left; font-size: 12px; padding: 3px; color: #213327; } .searchbox li.active { position: relative; } .searchbox li.active a { color: #fff; border: 1px solid #b3b2b0; background: #266d1e url('/c2footsearchbg.jpg') repeat-x scroll top left; } .searchbox li.active a:hover { text-decoration: none; } .searchbox li.active .downarrow { display: block; position: absolute; bottom: -9px; width: 100%; height: 10px; text-align: center; margin: auto; } .searchbox div { clear: both; display: inline-block; } .searchbox input.txt { border: 2px solid #999; padding: 5px 0 0 3px; width: 305px; height: 30px; } .searchbox input.submit { font-weight: bold; font-size: 12px; color: #fff; width: 71px; height: 30px; border: 0; background: transparent url('/c2searchbutton.jpg') no-repeat scroll top left; vertical-align: top; cursor: pointer; } .searchbox input.submit:hover { background-position: 0 -30px; } </style> <div class="searchbox"> <h3>Search</h3> <ul id="c2FootSearch"> <li class="active"><a href="/index.php">Main</a><div class="downarrow">↓</div></li> <li><a href="/groups/">Groups</a><div class="downarrow">↓</div></li> <li><a href="/people/">People</a><div class="downarrow">↓</div></li> <li><a href="/petitions/">Petitions</a><div class="downarrow">↓</div></li> <li><a href="/news/">News</a><div class="downarrow">↓</div></li> <li><a href="http://www.google.com">Google</a><div class="downarrow">↓</div></li> </ul> <div> <form action="/searchall.html" method="post"> <input type="hidden" name="search" value="main" /> <input type="text" name="q" class="txt" /> <input type="submit" value="Search" class="submit" /> </form> </div> </div> Hi guys, I'm changing a simple page from a table style layout to CSS Positioning style. Here's a common line...it's working fine in IE, but not in Firefox (which immediately tells me there's something wrong with my coding). The code is: 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>Overflowing Box</title> <style type="text/css"> div.row{ padding-top : 10px; font-family : Verdana, Arial, Helvetica, sans-serif; font-size : 10px; } .image{ float : left; font-weight : bold; width : 210px; } .description{ float : right; width : 235px; } </style> </head> <body> <div style="width: 450px; background-color: #cc9; border: 1px dotted #333; padding: 5px; margin: 0px auto"> <div class="row"> <div class="image">An image will go here</div> <div class="description"> <strong>Heading:</strong> Text <br> <a href="http://www.somesite.com" target="_blank">http://www.somesite.com</a><br> <br> This is some meaningless text. This is some meaningless text. This is some meaningless text. This is some meaningless text.<br> <br> This is some meaningless text. This is some meaningless text. This is some meaningless text. This is some meaningless text. This is some meaningless text.<br> <br> This is some meaningless text. This is some meaningless text. This is some meaningless text. <br> <br> </div> </div> </div> </body> </html> It's a very simple example, but for some reason, the container doesn't "expand" in Firefox as I'd expect. I've hunted around the web, played around and tried some of my other code to no avail. Am I missing the simplest of attributes? Any help would be GREATLY appreciated. Thanks in advance! Hi all, The easiest way to see the problem is to look at this demo in firefox. (I haven't patched it to work in IE yet.) The menu items in the 1st 2 menu's don't expand to fill the available area. Any ideas? Hi, My page has 3 elements: one at the top(header banner), one in the middle (a middle content area) and one at the bottom (footer banner). Now I want those positions to remain intact regardless of the number of lines output in the middle element. The content is going to be determined at runtime by a server-side routine so I don't want to use a fixed positioning for the footer banner. I want it to be displayed at the bottom - after the middle content is displayed. And I want the middle content to be visible in the page i.e. I don't want a scroll area within the page. I have tried various approaches and read up on positioning but so far have not been able to do it using css. Any help is much appreciated. Jim I'm perplexed. I have a div, Code: <div class="classname"> containing a table in muliple pages. I tried applying css style to the div using .classname{ css }, backgroundcolor took affect but color and font-size didn't, its works on others pages though. So I tried Code: <table style="color: red; font-size: 12px;"> This worked! I can't understand why the css would not affect the div itself. Talk about annoying. If anyone has any possible explanations, I'd like to hear. css are assigned to individual div's. body has backgroundcolor only. Hi guys, This site Valentino dot com has the menu slide out another transparent image when you mouse over it. How is this done? How can I do this? What is the code etc? Peter I'm creating a menu and use margin as a separator between menu elements. On the first and second level, margin works but no matter what I put on the third, they're all stick together. html4strict Code: Original - html4strict Code <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "(URL address blocked: See forum rules)"> <html xmlns="(URL address blocked: See forum rules)" lang="en" xml:lang="en"> <head> <title>Title</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link href="css/menu.css" rel="stylesheet" type="text/css" /> </head> <body> <div class="menu_1st_normal"> <a href="default.asp?catID=17">abcde</a> </div> <div class="menu_2nd_normal"> <a href="default.asp?catID=5">abcde</a> </div> <div class="menu_3rd_normal"> <a href="default.asp?productID=44">abcde</a> </div> <div class="menu_3rd_normal"> <a href="default.asp?productID=45">abcde</a> </div> <div class="menu_3rd_normal"> <a href="default.asp?productID=46">abcde</a> </div> <div class="menu_2nd_normal"> <a href="default.asp?catID=6">abcde</a> </div> <div class="menu_2nd_normal"> <a href="default.asp?catID=7">abcde</a> </div> <div class="menu_2nd_normal"> <a href="default.asp?catID=8">abcde</a> </div> <div class="menu_1st_normal"> <a href="default.asp?catID=9">abcde</a> </div> </body> </html>
menu.css: css Code: Original - css Code .menu_1st_top{font-size:12px;padding:3px 2px 4px 12px; background: url(../images/menu_top_left.gif) no-repeat #0066CC 0px 0px; font-weight:bold;margin:0px 0 1px 0;color:white} .menu_1st_top a{color:white; font-weight:bold;} /* 1st level menu normal*/ .menu_1st_normal{font-size:12px;padding:3px 2px 4px 12px; background: #0066CC 0px 0px; font-weight:bold;margin:0 0 1px 0;color:white} .menu_1st_normal a{color:white;font-weight:bold;} /*----------------------------------------------------------------------------------------------------------*/ /* 2nd level menu normal*/ .menu_2nd_normal{font-size:11px;padding:3px 2px 4px 20px; background:#3399FF;margin:0px 0px 1px 0px;} .menu_2nd_normal a{font-size:11px;color:white;font-weight:bold;} /* 3r level menu normal */ .menu_3rd_normal{font-size:11px;padding:3px 2px 4px 28px; background:#33CCFF;margin 0px 0px 1px 0px;} .menu_3rd_normal a{font-size:11px;color:white;font-weight:bold;} /*----------------------------------------------------------------------------------------------------------*/ /* bottom image */ .menu_bottom_image{width:155px;height:10px;background:url(../images/menu_bottom_155.gif) no-repeat;font-size:1px;margin:0 0 1px 0;}
I have try with both firefox and IE, the result is the same. Any ideas? Thank you. I am making this page and I have a css link thing on my pages and on the mycss.ccs has the code to change the kind of button but I only want it to take a effect with the buttons that I give them a name that matches the name of the buttons it should effect. Thank you. Along the left side of bing are some text links in a table cell. When bing loads you can see a semi-transparent block to give the text contrast if the background has a light color. Also, there is a rollover effect that shades the text. 1. How do I get the semi-transparency? 2. how do Iget the rollover effect? The web page that I am having a problem editing is: www dot postalstampssale dot com We are having a problem getting the mouse over effect on the three (3) jpg images in the upper right hand corner. We have added the appropriate CSS mouse over coding just under the <TITLE> are on the top. We have a;sp added the CSS coding at the end of the page. However, we can not figure out how to attach the proper coding to each image. The current coding is: <img src="Images/Canada/Canada_Scott_356_Front.jpg" width="90" height="60" alt="" border="0" align="right"> <img src="Images/Germany/Germany_Scott_65.jpg" width="89" height="62" alt="" border="0" align="right"> <img src="Images/Bermuda/Bermuda_Scott_55.jpg" width="54" height="64" alt="" border="0" align="right"> Can someone please suggest how to modify the above coding. Thank you in advance. The url has been blocked? So I'll try this way: spidersandmilkdotcomforwardslashspiderdotcss Hi there, I am trying to acheive an effect like the image below.. so when the link is hovered on, there is a light gray bg, but with a 1px space above and below the bg. This is my CSS I have, but it is displaying what looks like a 2px border because my link has a top and bottom gray border. Any ideas how I can acheive this effect? PHP Code: #categories_home a{ background-image: url('images/nav_arrow.gif'); background-repeat:no-repeat; background-position:left; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; color: #6dbd00; text-decoration: none; padding: 2px 2px 2px 25px; border-bottom: 1px solid #ececec; border-top: 1px solid #ececec; display:block; } #categories_home a:hover{ background-image: url('images/nav_arrow.gif'); background-repeat:no-repeat; background-position:left; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; color: #6dbd00; text-decoration: none; display:block; padding: 2px 2px 2px 25px; background-color: #f6f6f6; border-bottom: 1px solid #ffffff; border-top: 1px solid #ffffff; } |