JavaFX and CSS: Prevent CSS inheritence for inner TabPane











up vote
1
down vote

favorite












I would like to have two styles for TabPanes in my application. For that reason, I written these CSS selectors:



.tab-pane > .tab-header-area > .tab-header-background (...)
.tab-pane:focused > .tab-header-area > .headers-region > .tab:selected .focus-indicator (...)
.tab-pane > .tab-content-area(...)
.tab (...)
.tab .tab-label (...)
.tab:selected (...)
.tab:hover (...)
.tab:selected .tab-label (...)
.tab:hover .tab-label (...)
.tab:hover (...)


In addition, I introduced a new .main-tab-pane class that defined my second style. For that one I have the following selectors:



.main-tab-pane > .tab-header-area (...)
.main-tab-pane > .tab-header-area > .control-buttons-tab (...)
.main-tab-pane > .tab-header-area > .tab-header-background  (...)
.main-tab-pane > .tab  (...)
.main-tab-pane > .tab > .tab-label (...)
.main-tab-pane > .tab:selected  (...)
.main-tab-pane > .tab:hover  (...)
.main-tab-pane > .tab:selected > .tab-label (...)
.main-tab-pane > .tab:hover  (...)


 



I have a "main" TabPane, where styleClass="main-tab-pane". Inside this TabPane I have a "normal" one.



The result, however, is not the one I expected: the first TabPane gets the style corresponding to .tab-pane > .tab-header-area > .tab-header-background and the second one the one corresponding to .main-tab-pane > .tab-header-area > .tab-header-background  (...).



However, all the tabs get the behavior of .main-tab-pane > .tab * (...)! In other words, .main-tab-pane > .tab overrides .tab.



My question is: how could I keep these two styles separate from each other, specially regarding the style of the tabs? I would prefer it if the answers involved FXML or CSS solutions, but Java code is also welcome.










share|improve this question
























  • The second TabPane is placed inside of the "main" TabPane, am I correct? Otherwise it is not possible, so guess I.
    – DVarga
    May 4 '17 at 9:13












  • Yes, that is the case.
    – Sergio Andrés Figueroa Santos
    May 4 '17 at 9:18















up vote
1
down vote

favorite












I would like to have two styles for TabPanes in my application. For that reason, I written these CSS selectors:



.tab-pane > .tab-header-area > .tab-header-background (...)
.tab-pane:focused > .tab-header-area > .headers-region > .tab:selected .focus-indicator (...)
.tab-pane > .tab-content-area(...)
.tab (...)
.tab .tab-label (...)
.tab:selected (...)
.tab:hover (...)
.tab:selected .tab-label (...)
.tab:hover .tab-label (...)
.tab:hover (...)


In addition, I introduced a new .main-tab-pane class that defined my second style. For that one I have the following selectors:



.main-tab-pane > .tab-header-area (...)
.main-tab-pane > .tab-header-area > .control-buttons-tab (...)
.main-tab-pane > .tab-header-area > .tab-header-background  (...)
.main-tab-pane > .tab  (...)
.main-tab-pane > .tab > .tab-label (...)
.main-tab-pane > .tab:selected  (...)
.main-tab-pane > .tab:hover  (...)
.main-tab-pane > .tab:selected > .tab-label (...)
.main-tab-pane > .tab:hover  (...)


 



I have a "main" TabPane, where styleClass="main-tab-pane". Inside this TabPane I have a "normal" one.



The result, however, is not the one I expected: the first TabPane gets the style corresponding to .tab-pane > .tab-header-area > .tab-header-background and the second one the one corresponding to .main-tab-pane > .tab-header-area > .tab-header-background  (...).



However, all the tabs get the behavior of .main-tab-pane > .tab * (...)! In other words, .main-tab-pane > .tab overrides .tab.



My question is: how could I keep these two styles separate from each other, specially regarding the style of the tabs? I would prefer it if the answers involved FXML or CSS solutions, but Java code is also welcome.










share|improve this question
























  • The second TabPane is placed inside of the "main" TabPane, am I correct? Otherwise it is not possible, so guess I.
    – DVarga
    May 4 '17 at 9:13












  • Yes, that is the case.
    – Sergio Andrés Figueroa Santos
    May 4 '17 at 9:18













