HTML Element. Why is my Body class not showing?

0 favourites
  • 4 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • I have a html element with lots of sub containers and classes. When I run it in C3 everything works fine apart from the bottom most (parent) container does not display. In my case this should display just a bright green background with a 20 pixel border.

    All of the child classes display perfectly (buttons, text etc) but for for some reason the background container is nowhere to be seen.

    When I run it as a html preview in the browser the background is visible but when I run via construct 3 it is not visible.

    I tried using a wrapper class around everything as described in the docs but this had no effect. Does anyone know what could be going on?

    Thanks

    Tagged:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • On export my html reads:

    <body class="body-1">
    

    and the style is...

    body.body-1 {
     position: static;
     display: block;
    ..etc
    }
    

    But if I change these to the following it works fine.

    <div class="body-1">
    

    and the style to:

    div.body-1 {
     position: static;
     display: block;
    ..etc
    }
    

    Can anyone explain why and is there a better way to get around this rather than having to change the body tags to div tags every time I export? Thanks

  • Why are you trying to use <body> tags? In HTML a document should only have one body tag, which contains everything in the entire document. You should be using a different tag like <div> anyway.

  • Im actually using an external tool to visually create the css and html. Its perfect for complex html interfaces all but for this little issue that it uses a body tag.

    In an attempt to fix the issue Im trying to automatically rename the tag in C3 at runtime. I can do this fine for the html using the 'set html content' action but there doesn't seem to be a way to edit the .css file via script.

    Is there some javascript that can replace the css class 'body' with a class 'div'?

    Cheers

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