我是一个彻头彻尾的RSS/CSS noobie,我在运行这段代码时遇到了一些问题。基本上我想做的是:使用Librocket中的tabset元素创建一个导航栏(用于选项屏幕)。我在维护活动/按下状态(向用户显示哪个选项卡处于活动状态)时遇到问题。我试过使用": focus ",但一旦我点击其他地方,焦点就会丢失。如果我使用": active ",只有当我在对象上按住鼠标按钮时,活动状态才会保持。
不管怎样,下面是RSS代码:
/* Force the tabset element to a fixed size. */
tabset
{
display: block;
width: 100%;
height: 100%;
border: solid;
}
/* Display the tab container as a block element 20 pixels high; it will
be positioned at the top of the tabset. */
tabset tabs
{
display: block;
height: 20px;
}
/* Force each tab to only take up 80 pixels across the tabs element. */
tabset tab
{
width: 80px;
border: solid;
border-width: 1px 1px 0 1px;
}
/* DOESN'T WORK
tabset tab:focus
{
background-color: #DEADBEEF;
border: solid;
border-width: 1px 1px 0 1px;
}*/
/* DOESN'T WORK
tabset tab:active
{
background-color: #DEADBEEF;
border: solid;
border-width: 1px 1px 0 1px;
}
*/
/* Display the panel container as a block element 180 pixels high; it will
be positioned below the tab container and take up the rest of the space
in the tabset. */
tabset panels
{
display: block;
height: 100%;
border: solid;
}
/* Fix each panel to take up exactly the panelled space. */
tabset panels panel
{
display: block;
width: 100%;
height: 100%;
border: solid;
border-width: 1px 1px 0 1px;
}以及RML (HTML-ish)代码的摘录:
<game id="game">
<tabset style="height: 100%;">
<tab>Gameplay</tab>
<panel>
GAMEPLAY TAB GAMEPLAY TAB GAMEPLAY TAB GAMEPLAY TAB GAMEPLAY TAB <br />
</panel>
<tab>Video</tab>
<panel>
VIDEO TAB VIDEO TAB VIDEO TAB VIDEO TAB VIDEO TAB VIDEO TAB <br />
</panel>
</tabset> 我不能使用任何javascript代码,因为Librocket不支持它。提前感谢!
发布于 2015-05-06 10:57:04
在搜索libRocket源代码后,我在ElementTabSet.cpp中找到了以下内容:
if (old_tab)
old_tab->SetPseudoClass("selected", false);
if (new_tab)
new_tab->SetPseudoClass("selected", true);活动选项卡始终应用:selected伪类。因此,您可以按如下方式完成您想要的操作:
/* DOES WORK! */
tabset tab:selected
{
background-color: #DEADBEEF;
border: solid;
border-width: 1px 1px 0 1px;
}https://stackoverflow.com/questions/12045819
复制相似问题