首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Librocket的RSS中使用<tabs>导航(CSS-ish)

在Librocket的RSS中使用<tabs>导航(CSS-ish)
EN

Stack Overflow用户
提问于 2012-08-21 05:58:29
回答 1查看 402关注 0票数 2

我是一个彻头彻尾的RSS/CSS noobie,我在运行这段代码时遇到了一些问题。基本上我想做的是:使用Librocket中的tabset元素创建一个导航栏(用于选项屏幕)。我在维护活动/按下状态(向用户显示哪个选项卡处于活动状态)时遇到问题。我试过使用": focus ",但一旦我点击其他地方,焦点就会丢失。如果我使用": active ",只有当我在对象上按住鼠标按钮时,活动状态才会保持。

不管怎样,下面是RSS代码:

代码语言:javascript
复制
/* 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)代码的摘录:

代码语言:javascript
复制
<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不支持它。提前感谢!

EN

回答 1

Stack Overflow用户

发布于 2015-05-06 10:57:04

在搜索libRocket源代码后,我在ElementTabSet.cpp中找到了以下内容:

代码语言:javascript
复制
if (old_tab)
    old_tab->SetPseudoClass("selected", false);
if (new_tab)
    new_tab->SetPseudoClass("selected", true);

活动选项卡始终应用:selected伪类。因此,您可以按如下方式完成您想要的操作:

代码语言:javascript
复制
/* DOES WORK! */
tabset tab:selected
{
    background-color: #DEADBEEF;
    border: solid;
    border-width: 1px 1px 0 1px;
}
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12045819

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档