Character Vault
Any Concept / Any System
Compendium
Your System Come To Life
Roll20 for Android
Streamlined for your Tablet
Roll20 for iPad
Streamlined for your Tablet

Personal tools

Difference between revisions of "Character Sheet Enhancement"

From Roll20 Wiki

Jump to: navigation, search
(Option 1: Remove sheet- from CSS rules)
(Semantic Elements, update Code Conversion section, reorg. sections)
Line 41: Line 41:
  
 
=How to update sheet to new=
 
=How to update sheet to new=
Here are some instructions of how to update a Legacy sheet to the new CSE environment.  
+
Here are some instructions of how to update a [[Legacy Sheet]] to the new CSE environment.  
===Moving to the new CSE environment===
+
===Using the CSE environment===
As of this writing, sheets on the repository were automatically updated to include in their <code>sheet.json</code> file a new line, <code>"legacy": true</code>.
+
To test CSE using the [[Sheet Sandbox]], you can empty the [[Sheet_Sandbox#Sheet.json_Editor|Sheet.json Editor]], or simply place  <code>{ "legacy": false }</code> there.
  
If you'd like to use the new environment, you can simply delete this line. It is not necessary to set it as false. Also remember to remove the <code>,</code> on the line above the change in the <code>sheet.json</code> to ensure it loads.
+
:::'''Note:''' <code>.json<code>-files use <code>,</code> to separate data pairs/rows, but there is never a <code>,</code> on the last row. See [[sheet.json]] for more.
 +
 
 +
To test CSE using the [[Sheet Editor]], simply uncheck the "Legacy Sheet Sanitation" checkbox.
 +
 
 +
Existing sheets in the {{repo|Roll20/roll20-character-sheets repository}} were automatically updated to include in their [[sheet.json]] the line <code>"legacy": true</code>, and any sheet updated to use CSE should have that changed to <code>"legacy": false</code>.
 +
 
 +
If you use a sheet from the sheet drop-down menu, it will automatically use the correct mode.
  
 
===Removal of the "sheet-" Prepending===
 
===Removal of the "sheet-" Prepending===
The most disruptive issue to moving from Legacy to CSE is that the new CSS sanitizer does not automatically prepend <code>sheet-</code> to classes in the HTML code. This means that it will not recognize such classes if you are using the new CSE environment and you did not explicitly call the class in your html with the prepend.  
+
The most disruptive issue to moving from [[Legacy Sheet]] to CSE, is that the new CSS sanitizer does not automatically prepend <code>sheet-</code> to classes in the HTML code. This means that it will not recognize such classes if you are using the new CSE environment, and you did not explicitly call the class in your html with the prepend.  
  
While this will free up sheet authors to name their classes however they wish, this will break your sheet styling if you were allowing the sanitizer to prepend <code>sheet-</code> in your html. This can lead to two strategies.
+
While this will free up [[Sheet Author|sheet authors]] to name their classes however they wish, and make it so the class-names match both on the HTML & CSS, it will break your sheet styling if you were writing classnames without the <code>sheet-</code> in your html.  
 +
 
 +
This lead to two strategies on how to adjust existing sheets:
  
 
===='''Option 1:''' Remove <code>sheet-</code> from CSS rules====
 
===='''Option 1:''' Remove <code>sheet-</code> from CSS rules====
This is the preferred direction. You are simply going through your CSS and removing <code>.sheet-</code> from your CSS rules so that they naturally match your HTML classes.  
+
This is the preferred direction. You go through the CSS-file, search and remove <code>sheet-</code> from CSS rules targeting the the sheet itself, so that they naturally match your HTML classes.
 +
 
 +
* [[BCS/Rolltemplates|Rolltemplate]] references in the css & html still have to follow the <code>.sheet-rolltemplate-example</code> and the <code><rolltemplate class="sheet-rolltemplate-example"> </rolltemplate></code> format.
 +
* If you're using the [[Designing_Character_Sheet_Layout#Roll20_columns.2Frows|roll20-made rows & columns]] in your sheets, you now need to prefix <code>sheet-</code> to their use in the HTML(likely in the CSS also).
 +
 
 
{| class="wikitable"
 
{| class="wikitable"
 
|+ Example of CSS
 
|+ Example of CSS
Line 76: Line 88:
 
<div class="sheet-character_biography">
 
<div class="sheet-character_biography">
 
</pre>
 
</pre>
Then removing the legacy line likely didn't break your sheet all that badly. You are certainly free to continue including <code>sheet-</code> in your declared classes. The overall goal here is that the classes in your HTML must match the classes in your CSS.
+
Then removing the legacy line likely didn't break your sheet all that badly. You can continue prefixing <code>sheet-</code> when you declared classes, but it becomes extra work. The overall goal here is that the classes in your HTML must match the classes in your CSS.
  
 
===CSS Specificity===
 
===CSS Specificity===
One issue that is currently bugging some sheets is that in addition to removing the <code>sheet-</code> prepend, the sanitizer no longer adds an extra <code>.charsheet</code> selector to CSS rules. This can make some of your CSS rules fail due to being less specific than some of Roll20's default styling than in the previous environment. If you find some styling to basic tags, namely the header tags (h1, h2, h3, etc) and label tags, to be missing, try manually adding in the <code>.charsheet</code> class to your selector.  
+
One issue that is currently bugging some sheets is that in addition to removing the <code>sheet-</code> prepend, the sanitizer no longer adds an extra <code>.charsheet</code> selector to CSS rules. This can make some of your CSS rules fail due to being less specific than some of Roll20's default styling, compared to the previous environment. If you find some styling to basic elements, namely the headline elements (<code><nowiki><h1></nowiki></code>,<code><nowiki><h2></nowiki></code>, <code><nowiki><h3></nowiki></code>, etc) and <code><nowiki><label></nowiki></code> elements, to be missing, try manually adding in the <code>.charsheet</code> class to your selector.  
 
{| class="wikitable"
 
{| class="wikitable"
 
|+ Example of CSS
 
|+ Example of CSS
Line 91: Line 103:
  
 
=CSE Examples=
 
=CSE Examples=
Collection of examples, usercases or links to info of some of the new features. Please expand with code or links to examples/documentation.
+
Collection of examples, user-cases or links to info of some of the new features. Please help expand with code or links to examples/documentation.
 
==ID==
 
==ID==
 
Examples of using the HTML global element [https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id #id].
 
Examples of using the HTML global element [https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id #id].
Line 152: Line 164:
 
<p><a href="#menu">Menu</a></p>
 
<p><a href="#menu">Menu</a></p>
 
<!-- this will move you up to the top of the sheet if it is longer than can be can be fit into view at one time -->
 
<!-- this will move you up to the top of the sheet if it is longer than can be can be fit into view at one time -->
 +
</pre>
 +
 +
===Popup===
 +
code snippet by Roll20 Dev exemplifying how popups can be implemented on CSE sheets.
 +
 +
https://codepen.io/imprakash/pen/GgNMXO
 +
 +
<pre data-language="html" style="overflow:auto;">
 +
<div class="box">
 +
<a class="button" href="#popup1">Let me Pop up</a>
 +
</div>
 +
<div id="popup1" class="overlay">
 +
<div class="popup">
 +
<h2>Here i am</h2>
 +
<a class="close" href="#">&times;</a>
 +
<div class="content">
 +
Thank to pop me out of that button, but now i'm done so you can close this window.
 +
</div>
 +
</div>
 +
</div>
 +
</pre>
 +
 +
<pre data-language="css" style="overflow:auto;">
 +
.box {
 +
  width: 40%;
 +
  margin: 0 auto;
 +
  background: rgba(255,255,255,0.2);
 +
  padding: 35px;
 +
  border: 2px solid #fff;
 +
  border-radius: 20px/50px;
 +
  background-clip: padding-box;
 +
  text-align: center;
 +
}
 +
 +
.button {
 +
  font-size: 1em;
 +
  padding: 10px;
 +
  color: #fff;
 +
  border: 2px solid #06D85F;
 +
  border-radius: 20px/50px;
 +
  text-decoration: none;
 +
  cursor: pointer;
 +
  transition: all 0.3s ease-out;
 +
}
 +
.button:hover {
 +
  background: #06D85F;
 +
}
 +
 +
.overlay {
 +
  position: fixed;
 +
  top: 0;
 +
  bottom: 0;
 +
  left: 0;
 +
  right: 0;
 +
  background: rgba(0, 0, 0, 0.7);
 +
  transition: opacity 500ms;
 +
  visibility: hidden;
 +
  opacity: 0;
 +
}
 +
.overlay:target {
 +
  visibility: visible;
 +
  opacity: 1;
 +
}
 +
 +
.popup {
 +
  margin: 70px auto;
 +
  padding: 20px;
 +
  background: #fff;
 +
  border-radius: 5px;
 +
  width: 30%;
 +
  position: relative;
 +
  transition: all 5s ease-in-out;
 +
}
 +
 +
.popup h2 {
 +
  margin-top: 0;
 +
  color: #333;
 +
  font-family: Tahoma, Arial, sans-serif;
 +
}
 +
.popup .close {
 +
  position: absolute;
 +
  top: 20px;
 +
  right: 30px;
 +
  transition: all 200ms;
 +
  font-size: 30px;
 +
  font-weight: bold;
 +
  text-decoration: none;
 +
  color: #333;
 +
}
 +
.popup .close:hover {
 +
  color: #06D85F;
 +
}
 +
.popup .content {
 +
  max-height: 30%;
 +
  overflow: auto;
 +
}
 
</pre>
 
</pre>
  
Line 191: Line 299:
  
 
==Accessibility==
 
==Accessibility==
Accessibility enhancements: [https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-label_attribute ARIA] and [https://www.w3schools.com/html/html5_semantic_elements.asp semantic HTML] support
+
Accessibility enhancements: [https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-label_attribute ARIA]
  
 
* https://www.w3.org/WAI/fundamentals/accessibility-intro/
 
* https://www.w3.org/WAI/fundamentals/accessibility-intro/
 
* https://developer.mozilla.org/en-US/docs/Web/Accessibility
 
* https://developer.mozilla.org/en-US/docs/Web/Accessibility
 
* https://www.w3schools.com/html/html_accessibility.asp
 
* https://www.w3schools.com/html/html_accessibility.asp
 +
 +
===Semantic Elements===
 +
''"[https://www.w3schools.com/html/html5_semantic_elements.asp Semantic Elements] clearly describes its meaning to both the browser and the developer."''
 +
* [https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Using_HTML_sections_and_outlines Using HTML sections and outlines]
 +
 +
 +
They work identically to <code><nowiki><div></nowiki></code>, but describes what they represent in the code. Using some Semantic Elements can make the code more readable and more easily distinguing what closing element goes where.
 +
 +
Using <code><nowiki><main></nowiki></code> is more simple than <code><nowiki><div class="main"></nowiki></code>.
 +
 +
{{ex}}
 +
<pre data-language="html" style="overflow:auto;white-space:pre-wrap;">
 +
<main>
 +
  <header>
 +
    <label>Character name: <input name="attr_character_name" type="text" value=""></label>
 +
    <label>Background: <input name="attr_background" type="text" value=""></label>
 +
  </header>
 +
  <section>
 +
    <h3>Attributes</h3>
 +
    <label>Strength: <input name="attr_str" type="number" value=""></label>
 +
    <label>Dexterity: <input name="attr_dex" type="number" value=""></label>
 +
    <label>Mind: <input name="attr_mind" type="number" value=""></label>
 +
  </section>
 +
  <section>
 +
    <label>Equipment</label>
 +
    <textarea name="attr_equipment"><textarea>
 +
    <label>Notes</label>
 +
    <textarea name="attr_notes"><textarea>
 +
  </section>
 +
  <footer>
 +
    <span> For any issues with the sheet, post on the Char Sheet forums:(https://app.roll20.net/forum/category/277980), or contact John Doe.</span>
 +
  </footer>
 +
<main>
 +
</pre>
  
 
==Responsive Design==
 
==Responsive Design==
Line 214: Line 356:
  
 
{{repo|Roll20/roll20-character-sheets/blob/93d8a80ff162cd10be8e8fbc9d8799149f7550f5/CortexPrime-Hammerheads/CortexPrime-Hammerhead.css#L481 link}}:
 
{{repo|Roll20/roll20-character-sheets/blob/93d8a80ff162cd10be8e8fbc9d8799149f7550f5/CortexPrime-Hammerheads/CortexPrime-Hammerhead.css#L481 link}}:
<pre pre data-language="css">
+
<pre data-language="css" style="overflow:auto;white-space:pre-wrap;">
 
@media only screen and (max-width: 480px) {
 
@media only screen and (max-width: 480px) {
 
     .sheet-wrapper {
 
     .sheet-wrapper {
Line 306: Line 448:
 
* reduce number of features that requires you to "hover" your mouse over some section. (tooltips are less accessible)
 
* reduce number of features that requires you to "hover" your mouse over some section. (tooltips are less accessible)
  
==Popup==
 
code snippet by Roll20 Dev exemplifying how popups can be implemented on CSE sheets.
 
  
https://codepen.io/imprakash/pen/GgNMXO
 
 
<pre data-language="html" style="overflow:auto;">
 
<div class="box">
 
<a class="button" href="#popup1">Let me Pop up</a>
 
</div>
 
<div id="popup1" class="overlay">
 
<div class="popup">
 
<h2>Here i am</h2>
 
<a class="close" href="#">&times;</a>
 
<div class="content">
 
Thank to pop me out of that button, but now i'm done so you can close this window.
 
</div>
 
</div>
 
</div>
 
</pre>
 
 
<pre data-language="css" style="overflow:auto;">
 
.box {
 
  width: 40%;
 
  margin: 0 auto;
 
  background: rgba(255,255,255,0.2);
 
  padding: 35px;
 
  border: 2px solid #fff;
 
  border-radius: 20px/50px;
 
  background-clip: padding-box;
 
  text-align: center;
 
}
 
 
.button {
 
  font-size: 1em;
 
  padding: 10px;
 
  color: #fff;
 
  border: 2px solid #06D85F;
 
  border-radius: 20px/50px;
 
  text-decoration: none;
 
  cursor: pointer;
 
  transition: all 0.3s ease-out;
 
}
 
.button:hover {
 
  background: #06D85F;
 
}
 
 
.overlay {
 
  position: fixed;
 
  top: 0;
 
  bottom: 0;
 
  left: 0;
 
  right: 0;
 
  background: rgba(0, 0, 0, 0.7);
 
  transition: opacity 500ms;
 
  visibility: hidden;
 
  opacity: 0;
 
}
 
.overlay:target {
 
  visibility: visible;
 
  opacity: 1;
 
}
 
 
.popup {
 
  margin: 70px auto;
 
  padding: 20px;
 
  background: #fff;
 
  border-radius: 5px;
 
  width: 30%;
 
  position: relative;
 
  transition: all 5s ease-in-out;
 
}
 
 
.popup h2 {
 
  margin-top: 0;
 
  color: #333;
 
  font-family: Tahoma, Arial, sans-serif;
 
}
 
.popup .close {
 
  position: absolute;
 
  top: 20px;
 
  right: 30px;
 
  transition: all 200ms;
 
  font-size: 30px;
 
  font-weight: bold;
 
  text-decoration: none;
 
  color: #333;
 
}
 
.popup .close:hover {
 
  color: #06D85F;
 
}
 
.popup .content {
 
  max-height: 30%;
 
  overflow: auto;
 
}
 
 
@media screen and (max-width: 700px){
 
  .box{
 
    width: 70%;
 
  }
 
  .popup{
 
    width: 70%;
 
  }
 
}
 
</pre>
 
  
==Make sheet Print-Friendly==
+
===Make sheet Print-Friendly===
 
The CSS sanitation upgrade makes it now possible to use <code>@media print</code> media query to style character sheets for printing from the popout window- – {{forum|post/1242365/print-character-sheets Original suggestion thread}}
 
The CSS sanitation upgrade makes it now possible to use <code>@media print</code> media query to style character sheets for printing from the popout window- – {{forum|post/1242365/print-character-sheets Original suggestion thread}}
  

Revision as of 18:23, 6 May 2021

Character Sheet Creation
Getting Started


Reference


Tools & Tips


Git/GitHub GitHubLogo.png


Other

Main Page: Building Character Sheets


Character Sheet Enhancement (or CSE for short) is an update to character sheets and how they are made, enabling many new features, and removing some existing restrictions sheet creators have had to deal with. See Legacy Sheet(LCS) for info on the older system.


It was available on the Dev Server for testing During February, and fully released on March 9th 2021, then partially(?) rolled back little later due to some problems, and then reisntated by end of March.

Contents

Info

Features

A summary of what updates the sheet system will have.

  • HTML updates:
    • Accessibility enhancements: ARIA and semantic HTML support
    • No pre-pending of sheet- to classes in CSS (apart from roll-templates)
    • Enable use of #id in HTML elements
    • Allowing the usage of HTML datalists
    • Allowing the usage of HTML <details> and <summary>-elements – (part of semantic HTML support)
  • The CSS sanitizer has been removed, which now allows for:
  • Integrated macro bar for character quick attacks, including pop out windows
  • Character Sheet/Stat Block is the default for opening a PC/NPC This is being reverted until we have more research regarding implementation.

Restrictions

CSE has fewer restrictions than Legacy Sheet, but still have a number of them.

CSE Code Restrictions


Issues

See the BCS/Bugs page for info on various bugs/issues people have encountered with making CSE-sheets, trying to convert Legacy Sheet to CSE, or sheet code bugs just in general.

How to update sheet to new

Here are some instructions of how to update a Legacy Sheet to the new CSE environment.

Using the CSE environment

To test CSE using the Sheet Sandbox, you can empty the Sheet.json Editor, or simply place { "legacy": false } there.

Note: .json<code>-files use <code>, to separate data pairs/rows, but there is never a , on the last row. See sheet.json for more.

To test CSE using the Sheet Editor, simply uncheck the "Legacy Sheet Sanitation" checkbox.

Existing sheets in the GitHubLogo.png were automatically updated to include in their sheet.json the line "legacy": true, and any sheet updated to use CSE should have that changed to "legacy": false.

If you use a sheet from the sheet drop-down menu, it will automatically use the correct mode.

Removal of the "sheet-" Prepending

The most disruptive issue to moving from Legacy Sheet to CSE, is that the new CSS sanitizer does not automatically prepend sheet- to classes in the HTML code. This means that it will not recognize such classes if you are using the new CSE environment, and you did not explicitly call the class in your html with the prepend.

While this will free up sheet authors to name their classes however they wish, and make it so the class-names match both on the HTML & CSS, it will break your sheet styling if you were writing classnames without the sheet- in your html.

This lead to two strategies on how to adjust existing sheets:

Option 1: Remove sheet- from CSS rules

This is the preferred direction. You go through the CSS-file, search and remove sheet- from CSS rules targeting the the sheet itself, so that they naturally match your HTML classes.

  • Rolltemplate references in the css & html still have to follow the .sheet-rolltemplate-example and the <rolltemplate class="sheet-rolltemplate-example"> </rolltemplate> format.
  • If you're using the roll20-made rows & columns in your sheets, you now need to prefix sheet- to their use in the HTML(likely in the CSS also).
Example of CSS
Old Class New Class
.sheet-character_biography .character_biography

This direction is particularly helpful when your HTML is already using the "natural" name for your classes or if your HTML looks similar to this:

<div class="character_biography">
An Important Exception to this are classes that are styling your Roll Templates. The chat window in games are not part of the CSE environment and are not part of the update so you will still need to follow legacy rules for styling roll templates, like in Option 2.

Option 2: Mimic the legacy sanitizer

If your sheet explicitly calls for classes that include sheet- in the HTML where your HTML looks more like:

<div class="sheet-character_biography">

Then removing the legacy line likely didn't break your sheet all that badly. You can continue prefixing sheet- when you declared classes, but it becomes extra work. The overall goal here is that the classes in your HTML must match the classes in your CSS.

CSS Specificity

One issue that is currently bugging some sheets is that in addition to removing the sheet- prepend, the sanitizer no longer adds an extra .charsheet selector to CSS rules. This can make some of your CSS rules fail due to being less specific than some of Roll20's default styling, compared to the previous environment. If you find some styling to basic elements, namely the headline elements (<h1>,<h2>, <h3>, etc) and <label> elements, to be missing, try manually adding in the .charsheet class to your selector.

Example of CSS
May fail May succeed
h1 {styling;} .charsheet h1 {styling;}

CSE Examples

Collection of examples, user-cases or links to info of some of the new features. Please help expand with code or links to examples/documentation.

ID

Examples of using the HTML global element #id.

An id name cannot start with a number.

id CSS selector

Use an id to select one unique element.

//html
<input type="text" id="character-name" name="attr_character_name" value="" placeholder="Character Name" />

//css
#character-name {
  text-align: center;
  color: red;
}

id Clickable Label text

Create "clickable" label text by using a linked label and input. Linked labels could replace various methods that use hidden checkboxes to simulate clickable text/buttons on a sheet.

//html
<input id="attackMod1" name="attr_attackMod1" type="checkbox" value="1" class="hidden">
<label for="attackMod1" class="link">Apply Modifier</label>
//css
.sheet-hidden {
    display:none;
}
label.link:hover {
  cursor: help;
  text-decoration: underline;
  color: red;
}
input[type="checkbox"]:checked + label.link {
  color: red;
}

id Sheet Anchors

Create links to jump to anchored elements of a sheet. Could be used as a "Navigational Menu/Table of Contents", or simply as clickable text that can quickly move to another section of a sheet.

//html
<h2>Sheet Anchor example</h2>
<h3 id="menu">Menu</h3>
<ul>
    <li><a href="#Attacks">Attacks</a></li>
    <li><a href="#Skills">Skills</a></li>
    <li><a href="#Spells">Spells</a></li>
</ul>
<br>
<!-- add to of content here, so that the sheet scrolls up/down to focus on the linked section -->
<br>
<h3 id="Attacks">Attacks</h3>
<p>"Lorem ipsum"</p>
<h3 id="Skills">Skills</h3>
<p>"Lorem ipsum"</p>
<h3 id="Spells">Spells</h3>
<p>"Lorem ipsum"</p>
<hr>
<p><a href="#menu">Menu</a></p>
<!-- this will move you up to the top of the sheet if it is longer than can be can be fit into view at one time -->

Popup

code snippet by Roll20 Dev exemplifying how popups can be implemented on CSE sheets.

https://codepen.io/imprakash/pen/GgNMXO

<div class="box">
	<a class="button" href="#popup1">Let me Pop up</a>
</div>
<div id="popup1" class="overlay">
	<div class="popup">
		<h2>Here i am</h2>
		<a class="close" href="#">×</a>
		<div class="content">
			Thank to pop me out of that button, but now i'm done so you can close this window.
		</div>
	</div>
</div>
.box {
  width: 40%;
  margin: 0 auto;
  background: rgba(255,255,255,0.2);
  padding: 35px;
  border: 2px solid #fff;
  border-radius: 20px/50px;
  background-clip: padding-box;
  text-align: center;
}

.button {
  font-size: 1em;
  padding: 10px;
  color: #fff;
  border: 2px solid #06D85F;
  border-radius: 20px/50px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.3s ease-out;
}
.button:hover {
  background: #06D85F;
}

.overlay {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.7);
  transition: opacity 500ms;
  visibility: hidden;
  opacity: 0;
}
.overlay:target {
  visibility: visible;
  opacity: 1;
}

.popup {
  margin: 70px auto;
  padding: 20px;
  background: #fff;
  border-radius: 5px;
  width: 30%;
  position: relative;
  transition: all 5s ease-in-out;
}

.popup h2 {
  margin-top: 0;
  color: #333;
  font-family: Tahoma, Arial, sans-serif;
}
.popup .close {
  position: absolute;
  top: 20px;
  right: 30px;
  transition: all 200ms;
  font-size: 30px;
  font-weight: bold;
  text-decoration: none;
  color: #333;
}
.popup .close:hover {
  color: #06D85F;
}
.popup .content {
  max-height: 30%;
  overflow: auto;
}

Datalist

"Datalists are a helpful tool for sheet authors to guide players toward filling out input-fields. Datalists combines the precision of a dropdown-field with the flexibility of an input-field." -Peter B.

<input type="text" list="abilityScores" name="attr_abilityScore">
<datalist id="abilityScores">
    <option value="@{strength}">Strength</option>
    <option value="@{dexterity}">Dexterity</option>
    <option value="@{constitution}">Constitution</option>
    <option value="@{intelligence}">Intelligence</option>
    <option value="@{wisdom}">Wisdom</option>
    <option value="@{charisma}">Charisma</option>
</datalist>

<details>

A more simple way to create a collapsible section on a sheet than the old CSS tricks we have.

You have a <details> where everything is inside, and then the <summary>-element inside it determine what is shown when it's collapsed.

<details>
  <summary>Epcot Center</summary>
  <p>Epcot is a theme park at Walt Disney World Resort featuring exciting attractions, international pavilions, award-winning fireworks and seasonal special events.</p>
</details>


Roll20 applies some default styling that hides the normal open/closed arrow/triangle for <details>. set it to display:inline-items; or display:revert; to make it show again

Accessibility

Accessibility enhancements: ARIA

Semantic Elements

"Semantic Elements clearly describes its meaning to both the browser and the developer."


They work identically to <div>, but describes what they represent in the code. Using some Semantic Elements can make the code more readable and more easily distinguing what closing element goes where.

Using <main> is more simple than <div class="main">.


Example:

<main>
  <header>
     <label>Character name: <input name="attr_character_name" type="text" value=""></label>
     <label>Background: <input name="attr_background" type="text" value=""></label>
  </header>
  <section>
    <h3>Attributes</h3>
    <label>Strength: <input name="attr_str" type="number" value=""></label>
    <label>Dexterity: <input name="attr_dex" type="number" value=""></label>
    <label>Mind: <input name="attr_mind" type="number" value=""></label>
  </section>
  <section>
    <label>Equipment</label>
    <textarea name="attr_equipment"><textarea>
    <label>Notes</label>
    <textarea name="attr_notes"><textarea>
  </section>
  <footer>
    <span> For any issues with the sheet, post on the Char Sheet forums:(https://app.roll20.net/forum/category/277980), or contact John Doe.</span>
  </footer>
<main>

Responsive Design

Aimed at making adjustment for mobile

Mobile

Responsive design leads way to more easily adapting/optimizing Char Sheet for eventual use with the new Mobile-app, which is in Open Beta(as of 18th March 2021).

GitHubLogo.png:
@media only screen and (max-width: 480px) {
    .sheet-wrapper {
        min-width: 320px;
    }
        
    .sheet-traits4 {
        display: grid;
        grid-template-columns: repeat(2, 1fr );
        align-items: start;
    }

    .sheet-traits3 {
        display: grid;
        grid-template-columns: repeat(1, 1fr );
        align-items: start;
    }

    .sheet-traits2 {
        display: grid;
        grid-template-columns: repeat(1, 1fr );
        align-items: start;
    }

    .sheet-traits2 .sheet-traits2 {
        display: grid;
        grid-template-columns: repeat(2, 1fr );
        align-items: start;
    }

    .sheet-traits1 {
        display: grid;
        grid-template-columns: repeat(1, 1fr );
        align-items: start;
    }

/* halo layout */

    .sheet-editPane {
         width: 80%;
     }
    
    input[name="attr_Portrait"][value="PC0"]  {
        border: 1px solid #cccc00;
        text-align: center;
        background-color: rgba(255, 128, 0, 0.05);
    }

    h1.sheet-hide {
        visibility: visible !important;
        display: block;
    }

    input[name="attr_Portrait"]:not([value="PC0"]) ~ .sheet-physical {
        position: static;
        border: 1px dashed #ffcb2b;
        border-top: 6px solid #ffcb2b;
        padding: 5px;
    }

    input[name="attr_Portrait"]:not([value="PC0"]) ~ .sheet-mental {
        position: static;
        border: 1px dashed #ffcb2b;
        border-top: 6px solid #ffcb2b;
        padding: 5px;
    }

    input[name="attr_Portrait"]:not([value="PC0"]) ~ .sheet-social {
        position: static;
        border: 1px dashed #ffcb2b;
        border-top: 6px solid #ffcb2b;
        padding: 5px;
    }
    
    input[name="attr_Portrait"]:not([value="PC0"]) + .sheet-action {
        display: block;
        visibility: visible;
    }
    
    .charsheet button[type="roll"].sheet-blank-roll-button + span {
        display: block !important;
        visibility: visible !important;
    }
}

General Tips:

  • Make roll buttons & input fields larger
  • Uing CSS Grid or Flexbox for the normal sheet layout will make it easier to create a resposive/phone-adapted version of the layout.
    • Like have some stat sections that on the normal sheet is arranged in a 2x3 grid, have on mobile these appear in a 1x6 grid. Can also be a easier first step to adjust
  • reduce number of features that requires you to "hover" your mouse over some section. (tooltips are less accessible)


Make sheet Print-Friendly

The CSS sanitation upgrade makes it now possible to use @media print media query to style character sheets for printing from the popout window- –

It can be a good idea to take a look at any existing paper versions of the char sheet for your system and maybe create a compromise layout that's somewhere between the default Roll20 sheet and the paper version, for familiarity's sake.

List of things that can make sheets printer - friendly:

  • remove all "redundant" images, except logo. (minimize ink use)
  • remove roll buttons
  • force sheet aspect ratio to fit A4
  • set background to white, change text & section borders to be thin and high contrast, with as much being white
  • collapsed info boxes/repeating sections
    • expand all collapsed info sections
    • make print option to show some repeating sections in a "condensed form", such as spellists or inventory, showing each as a one-liner and skipping their detailed description
    • make option to have spell/powers/items appear at separate pages with all their info, like in the form of spellcards.
  • multi-tab sheets
    • if contains mutually excursive sheet-types (like PC/NPC/ships), show only content of the one used
    • skip the Settings tab
  • control number of pages
  • adjust things so sheet info could fit on one or two pages(for a single-sheet printout), or make it a multiple of two.
  • spread out things evenly so there isn't any page with just a tiny bit info
  • advanced idea: create an optional "condensed" print version where all stats are shown as compactly as possible, maybe even on a single page. This "condensed print mode" could be toggled from the settings.

Sheets Using CSE

List of char sheets that have been updated to at least be CS-compliant, but likely also adopted to use some of the new features.

Changelog

  • April 30th - the css @import bug was fixed

See Also