CSS selector not resolved when using UI Binder
Posted
by
Zhaidarbek
on Stack Overflow
See other posts from Stack Overflow
or by Zhaidarbek
Published on 2011-11-25T17:24:48Z
Indexed on
2011/11/26
1:50 UTC
Read the original article
Hit count: 449
Basically, I am building a horizontal navigation bar. I have following markup:
<ui:style src="../common.css" type="client.resources.HomeResources.Style">
@external gwt-Anchor;
.gwt-Anchor {
text-decoration: none;
}
</ui:style>
<g:HTMLPanel styleName="navbar">
<ul>
<li><g:Anchor ></g:Anchor> |</li>
<li><g:Anchor ></g:Anchor> |</li>
<li><g:Anchor ></g:Anchor> |</li>
<li><g:Anchor ></g:Anchor> |</li>
<li><g:Anchor ></g:Anchor> |</li>
<li><g:Anchor ></g:Anchor> |</li>
<li><g:Anchor ></g:Anchor></li>
</ul>
common.css
has following rules:
ul {
margin: 0;
padding: 0;
text-align: left;
font-weight: bold;
line-height: 25px;
}
ul li {
display: inline;
text-align: right;
}
ul li a {
color: #0077C0;
font-size: 12px;
margin-right: 15px;
padding: 4px 0 4px 5px;
text-decoration: none;
}
ul li a:HOVER {
color: #F0721C;
}
When using rules as defined above, everything works perfect. The problem is that I have ul
elements in other parts of page, so I've added div.navbar
before each rule like this:
div.navbar ul{}
div.navbar ul li{}
etc...
But those rules are not applied to ul
elements inside UI Binder template. What's wrong with my code?
Here is the generated HTML (normally on one line):
<div class="navbar"><ul>
<li><a class="gwt-Anchor">Item 1</a> |</li>
<li><a class="gwt-Anchor">Item 2</a> |</li>
<li><a class="gwt-Anchor">Item 3</a></li>
</ul></div>
RESOLVED
styleName="navbar"
must be styleName="{style.navbar}"
© Stack Overflow or respective owner