kermitsumoto 0 Posted October 8, 2009 Report Share Posted October 8, 2009 Hey guys.So i'm a bit green with css but im getting my game up. I recently came across a style sheet that had a class name without a '.' in front that works when loadedie:classname {height: 200px;width:200px;}I know by now id s get # and classes get . so how does this still work without the . ? Quote Link to post Share on other sites
Ingolme 1,020 Posted October 8, 2009 Report Share Posted October 8, 2009 Hey guys.So i'm a bit green with css but im getting my game up. I recently came across a style sheet that had a class name without a '.' in front that works when loadedie:classname {height: 200px;width:200px;}I know by now id s get # and classes get . so how does this still work without the . ?It's not working, it simply can't be working.If you omit the '.', the browser will search for <classname> elements rather than elements with class="classname" Quote Link to post Share on other sites
chibineku 0 Posted October 8, 2009 Report Share Posted October 8, 2009 Perhaps a custom doctype with unique syntax? Quote Link to post Share on other sites
kermitsumoto 0 Posted October 8, 2009 Author Report Share Posted October 8, 2009 It's not working, it simply can't be working.If you omit the '.', the browser will search for <classname> elements rather than elements with class="classname" My only way of realizing this was working is when i removed that class without the '.' it no longer produced the result it was producing (background image).Maybe im not looking far enough into this but it just seemed weird to me. removing the class from the css completley was my only way to see that it was working. I thought it was garbage code til i removed it and it no longer displayed bg image Quote Link to post Share on other sites
Ingolme 1,020 Posted October 8, 2009 Report Share Posted October 8, 2009 My only way of realizing this was working is when i removed that class without the '.' it no longer produced the result it was producing (background image).Maybe im not looking far enough into this but it just seemed weird to me. removing the class from the css completley was my only way to see that it was working. I thought it was garbage code til i removed it and it no longer displayed bg imageYour original stylesheet might have been saved in the browser cache and that's why it still worked. Quote Link to post Share on other sites
kermitsumoto 0 Posted October 8, 2009 Author Report Share Posted October 8, 2009 Your original stylesheet might have been saved in the browser cache and that's why it still worked.it actually removes the background right in dreamweaver. It s pretty weird. thats why im even talking about it.here's a look at the css http://www.cookieconfidential.com/cc.cssplease don't hate on the code format:(notice how "body" has no . in front of it. (theres an id and a class called body also but that shouldnt have anything to do with this, right?) This was something i overlooked and it was working then i said hey, why does that work, lemme add . or take that whole class out and see what happens? it lost the background image when i did that meaning it does use it.just weird to me Quote Link to post Share on other sites
Zath 0 Posted October 8, 2009 Report Share Posted October 8, 2009 it actually removes the background right in dreamweaver. It s pretty weird. thats why im even talking about it.here's a look at the css http://www.cookieconfidential.com/cc.cssplease don't hate on the code format:(notice how "body" has no . in front of it. (theres an id and a class called body also but that shouldnt have anything to do with this, right?) This was something i overlooked and it was working then i said hey, why does that work, lemme add . or take that whole class out and see what happens? it lost the background image when i did that meaning it does use it.just weird to meSelectors such as body, p, h1, ul, don't need the full stop preceeding it. If you have .p then you would be declaring your own class of p.The .body is a declaration of a class.Strangely they're not reserved words or letters it seems and are happily validated. Quote Link to post Share on other sites
thescientist 231 Posted October 8, 2009 Report Share Posted October 8, 2009 (edited) body is a required element of a correctly validating website I believe. Your site would end up having problems putting a . or a # in front of it. (similar to a reserved word...?)edit: nm, read above post instead of mine. Edited October 8, 2009 by thescientist Quote Link to post Share on other sites
kermitsumoto 0 Posted October 8, 2009 Author Report Share Posted October 8, 2009 body is a required element of a correctly validating website I believe. Your site would end up having problems putting a . or a # in front of it. (similar to a reserved word...?)edit: nm, read above post instead of mine.Well it all becomes clear to me now!ok, i did know that about p ul and all the text stuff but not "body"thanks for filling me in! Quote Link to post Share on other sites
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.