up vote
1
down vote

favorite









up vote
1
down vote

favorite











I would like to have two styles for TabPanes in my application. For that reason, I written these CSS selectors:



.tab-pane > .tab-header-area > .tab-header-background (...)
.tab-pane:focused > .tab-header-area > .headers-region > .tab:selected .focus-indicator (...)
.tab-pane > .tab-content-area(...)
.tab (...)
.tab .tab-label (...)
.tab:selected (...)
.tab:hover (...)
.tab:selected .tab-label (...)
.tab:hover .tab-label (...)
.tab:hover (...)


In addition, I introduced a new .main-tab-pane class that defined my second style. For that one I have the following selectors:



.main-tab-pane > .tab-header-area (...)
.main-tab-pane > .tab-header-area > .control-buttons-tab (...)
.main-tab-pane > .tab-header-area > .tab-header-background  (...)
.main-tab-pane > .tab  (...)
.main-tab-pane > .tab > .tab-label (...)
.main-tab-pane > .tab:selected  (...)
.main-tab-pane > .tab:hover  (...)
.main-tab-pane > .tab:selected > .tab-label (...)
.main-tab-pane > .tab:hover  (...)


 



I have a "main" TabPane, where styleClass="main-tab-pane". Inside this TabPane I have a "normal" one.



The result, however, is not the one I expected: the first TabPane gets the style corresponding to .tab-pane > .tab-header-area > .tab-header-background and the second one the one corresponding to .main-tab-pane > .tab-header-area > .tab-header-background  (...).



However, all the tabs get the behavior of .main-tab-pane > .tab * (...)! In other words, .main-tab-pane > .tab overrides .tab.



My question is: how could I keep these two styles separate from each other, specially regarding the style of the tabs? I would prefer it if the answers involved FXML or CSS solutions, but Java code is also welcome.










share|improve this question















I would like to have two styles for TabPanes in my application. For that reason, I written these CSS selectors:



.tab-pane > .tab-header-area > .tab-header-background (...)
.tab-pane:focused > .tab-header-area > .headers-region > .tab:selected .focus-indicator (...)
.tab-pane > .tab-content-area(...)
.tab (...)
.tab .tab-label (...)
.tab:selected (...)
.tab:hover (...)
.tab:selected .tab-label (...)
.tab:hover .tab-label (...)
.tab:hover (...)


In addition, I introduced a new .main-tab-pane class that defined my second style. For that one I have the following selectors:



.main-tab-pane > .tab-header-area (...)
.main-tab-pane > .tab-header-area > .control-buttons-tab (...)
.main-tab-pane > .tab-header-area > .tab-header-background  (...)
.main-tab-pane > .tab  (...)
.main-tab-pane > .tab > .tab-label (...)
.main-tab-pane > .tab:selected  (...)
.main-tab-pane > .tab:hover  (...)
.main-tab-pane > .tab:selected > .tab-label (...)
.main-tab-pane > .tab:hover  (...)


 



I have a "main" TabPane, where styleClass="main-tab-pane". Inside this TabPane I have a "normal" one.



The result, however, is not the one I expected: the first TabPane gets the style corresponding to .tab-pane > .tab-header-area > .tab-header-background and the second one the one corresponding to .main-tab-pane > .tab-header-area > .tab-header-background  (...).



However, all the tabs get the behavior of .main-tab-pane > .tab * (...)! In other words, .main-tab-pane > .tab overrides .tab.



My question is: how could I keep these two styles separate from each other, specially regarding the style of the tabs? I would prefer it if the answers involved FXML or CSS solutions, but Java code is also welcome.







java css javafx fxml






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 11 at 3:44









Cœur

17k9102140




17k9102140










asked May 4 '17 at 8:43









Sergio Andrés Figueroa Santos

1616




