I strongly suggest using you learn to use your web-browser’s Web Developer Tools to Inspect the HTML elements that your Passage content is generating, it will help you understand what effect your code has on the page’s HTML structure and how to craft CSS selectors that target the elements you want them to. I would also suggest incrementally increasing the styling you’re applying bit by bit so you can Inspect how it’s being applied and to what…
warning: The visual effect associated with Harlowe’s Passage Transition process ignores block based elements like the classed <div>
you’re wrapping the “List of definitions…” text in, which will cause it to be displayed at a different rate that the other Passage content. To overcome this behaviour you need to alter the block based element types you use to be display as inline-block with a width of 100%.
div {
display: inline-block;
width: 100%;
}
Personally I would refrain from using them, and use a Named Hook instead.
If you Inspect the elements of a simple Passage that only contains textual content with not styling applied…
Story blah blah
…you will see it generates a HTML structure like the following…
<tw-story tags="">
<tw-passage tags="">
<tw-sidebar>
<tw-icon tabindex="0" alt="Undo" title="Undo" style="visibility: hidden;">↶</tw-icon>
<tw-icon tabindex="0" alt="Redo" title="Redo" style="visibility: hidden;">↷</tw-icon>
</tw-sidebar>
Story blah blah
</tw-passage>
</tw-story>
And if you alter the Passage content you include a basic variation of your (enchant: ?Passage) macro call…
(enchant: ?passage, (float-box: "=XX=","Y"))
Story blah blah
…you will see the above HTML structure changes to something like the following…
<tw-story tags="">
<tw-enchantment style="display: block; width: 50vw; max-width: 50vw; left: 25vw; box-sizing: content-box; overflow-y: auto; height: 100vh; position: fixed; top: 0vh; padding: 1em; background-color: rgb(0, 0, 0);">
<tw-passage tags="">
<!-- tw-sidebar elements removed to simplify example -->
<tw-expression type="macro" name="enchant" return="command"></tw-expression>
Story blah blah
</tw-passage>
</tw-enchantment>
</tw-story>
…and you will discover that the default structure has been altered to include a element between the element and the element, and this can effect how you craft CSS selectors.
note: you may want to consider using the (change:) macro instead of (enchant:)
, because the late re-applies it’s effect after every dynamic change to the structure of the current page (like when you use a link to display additional content). Where as the format only applies its effect once when the targeted content is first added to the page.
(change: ?Passage,
(float-box: "=XX=","=YYY=") +
(bg: white) +
(color: black) +
(b4r-color: gray) +
(b4r: "solid") +
(b4r-size: 0,4,4,0))
Story blah blah
Now if will add your ‘choices’ structure to the simple Passage example…
(change: ?Passage, (float-box: "=XX=","Y"))\
Story blah blah
|=
==>
[[Choice]]
=|
(link:'Choice 2')[Are you [[Choice 2.1]] or [[Choice 2.2]]?]
|==|
…and Inspect what additional HTML gets generated…
<tw-columns>
<tw-column type="left" style="width:50%; margin-left: 0em; margin-right: 1em;">
<tw-align style="text-align: right;">
<tw-expression type="macro" name="link-goto" return="command">
<tw-link tabindex="0" data-raw="">Choice</tw-link>
</tw-expression>
<br>
</tw-align>
</tw-column>
<tw-column type="right" style="width:50%; margin-left: 1em; margin-right: 0em;">
<tw-expression type="macro" name="link" return="changer"></tw-expression>
<tw-hook>
<tw-link tabindex="0" data-raw="">Choice 2</tw-link>
</tw-hook>
<br>
</tw-column>
</tw-columns>
…we discover when looking at the CSS being applied that the element is displayed using flex, which affects its flow relationship with other elements of the page. One of these being that it’s content now appears “above” (has a higher z-index value) that of other elements like those of your “Show definitions” float-box.
To fix this you need to increase the z-index of the “Show definitions” float-box, like so…
tw-hook[name="definitions"] tw-hook {
background-color: green !important;
z-index: 5;
}
note: I used a value of 5 for no particular reason other than it worked in my test project, you may need to use a different value for your project.