CSS类定义不适用于< g:HTML>元件 [英] CSS class definition doesn't work inside <g:HTML> element

查看:109
本文介绍了CSS类定义不适用于< g:HTML>元件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你能告诉我为什么css类定义在下面的例子中不起作用吗?



我使用GWT 2.4 + Chrome 17。

 < ui:UiBinder xmlns:ui ='urn:ui:com.google.gwt.uibinder'
xmlns:g ='瓮:导入:com.google.gwt.user.client.ui'>
< ui:style>
div.test {
color:red;
}
< / ui:style>
< div class =test>我应该是红色的,但我不是< / div>
< / g:HTML>
< / ui:UiBinder>


解决方案

test GKYSKJX (或者),<< ui:style>

更新您的div至此:

 < ; div class ={style.test}>现在我是红色的:)< / div> 

或者,你可以选择强制你的样式不要模糊处理:

  @external .test; 
div.test {
color:red;
}

除非您有充足的理由,否则我建议坚持使用第一种方法。 / p>

请访问使用UiBinder声明式布局 - Hello Stylish World


Could you guys tell me why css class definition doesn't work in following example ?

I'm using GWT 2.4 + Chrome 17.

<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
             xmlns:g='urn:import:com.google.gwt.user.client.ui'>
    <ui:style>
        div.test {
            color: red;
        }
    </ui:style>
    <g:HTML>
        <div class="test">I should be red but I'm not</div>
    </g:HTML>
</ui:UiBinder>

解决方案

CSS classes listed in the <ui:style> will be obfuscated, going from test to GKYSKJX (or something similar).

Update your div to this:

<div class="{style.test}">Now I'm red :)</div>

Alternatively, you could choose to force your style to NOT obfuscate by doing this:

@external .test;
div.test {
    color: red;
}

Unless you have a good reason, I recommend sticking with the first method.

See more at Declarative Layout with UiBinder - Hello Stylish World.

这篇关于CSS类定义不适用于&lt; g:HTML&gt;元件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