【问题标题】:CSS class definition doesn't work inside <g:HTML> elementCSS 类定义在 <g:HTML> 元素中不起作用
【发布时间】:2012-02-20 02:30:18
【问题描述】:

你们能告诉我为什么 css 类定义在以下示例中不起作用吗?

我正在使用 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>

【问题讨论】:

    标签: gwt gwt2 uibinder


    【解决方案1】:

    &lt;ui:style&gt; 中列出的 CSS 类将被混淆,从 test 变为 GKYSKJX(或类似的东西)。

    将您的 div 更新为:

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

    或者,您可以选择通过这样做来强制您的样式不混淆:

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

    除非你有充分的理由,否则我建议坚持第一种方法。

    Declarative Layout with UiBinder - Hello Stylish World 上查看更多信息。

    【讨论】:

      猜你喜欢
      • 2023-03-20
      • 2014-09-30
      • 1970-01-01
      • 2016-06-21
      • 1970-01-01
      • 1970-01-01
      • 2022-11-16
      • 2017-07-15
      • 1970-01-01
      相关资源
      最近更新 更多