This is what I am trying to achieve,
> Variable Length Title: A sentence worth of text that may or may
not wrap depending upon the width of the
container.
This is the text that is not in the
summary tag but still is in the details
tag therefore hidden unless clicked on.
The html looks something like,
<details>
<summary>
<span class="left">Variable Length Title:</span>
<span class="right">
A sentence worth of text that may or may
not wrap depending upon the width of the
container.
</span>
</summary>
<p>
This is the text that is not in the
summary tag but still is in the details
tag therefore hidden unless clicked on.
</p>
</details>
An inelegant solution I can think of is setting a generous width to .left
with display: inline-block;
and left padding for details p
but this still leaves me with the issue of text wrap where wrapped text starts at the beginning of the line.
If possible then I am looking for CSS only solutions.
2
Answers
If you’re allowed to change the HTML a bit, you could do something like this:
<p>
.visibility: hidden;
.<div>
.Okay! you have to be very careful while using details > summary. If you are using large scale application then I would suggest you to use Tabs/Accordion/Collapse.
Here is CSS code:
Here is the updated HTML code: