How do I use the style sheet properly?

0 favourites
  • 8 posts
From the Asset Store
High Low is a casino game using luck and points accumulation.
  • I tried styling some form buttons with css which worked quite nice. Then I found out that I can create a style sheet. The manual says on style sheets: "CSS files have a Purpose property in the Properties Bar. The default is Stylesheet which means Construct will use it as an additional stylesheet for your project. The purpose can also be set to (none) in which case its styles will not automatically be applied".

    That to me sounds like whatever I have in the style sheet should automatically be applied on game start, right? I put this simple code into the style sheet:

     button {
     background-color: #7b38d8;
     border-radius: 10px;
     border: 4px double #cccccc;
     color: #eeeeee;
     }
    

    Which is not applied on game start. Did I miss something?

  • .button, not button.

  • Typing .button did not change anything, sadly - do I have to enter other code as well?

    When I google for css examples, I only get examples for webpages: w3schools.com/html/html_css.asp

    And I am not quite sure which parts I have to transfer to the construct style sheet. If someone could share a working example, that would be great.

  • From what you've said, it should work. It's hard to say more without seeing your project file though.

  • Sorry button without the . was probably correct, as the element itself. Maybe try making the css selector .mybuttonclass and putting mybuttonclass into the class property of the button object in your project?

  • I can't share my original project, but I made an example in which I put the same css code in as before. I am sure I am missing some step(s), but I don't know which. Probably some extra code in the css sheet.

    Ashley The project is here, could you have a look, please?:

    my.hidrive.com/lnk/3cSTCmcd

    Edit: after reading the comments again and seeing this video: youtube.com/watch I get the impression that I can't style form buttons that way but have to program my own buttons in the html object, is that correct?!

  • Look in Chrome's dev tools and you'll see the elements Construct is creating are actually <input type="button"> elements, not <button> elements. So the selector button won't match them. Instead try a selector like input[type="button"].

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • That works, thank you very much!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)