Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

CSS woes

Ive been working on couple of games for some time now, and of course I run into my age-old nemesis, namely CSS problems :)

I'm trying to come up with css file that I could include into published file, to make every game into same kind of design but no luck so far - of course if I edit published file and then make a new version, all changes need to be re-applied, that way I've been trying to separate main CSS from published file and replace style with including external CSS (which is from the original code) and alas, no luck. Output goes completely messy so it's not the way to go.

The question is, am I going into this from wrong direction or... how can I accomplish what I'm trying to do? I'm not familiar if I can use external CSS to replace original, for example .passage design, the same way you can replace for example in PHP internal functions with your own.

Hmm.. bit messy story, but hopefully the idea comes clear - sometimes it's bit challenging to try to get thoughts into written form when working with non-native language :)



  • You can do this by using the CSS @import rule.

    1. Create the file(s) that will contain all the CSS common to your projects.
    You will need to store the CSS file(s) somewhere that can be found by the Twine 2 GUI, I suggest creating a css sub-directory/folder below the directory/folder you installed Twine 2 into.

    2. Add a @import rule to your story's Stylesheet, it will look something like the following:

    @import url('css/common.css');
    3. Remember to include a copy of your css sub-directory/folder and the CSS file(s) within it with the HTML file you create using the "Publish to File" feature.
  • Hmmm.. thanks for the tip, however this lead into new dilemma - when testing with regular browser things works, but I tried to create Windows native app from the source things stopped working again, like VS does not like include statement... oh well, back to digging documentation :)
  • You didn't say anything in your original post about converting the generated HTML file into a native app.

    Have you tried loading your external css file using javascript? Searching for "Dynamically loading an external CSS file" may help.
  • The problem is two-folded, native HTML app and windows app - as I mentioned things work now in browser, but I'll have to dig more into VS docus to solve windows side problem :) I'm not that fluent with JS yet, so I have to go by experimenting, just to learn things fast.
  • Which version of Visual Studio are you using?

    Which Visual Studio addon/feature are you using to convert the HTML file into an app?

    Which type of app (mobile or decktop) are you trying to create?
Sign In or Register to comment.