Jump to content
  • Advertisement
Sign in to follow this  
cowsarenotevil

[web] CSS Question

This topic is 4817 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!