如何在 UIBinder 中应用一个文件中的 css?
我正在使用 gwt 2.3 UIbinder。在 UIbinder 中,将 css 内联应用到 gwt 控件。这是我的 UIBinderWidget.ui.xml 文件。
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
。重要的 { 字体粗细:粗体; } 。网格 { 边框:1px实线#BBBBBB; 高度:自动; 内边距:3px; }
<g:>
<g:HTMLPanel>
Label,
<g:Button styleName="{style.important}" ui:field="button" />
<g:TextBox ui:field="text1" width="15em" />
<g:Grid ui:field="grid1" styleName="{style.grid}">
<g:row>
<g:customCell>
<g:TextBox ui:field="text2" width="15em" />
</g:customCell>
<g:customCell>
<g:TextBox ui:field="text3" width="15em" />
</g:customCell>
</g:row>
<g:row>
<g:customCell>
<g:Button ui:field="buttonA">Button A</g:Button>
</g:customCell>
<g:customCell>
<g:Button ui:field="buttonB">Button B</g:Button>
</g:customCell>
</g:row>
<g:row>
<g:customCell>
<g:Button ui:field="addNewRow">Add New Row</g:Button>
</g:customCell>
</g:row>
</g:Grid>
</g:HTMLPanel>
现在,在此 xml 文件中,应用到 gwt 控件的 css 已在上面声明。 我想知道有什么方法可以将所有 css 放入一个文件中,并且我只能从该 css 文件应用 css 吗?
我不想在每个 ui.xml 中编写 css,而是只想从一个文件应用。 (如 style.css) 提前致谢。
I am working with gwt 2.3 UIbinder.In UIbider one apply css inline to gwt controls.Here is my UIBinderWidget.ui.xml file.
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
.important {
font-weight: bold;
}
.grid
{
border: 1px solid #BBBBBB;
height: auto;
padding: 3px;
}
<g:>
<g:HTMLPanel>
Label,
<g:Button styleName="{style.important}" ui:field="button" />
<g:TextBox ui:field="text1" width="15em" />
<g:Grid ui:field="grid1" styleName="{style.grid}">
<g:row>
<g:customCell>
<g:TextBox ui:field="text2" width="15em" />
</g:customCell>
<g:customCell>
<g:TextBox ui:field="text3" width="15em" />
</g:customCell>
</g:row>
<g:row>
<g:customCell>
<g:Button ui:field="buttonA">Button A</g:Button>
</g:customCell>
<g:customCell>
<g:Button ui:field="buttonB">Button B</g:Button>
</g:customCell>
</g:row>
<g:row>
<g:customCell>
<g:Button ui:field="addNewRow">Add New Row</g:Button>
</g:customCell>
</g:row>
</g:Grid>
</g:HTMLPanel>
Now in this xml file css which is applied to the gwt controls are in declared above.
I want to know it there any way to put all the css in only one file and I am able to apply css from that once css file only?
Instead of writing css in every ui.xml I want to apply from only one file. (Like style.css)
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以像这样声明
ui:style
:但总的来说,我认为将 HTML 与 CSS 一起保留是一个很好的做法。
You can declare the
ui:style
like:But in general, I think that is a good practice to keep the HTML with the CSS altogether.