CSS - 2 Ways To Do The Same Thing Which Is Better?
Say my page has this layout
<div class="newsheader"><a class="white" href="...">devshed.com</a></div> and my sheet looks like this, div.newsheader { font-family: Verdana; color: white; background-color: #EFBE56; } a:link {color: #C6930A;} a.white: link { font-family:Verdana; color: white; } Couldn't the same be accomplished by div.newsheader a {color: white} and <div class="newsheader"><a href="...">Devshed.com</a></div> Notice I don't have to declare a class for the anchor tag. If I have a lot of these to change it could be a big time saver. But, which is better for CSS compatability, code readability, and possible future changes. Maybe its all about my personal preferences. Thanks Similar TutorialsI've seen different was to specify the CSS, two in particular: <style type="text/css" media="screen">@import "something.css";</style> and <link rel="stylesheet" href="something.css" TYPE="text/css" media="screen"> Why would one use one over the other? This is baffling me Code: #sddm1{ margin: 0; padding: 0; z-index: 30; } #sddm1 li { margin: 0; padding: 0; } #sddm1 li a { margin: 0 1px 0 0px; text-decoration: underline; font-size: 11px; } #sddm1 li.sex { position:relative; right:24px; } #sddm1 div { position: absolute; visibility: hidden; margin: 0; padding: 0; height:14px; color:#fff; } #sddm1 div a { position: relative; left: 100px; padding: 5px 10px;. color:#fff; background:#115B8F; text-decoration: underline; } #sddm1 li.sex is the problem. If I view in FF, it appears over to the left by 24px. IE shows perfectly. I tried wrapping it in conditional comments but no effect: FF turns perfect and IE goes over to the RIGHT 24px; Code: <li><a href="why_you_should_help.html">Why you should help</a></li> <ul id="sddm1"> <li class="sex"> <a href="howyoucanhelp.html" onmouseover="mopen('m1')" onmouseout="mclosetime()">How you can help</a><div id="m1" onmouseover="mcancelclosetime()" onmouseout="mclosetime()"> <a href="candy.html" style="color:#fff;">Candy Fundraiser</a> <a href="hotchocolate.html" style="color:#fff;">Hot Chocolate Fundraiser</a> <a href="pitbeef.html" style="color:#fff;">Pit Beef Fundraiser</a> <a href="hotrodcarshow.html" style="color:#fff;">Hot Rod Car Show</a> <a href="donations.html" style="color:#fff;">Donations</a> <a href="grants.html" style="color:#fff;">Grants</a> </li> </ul><div style="clear:both;"> I have a thumbnail image with a link below. When hovering over the link, I want the enlarged image to pop up. I've tried it 2 ways. Both are close, but neither works the way I want it. Perhaps someone can help tweak one of these options? Option 1 is he http://concrete-creative.com/temp/print/1.html **What I don't like here is that you can hover over a big, blank area below the link and the larger image pops up. I only want the linked text [JACK IT UP] to pop the larger image up. Option 1_B is he http://concrete-creative.com/temp/print/1_B.html **The problem here is the the larger image while INVISIBLE is sitting below the text [JACK IT UP] which is pushing my HTML table too wide. Can someone help me find the happy medium between these 2 solutions so it works the way I want it to? THANKS! and that thing is of course to cause trouble becasue it can't stay compliant, now as much as I would love to just dismiss IE entirly and focus on happier browsers like Firefox and Opera, It seems that the normal human world loves their IE 6 and even IE 5 so I have this Here now you'll note that if you are looking through both browsers that a php script tacks on an additional stylesheet according to the browser (assuming the script is working) but they both use the same base layout, now with the exception of mabye.. two lines the css is right now basically identical... So I am left to ask. What is it in the base css (layout.css) that is causing all the rucus, I know that IE can't read the display: hidden; but I figured it could atleast read some of the other stuff, any help on the debug? thanks fullphaser Hey there I like making websites and for this one website i want to make it look really good and then buy a domain name when I'm done, but I can't figure the code in css to make an image appear at 500px down and 50px to the left when my mouse is over a link . If someone could help me with this I would be so happy! Thank you and have a nice day new to the world of css and now working on a shell for a website I'm doing. here is the css PHP Code: html, body{ margin:0; padding:0; } h1, h2, h3, h4, h5, h6 { color: #bf9060; } img { padding-bottom: 2px; } #pagewidth{ width:100%; min-width: 500px; } #header{ height:88px; width:100%; background:#ccae8f; background-image: url("/images/pillowback3.jpg"); background-repeat: repeat-x; } #navcontainer { margin: 0; padding: 0; height: 25px; width: 100%; } #navcontainer ul { border: 0; margin: 0; padding: 0; list-style-type: none; text-align: center; } #navcontainer ul li { display: block; float: left; text-align: center; padding: 0; margin: 0; } #navcontainer ul li a { background: #ffffff; width: 125px; height: 18px; border: 1px solid #ccae8f; padding: 0; margin: 0; color: #000000; text-decoration: none; display: block; text-align: center; font: normal 14px/22px "Lucida Grande", "Lucida Sans Unicode", verdana, lucida, sans-serif; } #navcontainer ul li a:hover { color: #ffffff; background: #806c59; } #navcontainer a:active { background: #806c59; color: #ffffff; } #navcontainer li#active a { background: #c60; border: 1px solid #c60; color: #fff; } and the list PHP Code: <div id="navcontainer"> <ul id="navlist"> <li><a href="/pillows.php" title="Everything you need for your pillow needs">Home</a></li> <li><a href="/build/index.php" title="Start here for the Best Pillows the net has to offer">Build</a></li> <li><a href="/samples/index.php" title="Pick up to 8 samples ">Samples</a></li> <li><a href="/products/index.php" title="See our full line of Products">Products</a></li> <li><a href="/about/index.php" title="Meet our staff. How PillowWorks works.">About</a></li> <li><a href="/contact/index.php" title="Contact us for any reason">Contact</a></li> </ul> </div> as you can see i'm using px to style the size of the elements, but that isn't very liquid This is, without a doubt, the weirdest think I've ever seen when dealing with IE and CSS. Have a look at this webpage in IE and Firefox: http://atlbloggers.net Looks fine in FF, no? But in IE, there's this giant white 'box' floating over the content in my #textarea tag. As near as I can tell, its being caused by this CSS: Code: #pageContainer { border-color: #418ade; background-color: #fff; } specifically, the background-color item. Comment that out, the site looks fine in IE. Add it back in, it breaks in IE again. I'd like to be able to set the bg color on the pagContainer tag cause I want to set a different background color for the body... Has anyone ever seen anything like this? Is it something I'm doing wrong? Please, HELP!!!!! Hi all, http://www.jaysonsgroup.com/zpip2/z.html - please see the bottom four links (home, glossary, contact, credits) The HTML is as follows: Code: <div class="centerlinks"> <table align='center'> <tr> <td> <ul> <li><a href='#'>Home</a></li> <li><a href='#'>Glossary</a></li> <li><a href='#'>Contact</a></li> <li><a href='#'>Credits</a></li> </ul> </td> </tr> </table> </div> The CSS: Code: .centerlinks { float: left; width: 550px; text-align: center; } .centerlinks ul { list-style-type: none; } .centerlinks li { float: left; padding-left: 10px; padding-right: 10px; } As you can see, what I want is a simple UL list that is horizontal, plain text, and centers within the 550px div that surrounds it , even if I add a fifth <li> link in the future. On Internet Explorer, the <table align='center'> hacks fixes the problem. But it doesn't work on Firefox. Any ideas how I can center this? (I know I can use padding-left or margin-left but then this isnt a good solution when more menu items are added to that list) Thanks in advance!! |