Welcome Guest [Log In] [Register]
We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Multiquote (on) Multiquote (off)
Add Reply
Annoying CSS Decisions (Default Theme)
Topic Started: Aug 28 2011, 04:43 PM (760 Views)
James Walter
Member
[ * ]
Alright, I've already created several themes for myself and others, and the frustration I've had with the default ZB CSS has mushroomed to the point where I am now creating my own default CSS/template to use when creating forum skins.

This may not be the right place to discuss this, but I know one of the large selling points for ZB is how easy it is to customize yourself, along with the wealth of mods available from the community.

My question is... why in the world is something like this in the CSS...

Code:
 
.category h2 a,#portal h2 a,#portal_foot h2 a,thead a,.category h2 a:hover,#portal h2 a:hover,#portal_foot h2 a:hover,thead a:hover,#top_info a,#top_info a:hover,.drop_menu a,.drop_menu a:hover,#submenu a,#submenu a:hover {
color:#fff;
}


The first time I worked on a skin, that particular line really ruined my day... I was a complete noob with CSS then and got so frustrated trying to figure out why my category and drop menu links refused to listen to the colors I was selecting for them. That particular line of code is almost entirely useless, not to mention redundant and a complete waste of space.

I'm still digging through the CSS and finding other small snippets that are similar to the one above... and it makes me wonder WHY?
Offline Profile Quote Post Goto Top
 
Kotton
Member Avatar
★ Career Criminal ★
[ *  * ]
I may be wrong, but doesn't that just group all of those items into a singular entity so they all receive white text properties?

and if that's the case, I think it's fairly clever vs assigning/defining each item's individual properties
Edited by Kotton, Aug 29 2011, 12:37 AM.
Offline Profile Quote Post Goto Top
 
James Walter
Member
[ * ]
No, you're right. The problem stems from the fact that each of those selectors are found multiple times throughout the CSS, which can cause some headaches when trying to do something as simple as change the link color.

It wouldn't be so bad if the CSS weren't 1800+ lines long. But with a file that large, there should at least be some logic in which elements are grouped, and where they are placed in the file.
Offline Profile Quote Post Goto Top
 
Ben
Member Avatar
Quantum-locked when observed.

Selectors are grouped that way to reduce the number of times we have to assign elements the colour white as their text colour. This is useful when one wants to adjust the colour of all those elements in one go—otherwise, one would have to search through the entire style sheet, find each of those selectors, and change the text colour!

I agree that the ZB CSS is somewhat long and perhaps unwieldy, and that's particularly unfortunate for people who are new to CSS. That being said, tinkering with different parts of the style sheet to learn how the rules cascade is part of the learning process—albeit one of the more frustrating parts. I myself, as someone who has been using CSS for years now, still get tripped up by priority all the time.

If you use Firefox, I cannot recommend enough that you use Firebug to help you with your development. Firebug will actually show you which rules in the style sheet are taking effect and which rules are being overriden somewhere else, all on an element by element basis. It's invaluable for untangling knots like those you have encountered. Other browsers have similar developer tools.
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · ZetaBoards - Theme & Code Support · Next Topic »
Add Reply