1616












  • The second TabPane is placed inside of the "main" TabPane, am I correct? Otherwise it is not possible, so guess I.
    – DVarga
    May 4 '17 at 9:13












  • Yes, that is the case.
    – Sergio Andrés Figueroa Santos
    May 4 '17 at 9:18


















  • The second TabPane is placed inside of the "main" TabPane, am I correct? Otherwise it is not possible, so guess I.
    – DVarga
    May 4 '17 at 9:13












  • Yes, that is the case.
    – Sergio Andrés Figueroa Santos
    May 4 '17 at 9:18
















The second TabPane is placed inside of the "main" TabPane, am I correct? Otherwise it is not possible, so guess I.
– DVarga
May 4 '17 at 9:13






The second TabPane is placed inside of the "main" TabPane, am I correct? Otherwise it is not possible, so guess I.
– DVarga
May 4 '17 at 9:13














Yes, that is the case.
– Sergio Andrés Figueroa Santos
May 4 '17 at 9:18




Yes, that is the case.
– Sergio Andrés Figueroa Santos
May 4 '17 at 9:18












2 Answers
2






active

oldest

votes

















up vote
1
down vote



accepted










The problem can be solved by the proper usage of the > (direct children) operator, and by following the css structure of the TabPane defined in modena.css (TabPane section):



// For tabs in general
.tab { -fx-background-color: red; }
.tab .tab-label { -fx-text-fill: yellow;}
.tab:hover { -fx-background-color: cyan; }

// Only for the main tab-pane
.main-tab-pane > .tab-header-area > .headers-region > .tab {
-fx-background-color: blue;
}

.main-tab-pane > .tab-header-area > .headers-region > .tab:hover {
-fx-background-color: green;
}

.main-tab-pane > .tab-header-area > .headers-region > .tab > .tab-container > .tab-label{
-fx-text-fill: white;
}


These selectors define the generic style for every Tab and the special style for the Tabs that are direct children of TabPanes having the main-tab-pane CSS style class. This means, even if you embed an another TabPane inside the "main" one, the specified selectors will not select the embedded one, therefore the CSS styles will be not inherited.



Example



The two TabPanes are created like:



TabPane main = new TabPane();
main.getStyleClass().add("main-tab-pane");
Tab mainTab = new Tab("MainTab");
main.getTabs().add(mainTab);
mainTab.setContent(new TabPane(new Tab("SecondTab")));


And the result: untouched -> main tab hover -> inner tab hover.



enter image description here





Another possibility is, if you dont have to have the first style as a default for all of the TabPanes in you application is to is to create a second style-class that is attached to the inner TabPane:



// Main tab-pane
.main-tab-pane .tab { -fx-background-color: blue; }
.main-tab-pane .tab:hover { -fx-background-color: green; }
.main-tab-pane .tab .tab-label {-fx-text-fill: white; }

// Inner tab-pane
.inner-tab-pane .tab { -fx-background-color: red; }
.inner-tab-pane .tab .tab-label { -fx-text-fill: yellow; }
.inner-tab-pane .tab:hover { -fx-background-color: cyan; }


and create the TabPanes like:



TabPane main = new TabPane();
main.getStyleClass().add("main-tab-pane");
Tab mainTab = new Tab("MainTab");
main.getTabs().add(mainTab);
TabPane secondTab = new TabPane(new Tab("SecondTab"));
secondTab.getStyleClass().add("inner-tab-pane");
mainTab.setContent(secondTab);


For these two TabPanes the result is the same.






share|improve this answer























  • Perfect! That example did the trick. Thanks!
    – Sergio Andrés Figueroa Santos
    May 4 '17 at 10:00


















up vote
1
down vote













As an advice you should use Sass to make it more clear and easier.



For your question it should be like this :



.main-tab-pane .tab {
color: red;
}
.second-tab-pane .tab {
color: blue;
}


Then make sure that your tab element is INSIDE of a 'mainOrSecond'-tab-pane






