Css 如何在GWT中设置锚定样式?
如何使用UIBinder为GWT中的锚添加样式?我在UiBinder模板XML中有以下代码:Css 如何在GWT中设置锚定样式?,css,gwt,anchor,Css,Gwt,Anchor,如何使用UIBinder为GWT中的锚添加样式?我在UiBinder模板XML中有以下代码: <g:Anchor ui:field="forgotPassLink">Forgot password?</g:Anchor> 我必须在Anchor上使用BlurEvent和FocusEvent处理程序来处理这个问题吗?如果是这样…那就是样板代码。使用与gwt锚定相同的CSS伪类类: .gwt-Anchor:link {color:#FF0000;} .gwt-Anchor:v
<g:Anchor ui:field="forgotPassLink">Forgot password?</g:Anchor>
我必须在Anchor上使用BlurEvent和FocusEvent处理程序来处理这个问题吗?如果是这样…那就是样板代码。使用与
gwt锚定相同的CSS伪类
类:
.gwt-Anchor:link {color:#FF0000;}
.gwt-Anchor:visited {color:#00FF00;}
.gwt-Anchor:hover {color:#FF00FF;}
.gwt-Anchor:active {color:#0000FF;}
您也可以使用a.gwt-Anchor
,但这并不是绝对必要的。这是否有效(使用UIBinder样式名称)
.a:链接{color:#FF0000;}
.a:访问{颜色:#00FF00;}
.a:悬停{color:#FF00FF;}
.a:活动{color:#000FF;}
忘记密码了?
如果您将uibinder与gwt超链接一起使用,可以这样做:
<ui:style>
.mystyle a:link {
color:#3F3F3F;
text-decoration:none;
}
</ui:style>
<g:FlowPanel>
<g:Hyperlink styleName='{style.mystyle}'/>
</g:FlowPanel>
<ui:style>
.menuItem a:link {color: white;}
.menuItem a:visited {color: white;}
.menuItem a:hover {color: white;}
.menuItem a:active {color: white;}
</ui:style>
<g:Hyperlink styleName="{style.menuItem}" targetHistoryToken="home">Home</g:Hyperlink>
.我的风格a:链接{
颜色:#3f3f;
文字装饰:无;
}
如下定义您的风格:
<ui:style>
.mystyle a:link {
color:#3F3F3F;
text-decoration:none;
}
</ui:style>
<g:FlowPanel>
<g:Hyperlink styleName='{style.mystyle}'/>
</g:FlowPanel>
<ui:style>
.menuItem a:link {color: white;}
.menuItem a:visited {color: white;}
.menuItem a:hover {color: white;}
.menuItem a:active {color: white;}
</ui:style>
<g:Hyperlink styleName="{style.menuItem}" targetHistoryToken="home">Home</g:Hyperlink>
.menuItem a:link{color:white;}
.menuItem a:已访问{颜色:白色;}
.menuItem a:悬停{颜色:白色;}
.menuItem a:活动{颜色:白色;}
然后像这样使用它:
<ui:style>
.mystyle a:link {
color:#3F3F3F;
text-decoration:none;
}
</ui:style>
<g:FlowPanel>
<g:Hyperlink styleName='{style.mystyle}'/>
</g:FlowPanel>
<ui:style>
.menuItem a:link {color: white;}
.menuItem a:visited {color: white;}
.menuItem a:hover {color: white;}
.menuItem a:active {color: white;}
</ui:style>
<g:Hyperlink styleName="{style.menuItem}" targetHistoryToken="home">Home</g:Hyperlink>
主页
别忘了设置锚定
href属性,至少类似于'javascript:;'实际上,IIRC、GWT会为您这样做(当然,除非您通过ctor或其他方式显式设置href
属性)。