kermitsumoto Posted October 8, 2009 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 . ? Link to comment Share on other sites More sharing options...
Ingolme Posted October 8, 2009 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" Link to comment Share on other sites More sharing options...
chibineku Posted October 8, 2009 Share Posted October 8, 2009 Perhaps a custom doctype with unique syntax? Link to comment Share on other sites More sharing options...
kermitsumoto Posted October 8, 2009 Author 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 Link to comment Share on other sites More sharing options...
Ingolme Posted October 8, 2009 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. Link to comment Share on other sites More sharing options...
kermitsumoto Posted October 8, 2009 Author 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 Link to comment Share on other sites More sharing options...
Zath Posted October 8, 2009 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. Link to comment Share on other sites More sharing options...
thescientist Posted October 8, 2009 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. Link to comment Share on other sites More sharing options...
kermitsumoto Posted October 8, 2009 Author 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! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.