Branching off from my question about Using Macros inside of Macros, I’m having a bit of trouble with selecting specific <p>
elements used within my <details>
elements.
Here is a snippet of code, enough to show what I’m attempting to do (though unsucessfully.) Throwing it in a blank TiddlyWiki will give a good demo of what I’m aiming to do, sort of.
<style>
details.jmh-details {
margin-bottom: 0px;
}
details.jmh-details > summary {
background: <<color table-header-background>>;
border: solid 1px <<color table-border>>;
font-size: 1.25em;
font-weight: 600;
padding: 2px 0px 4px 4px;
margin-bottom: -1px;
}
details.jmh-details p ~ p :not(details) > p {
padding: 8px 10px;
}
details.jmh-details p {
margin-top: 0px;
margin-bottom: 0px;
}
.jmh-details p ol, .jmh-details p ul {
padding-inline-start: 24px;
}
.jmh-details p table {
width: 100%;
padding-top: 50px;
margin-top: 0px;
margin-bottom: -2px;
}
</style>
<details class="jmh-details" open>
<summary>
1
</summary>
<p>
| Placeholder | Placeholder |
| Placeholder | Placeholder |
</p>
</details>
<details class="jmh-details" open>
<summary>
2
</summary>
<p>
Text That should be padded, but is not.
<details class="jmh-details" open>
<summary>
2A
</summary>
<p>
Text That should also be padded, and is padded?
</p>
</details>
Text that should be padded, but also is not.
</p>
</details>
My goal is to apply padding to the text inside of <p>
elements, but to not apply that padding to other elements inside of it, such as <table>
s or other <details>
elements placed inside of it.
So far, I’ve only managed to select one <p>
element nested inside other elements, but I’m unable to apply the padding to other <p>
elements as well.
Any help is greatly appreciated, I think I’ve been messing with this for so long I’m missing something simple.