Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Repeating Section issue

1458917257
PadRpg
Sheet Author
API Scripter
Hi, I've got an issue with repeating section in my table. I use div to simulate a table (It's the first time I use div as table in my sheets). When there's no element in the table, it looks ok but when I add an element, the first head cell has a width equal to the row width. Here's the code : HTML <div class="sheet-rTable">   <div class="sheet-rTableHeadRow">     <div class="sheet-rTableHead">Nom</div>     <div class="sheet-rTableHead">%</div>     <div class="sheet-rTableHead">Dégâts</div>     <div class="sheet-rTableHead">Structure</div>     <div class="sheet-rTableHead">Longueur</div>     <div class="sheet-rTableHead">Main</div>     <div class="sheet-rTableHead"> </div>   </div>   <fieldset class="repeating_contactWeapons">     <div class="sheet-rTableRow">       <div class="sheet-rTableCell">         <input name="attr_contactWeaponName" type="text" class="sheet-box" />       </div>       <div class="sheet-rTableCell">         <input name="attr_contactWeaponPercent" type="number" class="sheet-box" />       </div>       <div class="sheet-rTableCell">         <input name="attr_contactWeaponDamage" type="text" class="sheet-box" />       </div>       <div class="sheet-rTableCell">         <input name="attr_contactWeaponStructure" type="text" class="sheet-box" />       </div>       <div class="sheet-rTableCell">         <input name="attr_contactWeaponLength" type="text" class="sheet-box" />       </div>       <div class="sheet-rTableCell">         <input name="attr_contactWeaponHand" type="text" class="sheet-box" />       </div>       <div class="sheet-rTableCell">         <button type="roll" value="" name="roll_contactWeaponCheck"></button>       </div>     </div>   </fieldset> </div> CSS .sheet-rTable {   display: table;   width: 100%;   font-size: 11px; } .sheet-rTableRow {   display: table-row; } .sheet-rTableHeadRow {   display: table-header-group; } .sheet-rTableHead {   background-color: grey;   font-weight: bold; } .sheet-rTableCell, .sheet-rTableHead {   display: table-cell;   padding: 3px 10px; } Did I use it wrong ? What should I do to fix this problem ? Thanks.
1458917552

Edited 1458917720
Finderski
Plus
Sheet Author
Compendium Curator
I've never seen table-cell as a valid CSS display type thing (as you can see I'm very technical).  I'd recommend trying: .sheet-rTableCell, .sheet-rTableHead {   display: inline-block;   padding: 3px 10px; } EDIT: I stand corrected...table-cell is valid. Though, I'd still try using inline-block.
1458918134
PadRpg
Sheet Author
API Scripter
I try your thing but everything in my sheet is mess up now :'( Before: After: I found the table-cell element on this page :&nbsp; <a href="http://www.w3schools.com/cssref/pr_class_display.a" rel="nofollow">http://www.w3schools.com/cssref/pr_class_display.a</a>... (I think it's a valid display if you can find it on w3schools)
1458921591

Edited 1458921971
Lithl
Pro
Sheet Author
API Scripter
Try the following: Remove the sheet-rTableRow div from within the fieldset. The first child of your fieldset will then be your first sheet-rTableCell div. Amend your CSS (only the changed parts are below): .sheet-rTableRow, .repitem { &nbsp; display: table-row; } .repcontainer { &nbsp; &nbsp; display: table-row-group; } /** * I only added this because the repeating section was freaking out in edit mode. * If it's behaving fine in edit mode for you, you can probably omit this. */ .itemcontrol { height: auto !important; } This becomes fairly easy to see if you look at the generated HTML, which ends up something like this: &lt;div class="sheet-rTable"&gt; &lt;div class="sheet-rTableHeadRow"&gt; &lt;div class="sheet-rTableHead"&gt;...&lt;/div&gt; ... &lt;/div&gt; &lt;fieldset class="repeating_contactWeapons" style="display: none;"&gt;...&lt;/fieldset&gt; &lt;div class="repcontainer" data-groupname="repeating_contactweapons"&gt; &lt;div class="repitem" data-reprowid="-Abc123"&gt; &lt;div class="itemcontrol"&gt;...&lt;/div&gt; &lt;div class="sheet-rTableCell"&gt;...&lt;/div&gt; ... &lt;/div&gt; ... &lt;/div&gt; &lt;/div&gt; You've got repcontainer which contains several repitems, each representing a row and each containing several sheet-rTableCells. This mirrors the normal HTML table construction of a tbody with several trs, which each have several tds. If your sheet contains repeating sections which are not &nbsp;tables, you'll want to distinguish the CSS in some way. For example: .sheet-rTableRow, .sheet-rTable .repitem { &nbsp; display: table-row; } .sheet-rTable .repcontainer { &nbsp; &nbsp; display: table-row-group; } .sheet-rTable .itemcontrol { height: auto !important; }
1458922059
PadRpg
Sheet Author
API Scripter
Thanks, it works great :)