Re: [css-d] Div's Vs Classes
Guys and gals, thanks very much for your input (and Adam, for bringing the thread back on topic) yours and Christians suggestion of designating structural ID's was the consensus that we reached in our last scoping session as the potential for an, as you put it 'dangerous' development environment has to be the primary concern. Interestingly, during the exploration of this issue, we seem to have come full circle: Settling on using ID's for structural elements (i.e. elements that do not require being dynamically driven) and classes for everything else has in fact rendered the initial point mute, and brought us back to the correct semantic use of these functions. How elegant... in a messy kind of way! Anyway, result! and the lists input was invaluable. cheers Mike __ css-discuss [EMAIL PROTECTED] http://www.css-discuss.org/mailman/listinfo/css-d List wiki/FAQ -- http://css-discuss.incutio.com/ Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Re: [css-d] Div's Vs Classes
aside from the obvious reasons (ID's are declared only once, classes more than once) I'm interested to hear the lists opinion on the potential pitfalls of developing markup with CSS that uses only classes for layout purposes. in practice there is no real difference between id's and classes, as browsers (well, FF IE6) don't complain when multiple elements have the same ID. Validators might, but that's beside the point. That is really not beside the point.It is a matter of keeping your CSS code clean and maintainable. Clean CSS code with IDs for all elements that are once in the document and classes for all repeating elements is a lot easier to change and maintain. The clean structure of the XHTML should be reflected in the CSS. It is sad to see that instead of creating code for the future and readable for humans some developers still seem think the most important target is the browser. Oh, and yes; Scripts using the DOM and getElementById will fail, too. -- Chris Heilmann Blog: http://www.wait-till-i.com Writing: http://icant.co.uk/ Binaries: http://www.onlinetools.org/ __ css-discuss [EMAIL PROTECTED] http://www.css-discuss.org/mailman/listinfo/css-d List wiki/FAQ -- http://css-discuss.incutio.com/ Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
RE: [css-d] Div's Vs Classes
Chris Heilmann: It is a matter of keeping your CSS code clean and maintainable. did I say go write spaghetti? The OP is not allowed to use IDs. Whether he writes clean code is between him and his maker. The point is, just using classes will make no difference to the way the website *functions*. some developers still seem think the most important target is the browser. heh. who would think that? the end user perhaps? nah... R __ css-discuss [EMAIL PROTECTED] http://www.css-discuss.org/mailman/listinfo/css-d List wiki/FAQ -- http://css-discuss.incutio.com/ Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Re: [css-d] Div's Vs Classes
It is a matter of keeping your CSS code clean and maintainable. did I say go write spaghetti? The OP is not allowed to use IDs. You did: Quote: in practice there is no real difference between id's and classes :EndQuote This is a wrong statement, to make it even remotely true it should say Some browsers, in their forgiving manner don't distinguish between IDs and classes. Although they do recognise the different specificity they will allow you to use more than one ID with the same name in a document which is contradictory to the w3c guidelines Whether he writes clean code is between him and his maker. The point is, just using classes will make no difference to the way the website *functions*. See specificity, only using classes will get you into trouble overriding settings and makes it hard to use contextual selectors without mucking about with the HTML. IDs are there to identify unique sections and elements in the page, not store business logic variables. In forms, this intermingles, but you should still be allowed to identify and style the different page segments in CSS without resorting to unambiguous selectors. some developers still seem think the most important target is the browser. heh. who would think that? the end user perhaps? nah... The end user cares about _her_ browser, on _her_ environment and with _her_ settings. Who are we to anticipate all of these variables? If her experience throughout the site is of a consistent quality, all is fine. The only ones who will find differences between browsers are developers, the test team or misguided project owners. Back to the problem: Why don't you come up with a list of IDs that you and the development team agree on? Some .NET developers are prone to create horrible, bloated and invalid IDs. You can separate the structure layer out in .NET aswell, it just means you cannot use the design view of Visual Studio, and that means more work. However, you will be the one who has to answer when the final result looks bad or doesn't display properly, therefore it is a good plan to CYA by working closely with the development team and don't allow them to do things that are your job. this is off-topic though and better suited for the evolt list __ css-discuss [EMAIL PROTECTED] http://www.css-discuss.org/mailman/listinfo/css-d List wiki/FAQ -- http://css-discuss.incutio.com/ Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Re: [css-d] Div's Vs Classes
Christian Heilmann wrote: this is off-topic though and better suited for the evolt list moderatorIndeed, most of this discussion was very much off-topic. Please confine crusades to the off-list community. Thanks./moderator To respond to the concerns of the original post, the one pitfall I can see in developing CSS with only classes is the potential for conflicting declarations. In general, if one is using IDs, it is easy to write things like: #content a.external {color: blue;} p.first a {color: green;} You know that the first rule will always apply because of the ID. If the first rule uses a class instead of an ID, however, and the rules still appear in that order, the second rule will override the first, and your external link in the first paragraph will now be misleadingly green. So when using only classes, you will need to be very careful about specificity and rule conflicts. It will be a much more dangerous environment to work in, and will make later changes to the code more difficult, as they will be more likely to conflict with existing rules. However, careful development practices could make it work. I do agree with Christian, though, that it would be good to get with the developers and see if you can't designate a few structural IDs that could be used for styling. If they agree, that will help you a lot. If they don't, you are covered when a later, last-minute change breaks the display. Good luck, -- -Adam Kuehn CSS-D List Moderator __ css-discuss [EMAIL PROTECTED] http://www.css-discuss.org/mailman/listinfo/css-d List wiki/FAQ -- http://css-discuss.incutio.com/ Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Re: [css-d] Div's Vs Classes
Some idiot (namely, me) wrote: #content a.external {color: blue;} p.first a {color: green;} If the first rule uses a class instead of an ID, however, and the rules still appear in that order, the second rule will override the first, and your external link in the first paragraph will now be misleadingly green. No, it won't in this case, because I constructed the example poorly. Please just ignore the specific example. Just notice that unexpected conflicts are easier to come by and my sometimes bite you when you least expect it. Thus, you need to be more careful, and expect things to break more when you make changes. Thanks, -- -Adam Kuehn __ css-discuss [EMAIL PROTECTED] http://www.css-discuss.org/mailman/listinfo/css-d List wiki/FAQ -- http://css-discuss.incutio.com/ Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
[css-d] Div's Vs Classes
Dear List: At work, we are currently working out the spec for the next revision of our CMS (standards compliant of course). During our scoping meetings, some members of the dev team have specified that we designers provide them with front-end CSS and XHTML markup that uses ONLY classes. The reason why is not important (for info, they would like to reserve the use of ID's for .NET programming purposes) so My question is this: aside from the obvious reasons (ID's are declared only once, classes more than once) I'm interested to hear the lists opinion on the potential pitfalls of developing markup with CSS that uses only classes for layout purposes. cheers Mike www.madewithpixels.co.uk design | graphics | multimedia __ css-discuss [EMAIL PROTECTED] http://www.css-discuss.org/mailman/listinfo/css-d List wiki/FAQ -- http://css-discuss.incutio.com/ Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
RE: [css-d] Div's Vs Classes
Mike wrote: aside from the obvious reasons (ID's are declared only once, classes more than once) I'm interested to hear the lists opinion on the potential pitfalls of developing markup with CSS that uses only classes for layout purposes. in practice there is no real difference between id's and classes, as browsers (well, FF IE6) don't complain when multiple elements have the same ID. Validators might, but that's beside the point. R __ css-discuss [EMAIL PROTECTED] http://www.css-discuss.org/mailman/listinfo/css-d List wiki/FAQ -- http://css-discuss.incutio.com/ Supported by evolt.org -- http://www.evolt.org/help_support_evolt/