Sometimes you want to change the style of a short snippet of text. Here’s a quick n’dirty way to do this with links.
1- Create a stylesheet passage (that’s a regular twine passage tagged “stylesheet”). What you want to do is create CSS rules for html <span>
elements which are in Twine passages, and apply them to your chosen bits of text. If you don’t know what a span element is, that’s ok, you don’t need to 🙂
Assuming you want some links to be blurred, and “un-blurred” when the mouse is over them, your declarations could look like this:
.passage span.blurredlink a {
color: transparent;
text-shadow: 0 0 5px #999;
/* This affects passage links */
}
.passage span.blurredlink a:hover {
color: #999999;
text-shadow: 0 0 0px #999;
}
Change “blurredlink” to an appropriate name, and put your CSS code inside the curly brackets.
2- In your passage, put the link you want to style inside a <span>
tag, and give the span tag the CSS class name you defined in your stylesheet passage. Like this:
Hello, I'm a <span class="blurredlink">blurry link</span>.
This can also be used for regular text, not just links, just remove the “a” and “a:hover” from the CSS declaration, like this:
.passage span.neonpink {
color: #E427E8;
}
Here’s a short demo, you can also grab its twine source file (right-click, choose “save as…”). Hopefully this is useful to someone somewhere.
Permalink
Hi, thanks for the tutorial! Very very helpful, but ..may I ask what version of Twine you use? Cause I can’t open it after downloading (I’m using version 2.0.11, Sugarcube, the offline one). Thank you so much! :'(
Permalink
I’m not 100% sure, but it was probably twine version 1.4.something. I’m not sure you can open twine v1 files with twine v2.
If you’re using twine 2.0.11, you can enter the CSS code right into the stylesheet passage (it’s the “edit story stylesheet” option in the bottom left menu). Hope that helped!