0

Tabbox mold="accordion" - Need to have tabs with different colors

asked 2009-04-08 14:06:45 +0800

Emanuele gravatar image Emanuele
117 1

I'm facing the following problem and unfortunately it's not the first time when I need to change style of complex component.... :-((

I have a tabbox with mold="accordion" and I want different tabs having their text in different color, for example the first one yellow and the second one red.

This is an example:

<zk>

<style>
	.yellowtb-accordion-text{ 
		color:yellow;
		font-size:11pt; 
	}	

	.redtb-accordion-text{ 
		color:red;
		font-size:11pt; 
	}	
</style>

<tabbox mold="accordion">
	<tabs>
		<tab label="First one" sclass="yellowtb"></tab>
		<tab label="Second one" sclass="redtb"></tab>
	</tabs>
	<tabpanels>
		<tabpanel>
			Hello
		</tabpanel>
		<tabpanel>
			Hello
		</tabpanel>
	</tabpanels>
</tabbox>

</zk>


Where is the mistake?

delete flag offensive retag edit

5 Replies

Sort by ยป oldest newest

answered 2009-04-08 14:59:54 +0800

Emanuele gravatar image Emanuele
117 1

updated 2009-04-08 15:01:49 +0800

Probably I have done a mistake, because I think the sclass attribute should be specified as sclass="yellowtb-accordion-text" and sclass="redtb-accordion-text" (not only the prefix). However, also in this case the HTML source generated by ZK engine is the following (not what I'd expect)... so, this is NOT THE SOLUTION...

...
    <div id="z_7u_4" class="yellowtb-accordion-text z-tab-accordion z-tab-accordion-seld" z.zcls="z-tab-accordion" z.sel="true" z.box="z_7u_2" z.panel="z_7u_7" z.disabled="false" z.type="zul.tab2.Tab2">
      <div align="left" class="z-tab-accordion-header">
        <a href="javascript:;" id="z_7u_4!a" class="z-tab-accordion-tl">
          <em class="z-tab-accordion-tr">
            <span class="z-tab-accordion-tm">
              <span class="z-tab-accordion-text">First one</span>
            </span>
          </em>
        </a>
      </div>
    </div>
...


As you can see, the inner span element specifies again class="z-tab-accordion-text", so the class I specified in ZUL file (sclass="yellowtb-accordion-text") has been ignored in this inner level. Is it a lack of ZK? Any solutions?

Emanuele

link publish delete flag offensive edit

answered 2009-04-10 04:33:38 +0800

kindalu gravatar image kindalu
255

try this, the problem is the weighting of CSS Selector.(".yellowtb span" has more weighting)
After knowing the structure of html by using firebug(a firefox plugin),
then I know to add a "span" after sclass name.

<zk>

<style>
	.yellowtb span{ 
		color:yellow;
		font-size:11pt; 
	}	

	.redtb span{ 
		color:red;
		font-size:11pt; 
	}	
</style>

<tabbox mold="accordion">
	<tabs>
		<tab label="First one" sclass="yellowtb"></tab>
		<tab label="Second one" sclass="redtb"></tab>
	</tabs>
	<tabpanels>
		<tabpanel>
			Hello
		</tabpanel>
		<tabpanel>
			Hello
		</tabpanel>
	</tabpanels>
</tabbox>

</zk>

link publish delete flag offensive edit

answered 2009-04-10 08:19:08 +0800

Emanuele gravatar image Emanuele
117 1

Great! It works!! Thanks a lot!! :-)

link publish delete flag offensive edit

answered 2009-04-14 12:46:26 +0800

Naresh gravatar image Naresh
75

Hi,
In the same way can we change the color of the tab also (i.e., light blue to some other color) ? using with and without css file.

Thanks in Advance,
Naresh.

link publish delete flag offensive edit

answered 2009-04-15 00:43:18 +0800

kindalu gravatar image kindalu
255

For changing more component styles...
Take a look at style guide http://docs.zkoss.org/wiki/StyleGuide_Tabbox

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2009-04-08 14:06:45 +0800

Seen: 550 times

Last updated: Apr 15 '09

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More