Johns3n Posted March 4, 2011 Share Posted March 4, 2011 Hi PHPfreaks! (those that maybe are more closet CSSfreaks) ^^ I'm currently designing a webpage which you can see at http://www.johns3n.net But i'm really having some trouble with CSS inheriting it self like a mother¤#%"?!, i spent all night trying to solve it and went to be angry and watched two and a half men instead deciding that i would start from stratch again the next morning using proper CSS selectors to make sure that NO inheritance should be possible, but much to my chargrin it was still inheriting styles where it shouldn't be. i will include the css here as i set my wordpress to minify CSS output which could be very annoying to find heads or tails in html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, ins, img, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td { margin:0; padding:0; border:0; } ol, ul { list-style:none; } table { border-collapse:collapse; /* <table> tags skal stadig have 'cellspacing="0"' i XHTML markuppen */ border-spacing:0; } html, body { height:100%; } #wrapper { position:relative; left:50%; width:960px; min-height:100%; height:auto !important; /* Fixer <div id='footer'> problemmet i Internet Explorer 6 */ height:100%; margin-top:0; margin-right:auto; margin-bottom:-330px; /* Margin-bottom skal være <div id='footer'>s højde i negativ værdi */ margin-left:-480px; } #footer, #push { height:330px; /* #push og #footer SKAL have den samme værdi i højden */ clear:both; /* Fixer Multi kolonne layouts */ } #footer { width:980px; left:50%; background-position:center; background-repeat:repeat-y; background-image:url(gfx/footer_bg.gif); margin:auto; } /* XHTML/CSS FRAMEWORK SLUT */ /* TAGS START */ body { font-family:Verdana, Geneva, sans-serif; font-size:12px; color:#222; background-image:url(gfx/body.jpg); background-position:center; } a, a:active, a:visited { font-size:12px; color:#618521; } a:hover { font-size:12px; color:#9ac83d; } blockquote { background-image:url(gfx/quote.png); background-color:#fafafa; background-repeat:no-repeat; background-position:0px 12px; font-weight:normal; font-size:17px; line-height:1.5em; font-style:italic; font-family:Georgia, 'Times New Roman', Times, Serif; margin-top:10px; margin-right:20px; margin-bottom:10px; margin-left:20px; padding-top:15px; padding-right:15px; padding-bottom:30px; padding-left:45px; } blockquote > strong { float:right; } blockquote > em { float:right; font-size:12px; } /* TAGS SLUT */ /* ID'S START */ #menu { background-image:url(gfx/footer_bg.gif); background-position:center; background-repeat:repeat-y; width:980px; height:100px; margin-left:-10px; } #menu > ul { display:inline; } #menu > ul > li[class="topmenu"] { float:left; display:inline; padding-top:50px; padding-bottom:50px; } #menu > ul > li[class="topmenu"] > a, a:active, a:visited, a:hover { font-size:28px; } now the problem is that I set the "#menu > ul > li[class=topmenu] >" <a> tags to be shown a certain, the problem is that if you go to for instance the (web)blog page on my website you can see that the <a> tag rules from #menu > ul > etc... are applied to the <a> tags outside aswell DISPITE that i clearly stated in the CSS file that all other <a> tags should just have a simple color and text size, but it inheritis completly at random! and this is just a little part of trouble i'v been having with the css, so i hope you can help, before I have an accident and quit web buisness and become a school teacher ^^ in advance thanks! Quote Link to comment https://forums.phpfreaks.com/topic/229581-problem-with-css-inheritance/ Share on other sites More sharing options...
Johns3n Posted March 4, 2011 Author Share Posted March 4, 2011 I actually managed to solve it myself after much trial and error ^^ this is the code that saved my webproject: div#menu { background-image:url(gfx/footer_bg.gif); background-position:center; background-repeat:repeat-y; width:980px; height:100px; margin-left:-10px; } div#menu > ul { text-align:center; width:100%; height:100%; } div#menu > ul > li.topmenu { font-family:'helvetica black','arial black','helvetica','arial',sans-serif; font-size:22px; font-weight:bold; text-transform:uppercase; letter-spacing:-2px; float:left; width:180px; height:100%; display:inline-block; margin-left:13px; } div#menu > ul > li.topmenu > a { text-decoration:none; color:#fafafa; min-width:180px; min-height:65px; display:inline-block; padding-top:35px; } div#menu > ul > li.topmenu > a:hover { background-image:url(gfx/navigation.gif); background-position:-15px -444px; text-decoration:none; color:#9ac83d; } This thread can be closed and marked as solved now ^^ Quote Link to comment https://forums.phpfreaks.com/topic/229581-problem-with-css-inheritance/#findComment-1182869 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.