share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f43777942%2fjavafx-and-css-prevent-css-inheritence-for-inner-tabpane%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote



    accepted










    The problem can be solved by the proper usage of the > (direct children) operator, and by following the css structure of the TabPane defined in modena.css (TabPane section):



    // For tabs in general
    .tab { -fx-background-color: red; }
    .tab .tab-label { -fx-text-fill: yellow;}
    .tab:hover { -fx-background-color: cyan; }

    // Only for the main tab-pane
    .main-tab-pane > .tab-header-area > .headers-region > .tab {
    -fx-background-color: blue;
    }

    .main-tab-pane > .tab-header-area > .headers-region > .tab:hover {
    -fx-background-color: green;
    }

    .main-tab-pane > .tab-header-area > .headers-region > .tab > .tab-container > .tab-label{
    -fx-text-fill: white;
    }


    These selectors define the generic style for every Tab and the special style for the Tabs that are direct children of TabPanes having the main-tab-pane CSS style class. This means, even if you embed an another TabPane inside the "main" one, the specified selectors will not select the embedded one, therefore the CSS styles will be not inherited.



    Example



    The two TabPanes are created like:



    TabPane main = new TabPane();
    main.getStyleClass().add("main-tab-pane");
    Tab mainTab = new Tab("MainTab");
    main.getTabs().add(mainTab);
    mainTab.setContent(new TabPane(new Tab("SecondTab")));


    And the result: untouched -> main tab hover -> inner tab hover.



    enter image description here





    Another possibility is, if you dont have to have the first style as a default for all of the TabPanes in you application is to is to create a second style-class that is attached to the inner TabPane:



    // Main tab-pane
    .main-tab-pane .tab { -fx-background-color: blue; }
    .main-tab-pane .tab:hover { -fx-background-color: green; }
    .main-tab-pane .tab .tab-label {-fx-text-fill: white; }

    // Inner tab-pane
    .inner-tab-pane .tab { -fx-background-color: red; }
    .inner-tab-pane .tab .tab-label { -fx-text-fill: yellow; }
    .inner-tab-pane .tab:hover { -fx-background-color: cyan; }


    and create the TabPanes like:



    TabPane main = new TabPane();
    main.getStyleClass().add("main-tab-pane");
    Tab mainTab = new Tab("MainTab");
    main.getTabs().add(mainTab);
    TabPane secondTab = new TabPane(new Tab("SecondTab"));
    secondTab.getStyleClass().add("inner-tab-pane");
    mainTab.setContent(secondTab);


    For these two TabPanes the result is the same.






    share|improve this answer























    • Perfect! That example did the trick. Thanks!
      – Sergio Andrés Figueroa Santos
      May 4 '17 at 10:00















    up vote
    1
    down vote



    accepted










    The problem can be solved by the proper usage of the > (direct children) operator, and by following the css structure of the TabPane defined in modena.css (TabPane section):



    // For tabs in general
    .tab { -fx-background-color: red; }
    .tab .tab-label { -fx-text-fill: yellow;}
    .tab:hover { -fx-background-color: cyan; }

    // Only for the main tab-pane
    .main-tab-pane > .tab-header-area > .headers-region > .tab {
    -fx-background-color: blue;
    }

    .main-tab-pane > .tab-header-area > .headers-region > .tab:hover {
    -fx-background-color: green;
    }

    .main-tab-pane > .tab-header-area > .headers-region > .tab > .tab-container > .tab-label{
    -fx-text-fill: white;
    }


    These selectors define the generic style for every Tab and the special style for the Tabs that are direct children of TabPanes having the main-tab-pane CSS style class. This means, even if you embed an another TabPane inside the "main" one, the specified selectors will not select the embedded one, therefore the CSS styles will be not inherited.



    Example



    The two TabPanes are created like:



    TabPane main = new TabPane();
    main.getStyleClass().add("main-tab-pane");
    Tab mainTab = new Tab("MainTab");
    main.getTabs().add(mainTab);
    mainTab.setContent(new TabPane(new Tab("SecondTab")));


    And the result: untouched -> main tab hover -> inner tab hover.



    enter image description here





    Another possibility is, if you dont have to have the first style as a default for all of the TabPanes in you application is to is to create a second style-class that is attached to the inner TabPane:



    // Main tab-pane
    .main-tab-pane .tab { -fx-background-color: blue; }
    .main-tab-pane .tab:hover { -fx-background-color: green; }
    .main-tab-pane .tab .tab-label {-fx-text-fill: white; }

    // Inner tab-pane
    .inner-tab-pane .tab { -fx-background-color: red; }
    .inner-tab-pane .tab .tab-label { -fx-text-fill: yellow; }
    .inner-tab-pane .tab:hover { -fx-background-color: cyan; }


    and create the TabPanes like:



    TabPane main = new TabPane();
    main.getStyleClass().add("main-tab-pane");
    Tab mainTab = new Tab("MainTab");
    main.getTabs().add(mainTab);
    TabPane secondTab = new TabPane(new Tab("SecondTab"));
    secondTab.getStyleClass().add("inner-tab-pane");
    mainTab.setContent(secondTab);


    For these two TabPanes the result is the same.






    share|improve this answer























    • Perfect! That example did the trick. Thanks!
      – Sergio Andrés Figueroa Santos
      May 4 '17 at 10:00













    up vote
    1
    down vote



    accepted







    up vote
    1
    down vote



    accepted






    The problem can be solved by the proper usage of the > (direct children) operator, and by following the css structure of the TabPane defined in modena.css (TabPane section):



    // For tabs in general
    .tab { -fx-background-color: red; }
    .tab .tab-label { -fx-text-fill: yellow;}
    .tab:hover { -fx-background-color: cyan; }

    // Only for the main tab-pane
    .main-tab-pane > .tab-header-area > .headers-region > .tab {
    -fx-background-color: blue;
    }

    .main-tab-pane > .tab-header-area > .headers-region > .tab:hover {
    -fx-background-color: green;
    }

    .main-tab-pane > .tab-header-area > .headers-region > .tab > .tab-container > .tab-label{
    -fx-text-fill: white;
    }


    These selectors define the generic style for every Tab and the special style for the Tabs that are direct children of TabPanes having the main-tab-pane CSS style class. This means, even if you embed an another TabPane inside the "main" one, the specified selectors will not select the embedded one, therefore the CSS styles will be not inherited.



    Example



    The two TabPanes are created like:



    TabPane main = new TabPane();
    main.getStyleClass().add("main-tab-pane");
    Tab mainTab = new Tab("MainTab");
    main.getTabs().add(mainTab);
    mainTab.setContent(new TabPane(new Tab("SecondTab")));


    And the result: untouched -> main tab hover -> inner tab hover.



    enter image description here





    Another possibility is, if you dont have to have the first style as a default for all of the TabPanes in you application is to is to create a second style-class that is attached to the inner TabPane:



    // Main tab-pane
    .main-tab-pane .tab { -fx-background-color: blue; }
    .main-tab-pane .tab:hover { -fx-background-color: green; }
    .main-tab-pane .tab .tab-label {-fx-text-fill: white; }

    // Inner tab-pane
    .inner-tab-pane .tab { -fx-background-color: red; }
    .inner-tab-pane .tab .tab-label { -fx-text-fill: yellow; }
    .inner-tab-pane .tab:hover { -fx-background-color: cyan; }


    and create the TabPanes like:



    TabPane main = new TabPane();
    main.getStyleClass().add("main-tab-pane");
    Tab mainTab = new Tab("MainTab");
    main.getTabs().add(mainTab);
    TabPane secondTab = new TabPane(new Tab("SecondTab"));
    secondTab.getStyleClass().add("inner-tab-pane");
    mainTab.setContent(secondTab);


    For these two TabPanes the result is the same.






    share|improve this answer














    The problem can be solved by the proper usage of the > (direct children) operator, and by following the css structure of the TabPane defined in modena.css (TabPane section):



    // For tabs in general
    .tab { -fx-background-color: red; }
    .tab .tab-label { -fx-text-fill: yellow;}
    .tab:hover { -fx-background-color: cyan; }

    // Only for the main tab-pane
    .main-tab-pane > .tab-header-area > .headers-region > .tab {
    -fx-background-color: blue;
    }

    .main-tab-pane > .tab-header-area > .headers-region > .tab:hover {
    -fx-background-color: green;
    }

    .main-tab-pane > .tab-header-area > .headers-region > .tab > .tab-container > .tab-label{
    -fx-text-fill: white;
    }


    These selectors define the generic style for every Tab and the special style for the Tabs that are direct children of TabPanes having the main-tab-pane CSS style class. This means, even if you embed an another TabPane inside the "main" one, the specified selectors will not select the embedded one, therefore the CSS styles will be not inherited.



    Example



    The two TabPanes are created like:



    TabPane main = new TabPane();
    main.getStyleClass().add("main-tab-pane");
    Tab mainTab = new Tab("MainTab");
    main.getTabs().add(mainTab);
    mainTab.setContent(new TabPane(new Tab("SecondTab")));


    And the result: untouched -> main tab hover -> inner tab hover.



    enter image description here





    Another possibility is, if you dont have to have the first style as a default for all of the TabPanes in you application is to is to create a second style-class that is attached to the inner TabPane:



    // Main tab-pane
    .main-tab-pane .tab { -fx-background-color: blue; }
    .main-tab-pane .tab:hover { -fx-background-color: green; }
    .main-tab-pane .tab .tab-label {-fx-text-fill: white; }

    // Inner tab-pane
    .inner-tab-pane .tab { -fx-background-color: red; }
    .inner-tab-pane .tab .tab-label { -fx-text-fill: yellow; }
    .inner-tab-pane .tab:hover { -fx-background-color: cyan; }


    and create the TabPanes like:



    TabPane main = new TabPane();
    main.getStyleClass().add("main-tab-pane");
    Tab mainTab = new Tab("MainTab");
    main.getTabs().add(mainTab);
    TabPane secondTab = new TabPane(new Tab("SecondTab"));
    secondTab.getStyleClass().add("inner-tab-pane");
    mainTab.setContent(secondTab);


    For these two TabPanes the result is the same.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited May 4 '17 at 10:03

























    answered May 4 '17 at 9:27









    DVarga

    14.4k33847




    14.4k33847












    • Perfect! That example did the trick. Thanks!
      – Sergio Andrés Figueroa Santos
      May 4 '17 at 10:00


















    • Perfect! That example did the trick. Thanks!
      – Sergio Andrés Figueroa Santos
      May 4 '17 at 10:00
















    Perfect! That example did the trick. Thanks!
    – Sergio Andrés Figueroa Santos
    May 4 '17 at 10:00




    Perfect! That example did the trick. Thanks!
    – Sergio Andrés Figueroa Santos
    May 4 '17 at 10:00












    up vote
    1
    down vote













    As an advice you should use Sass to make it more clear and easier.



    For your question it should be like this :



    .main-tab-pane .tab {
    color: red;
    }
    .second-tab-pane .tab {
    color: blue;
    }


    Then make sure that your tab element is INSIDE of a 'mainOrSecond'-tab-pane






    share|improve this answer

























      up vote
      1
      down vote













      As an advice you should use Sass to make it more clear and easier.



      For your question it should be like this :



      .main-tab-pane .tab {
      color: red;
      }
      .second-tab-pane .tab {
      color: blue;
      }


      Then make sure that your tab element is INSIDE of a 'mainOrSecond'-tab-pane






      share|improve this answer























        up vote
        1
        down vote










        up vote
        1
        down vote









        As an advice you should use Sass to make it more clear and easier.



        For your question it should be like this :



        .main-tab-pane .tab {
        color: red;
        }
        .second-tab-pane .tab {
        color: blue;
        }


        Then make sure that your tab element is INSIDE of a 'mainOrSecond'-tab-pane






        share|improve this answer












        As an advice you should use Sass to make it more clear and easier.



        For your question it should be like this :



        .main-tab-pane .tab {
        color: red;
        }
        .second-tab-pane .tab {
        color: blue;
        }


        Then make sure that your tab element is INSIDE of a 'mainOrSecond'-tab-pane







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered May 4 '17 at 8:52









        Xavier C.

        307




        307






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f43777942%2fjavafx-and-css-prevent-css-inheritence-for-inner-tabpane%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            List item for chat from Array inside array React Native

            Thiostrepton

            Caerphilly