By kzeng on
I got a very weird block theming probem. I want to theme a particular block in my sidebar. By default, all the blocks share the same class which is .block So I keep the definition of this class in my style.css file unchanged. Then I look at the individual class of the block I hope to theme, which is, say, .block-blockuser. After creating new definition of .block-blockuser and upgrading my style.css file, something weird occured. All the blocks above the "blockuser" block still maintains the default css definition which is good, but all the blocks below the "blockuser" block had the same css definition of the "blockuser" block! Why would this happen?
Comments
That is wierd...
... I'd recommend getting FireFox and the Web Developer plugin; it has a 'View Style' option which shows a hierarchical view of the CSS classes of whatever item is under the mouse cursor... I've found this invaluable for debugging CSS issues like this.
Pete.
Thanks a lot. I solved the
Thanks a lot. I solved the problem with the help of Web Developer plugin. I forgot to close a
<div>in myblock.tpl.php.--------------------------
http://www.kzeng.info
I'd also recommend trying
I'd also recommend trying the "views module"...it's really great for building blocks that require any queries, it does (almost) all for you, and what's great is for every block (or page) you define through this module, it also generates the code and template for you.
So what you end up is a specific template for each of these blocks - in general, it could mean less fiddling with css classes, and is less fragile too.