Skip to main content
gamedev.net
🔒 Locked

[web] CSS Question

Started by cowsarenotevil 1 reply 900+ views
Original Post
cowsarenotevil
cowsarenotevil
OK, I'm relatively new to CSS, and, knowing how baffling some of the questions asked by newbies of other topics look to me, this probably won't make much sense. Taking a look at this floating menu, I have two questions. Firstly, why is the menu style labeled as "#main #menu" and not simply "#menu"? Secondly, why is "#menu p { font-size:10px}" seperate from "#main #menu"? Thanks.
-~-The Cow of Darkness-~-
Talonz
Talonz
Okay these are some some cool things about css that you will eventually find useful. Using two selectors with spaces between them will apply them only to objects that are inside both of the classes. So far example, if I want all my links to be red, but I want only the ones in the nav class to be blue, I could do:

<html><head><style type="text/css">  a {font-color:blue;}  #nav a {font-color:red;}</style></head><body><div id="nav"><p><a href="page.htm">This will be a red link</a></p></div><div><p><a href="link.htm">And this will be a blue link</a></p></div></body></html>

Now I am guessing that they wanted to do it that just to be specific.

However, for the #menu p instead of #menu, it's because when you apply things like fonts and sizes to text, it will only effect things inside of the container, but not inside of a container that's in that container. That sounds a bit confusing but it's really not.

<html><head><style type="text/css">  body {font-size:10px;}</style></head><body><p>This text will be 10px.</p><table><tr><td><p>This text will be the default size (NOT 10px).</p></td></tr></table></body></html>

So a solution is to basically use p tags on everything (which should be a priority) or as I do just use body,th,td to make sure that it applies to most everything. :) A lot of these things are personal preference when it comes to how you go about applying them.
cowsarenotevil
cowsarenotevil
Oh, I see. That makes perfect sense. Ratings++
-~-The Cow of Darkness-~-

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.