owosso Posted April 12, 2008 Share Posted April 12, 2008 I should know this but I don't. I see coding with .menu and also #menu. What's the difference? Link to comment Share on other sites More sharing options...
boen_robot Posted April 12, 2008 Share Posted April 12, 2008 #menu targets a single element with an ID called "element".eg. <div id="menu">...</div> .menu targets one or more elements with a class called "element".eg. <div class="menu">...</div><div class="menu">...</div> Use a class when you expect to use the same style for more than one element. Use an ID if you need to target exactly one particular element on the page. Link to comment Share on other sites More sharing options...
webflex Posted April 13, 2008 Share Posted April 13, 2008 Hi,I personaly use more the class property. I think that's personnal and I prefer the class properties for styling and the ID for other function.Complements \o/ Link to comment Share on other sites More sharing options...
Ingolme Posted April 13, 2008 Share Posted April 13, 2008 I use id for semantic reasons. And class for anything that might repeat.For example: <div id="header"></div><div id="navigation"> <div class="menu"></div> <div class="menu"></div> <div class="menu"></div></div><div id="content"> <div class="box"></div> <div class="box"></div> <div class="box"></div></div><div id="footer"></div> Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.