Build a Tile Sample Observation Worksheet With HTML, CSS and JavaScript

by tilekindau in Design > Websites

27 Views, 0 Favorites, 0 Comments

Build a Tile Sample Observation Worksheet With HTML, CSS and JavaScript

This project builds a small browser worksheet for comparing up to three physical tile samples. It gives each sample the same five observation fields, lets you record a preference, and turns those notes into CSV text or a printable summary.

The useful part is the consistent structure: when you return to your samples later, you can see which notes were made in daylight, which were made under room lighting, and which describe the surrounding materials. The worksheet records your observations; it does not decide whether a tile is suitable for a particular installation.

The implementation uses three files and no external JavaScript libraries. It was developed for Tilekind with AI assistance and reviewed before its earlier publication on StackBlitz. This tutorial explains how the files work so that the project can be reproduced and understood.

Supplies

  1. A computer with a text editor and a modern web browser.
  2. The full HTML in Step 1, plus the attached style.css.txt and script.js.txt source files.
  3. Optional: physical samples to use after the page is working. Example labels in the screenshots are demonstration data, not product recommendations.

No paid software, account or build tool is needed to run the three files locally.

Put the Three Files Together

Create a folder called sample-worksheet.

Download the two text attachments below. Save style.css.txt as style.css and script.js.txt as script.js, using a plain-text editor and UTF-8.

Copy the complete HTML below into a third file named index.html. Keep all three files together, then open index.html in your browser. No build step or external library is required.

If the page has no styling, check that the filenames really end in .html, .css and .js rather than an extra .txt extension. The HTML references the stylesheet and script by their relative paths.

<!doctype html>
<html lang="en-AU">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="color-scheme" content="light">
<meta name="description" content="A simple worksheet for recording what you notice about physical tile samples in your own space and lighting.">
<title>Tile Sample Observation Worksheet</title>
<link rel="stylesheet" href="./style.css">
<script src="./script.js" defer></script>
</head>
<body>
<main class="worksheet">
<header class="page-header">
<p class="eyebrow">A little time with your samples</p>
<h1>Tile Sample<br class="desktop-break"> Observation Worksheet</h1>
<p class="intro">Look at your physical samples in your own space. Record what you notice in daylight and under your room lighting, alongside the materials around them.</p>
<ol class="steps" aria-label="How to use this worksheet">
<li><span aria-hidden="true">01</span> Label up to three samples.</li>
<li><span aria-hidden="true">02</span> Compare them in the same setting.</li>
<li><span aria-hidden="true">03</span> Save the observations that matter to you.</li>
</ol>
</header>

<form id="observation-form" aria-describedby="save-help" autocomplete="off">
<div class="section-heading">
<div>
<p class="eyebrow">Look, compare, take notes</p>
<h2>Your three samples</h2>
</div>
<p>Every field is optional.</p>
</div>

<div class="sample-grid">
<fieldset class="sample-card">
<legend>Sample 1</legend>
<label for="sample-1-label">Your sample label</label>
<input id="sample-1-label" name="sample-1-label" type="text" maxlength="100">
<label for="sample-1-daylight">In daylight</label>
<p id="sample-1-daylight-help" class="field-help">Note the light, time of day and colours you notice.</p>
<textarea id="sample-1-daylight" name="sample-1-daylight" rows="3" maxlength="2000" aria-describedby="sample-1-daylight-help"></textarea>
<label for="sample-1-room">Under room lighting</label>
<p id="sample-1-room-help" class="field-help">Which lights are on? What looks different?</p>
<textarea id="sample-1-room" name="sample-1-room" rows="3" maxlength="2000" aria-describedby="sample-1-room-help"></textarea>
<label for="sample-1-cabinetry">Alongside your cabinetry</label>
<textarea id="sample-1-cabinetry" name="sample-1-cabinetry" rows="2" maxlength="2000"></textarea>
<label for="sample-1-worktop">Alongside your worktop</label>
<textarea id="sample-1-worktop" name="sample-1-worktop" rows="2" maxlength="2000"></textarea>
<label for="sample-1-finish">Texture and finish impressions</label>
<p id="sample-1-finish-help" class="field-help">Describe how the surface looks and feels to you.</p>
<textarea id="sample-1-finish" name="sample-1-finish" rows="3" maxlength="2000" aria-describedby="sample-1-finish-help"></textarea>
</fieldset>

<fieldset class="sample-card">
<legend>Sample 2</legend>
<label for="sample-2-label">Your sample label</label>
<input id="sample-2-label" name="sample-2-label" type="text" maxlength="100">
<label for="sample-2-daylight">In daylight</label>
<p id="sample-2-daylight-help" class="field-help">Note the light, time of day and colours you notice.</p>
<textarea id="sample-2-daylight" name="sample-2-daylight" rows="3" maxlength="2000" aria-describedby="sample-2-daylight-help"></textarea>
<label for="sample-2-room">Under room lighting</label>
<p id="sample-2-room-help" class="field-help">Which lights are on? What looks different?</p>
<textarea id="sample-2-room" name="sample-2-room" rows="3" maxlength="2000" aria-describedby="sample-2-room-help"></textarea>
<label for="sample-2-cabinetry">Alongside your cabinetry</label>
<textarea id="sample-2-cabinetry" name="sample-2-cabinetry" rows="2" maxlength="2000"></textarea>
<label for="sample-2-worktop">Alongside your worktop</label>
<textarea id="sample-2-worktop" name="sample-2-worktop" rows="2" maxlength="2000"></textarea>
<label for="sample-2-finish">Texture and finish impressions</label>
<p id="sample-2-finish-help" class="field-help">Describe how the surface looks and feels to you.</p>
<textarea id="sample-2-finish" name="sample-2-finish" rows="3" maxlength="2000" aria-describedby="sample-2-finish-help"></textarea>
</fieldset>

<fieldset class="sample-card">
<legend>Sample 3</legend>
<label for="sample-3-label">Your sample label</label>
<input id="sample-3-label" name="sample-3-label" type="text" maxlength="100">
<label for="sample-3-daylight">In daylight</label>
<p id="sample-3-daylight-help" class="field-help">Note the light, time of day and colours you notice.</p>
<textarea id="sample-3-daylight" name="sample-3-daylight" rows="3" maxlength="2000" aria-describedby="sample-3-daylight-help"></textarea>
<label for="sample-3-room">Under room lighting</label>
<p id="sample-3-room-help" class="field-help">Which lights are on? What looks different?</p>
<textarea id="sample-3-room" name="sample-3-room" rows="3" maxlength="2000" aria-describedby="sample-3-room-help"></textarea>
<label for="sample-3-cabinetry">Alongside your cabinetry</label>
<textarea id="sample-3-cabinetry" name="sample-3-cabinetry" rows="2" maxlength="2000"></textarea>
<label for="sample-3-worktop">Alongside your worktop</label>
<textarea id="sample-3-worktop" name="sample-3-worktop" rows="2" maxlength="2000"></textarea>
<label for="sample-3-finish">Texture and finish impressions</label>
<p id="sample-3-finish-help" class="field-help">Describe how the surface looks and feels to you.</p>
<textarea id="sample-3-finish" name="sample-3-finish" rows="3" maxlength="2000" aria-describedby="sample-3-finish-help"></textarea>
</fieldset>
</div>

<fieldset class="preference-card">
<legend>Your overall preference</legend>
<div class="preference-grid">
<div>
<label for="preference">Which sample do you prefer in this setting?</label>
<select id="preference" name="preference">
<option value="">Choose if you have a preference</option>
<option id="preference-1" value="sample-1">Sample 1</option>
<option id="preference-2" value="sample-2">Sample 2</option>
<option id="preference-3" value="sample-3">Sample 3</option>
<option value="no-clear-preference">No clear preference yet</option>
</select>
<p class="field-help">This records your impression of these samples today.</p>
</div>
<div>
<label for="preference-notes">What shaped your preference?</label>
<textarea id="preference-notes" name="preference-notes" rows="3" maxlength="2000"></textarea>
</div>
</div>
</fieldset>

<div class="save-panel">
<div>
<h2>Keep your notes</h2>
<p id="save-help">Your notes aren't saved by this worksheet. Print or download a CSV to keep a copy before refreshing or closing it.</p>
<p class="privacy-note">This worksheet's code does not send your notes to a server or save them between visits. The hosting platform has its own privacy practices.</p>
</div>
<div class="actions">
<button id="print-notes" type="button">Print notes</button>
<button id="download-notes" class="secondary" type="button">Download notes CSV</button>
<button id="view-csv" class="secondary" type="button">View CSV text</button>
</div>
<p id="action-status" class="action-status" role="status" aria-live="polite"></p>
<div id="csv-preview" class="csv-preview" hidden>
<label for="csv-text">CSV text to copy</label>
<p id="csv-text-help" class="field-help">If downloading is blocked, copy all the text below into a plain-text file named tile-sample-observation-notes.csv and save it as UTF-8. Choose View CSV text again after changing your notes.</p>
<textarea id="csv-text" rows="10" readonly spellcheck="false" wrap="off" aria-describedby="csv-text-help"></textarea>
</div>
</div>
</form>

<section id="print-summary" class="print-summary" aria-label="Printable observation notes"></section>

<footer class="page-footer">
<p>AI-assisted educational code for <a href="https://tilekind.com.au/" target="_blank" rel="noopener noreferrer">Tilekind Australia</a>, an Australian online tile retailer.</p>
<p>A place to record personal observations. Samples may show only part of a tile's variation.</p>
</footer>
</main>
</body>
</html>


Give Each Sample the Same Fields

In index.html, each sample is a fieldset with a legend. Its controls have unique IDs such as sample-1-label and sample-1-daylight. The visible labels use for attributes matching those IDs.

Each sample has space for a label and notes about:

  1. daylight;
  2. room lighting;
  3. nearby cabinetry;
  4. the worktop;
  5. texture and finish impressions.

Keeping the fields consistent makes side-by-side reading easier. All fields are optional. The page starts blank, so it does not imply that a particular colour or finish is the correct choice.

Arrange the Cards With CSS Grid

The desktop layout is controlled by:

.sample-grid {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 20px;
}

The stylesheet changes the sample and preference grids to a single column at 680 pixels or less. Try narrowing the browser window to see the cards stack. minmax(0, 1fr) allows the columns to shrink without a long field forcing one column wider than its neighbours.

You can adjust the colours in the :root variables without changing the worksheet logic. Keep text and field borders easy to distinguish.

Keep the Preference Labels in Sync

In script.js, updatePreferenceLabels() reads each sample label and updates its matching preference option. For example, entering Example A changes the option to Sample 1 — Example A.

The input event listeners run this function as you type. The preference is still stored as sample-1, sample-2 or sample-3, so editing a label does not change which sample the option refers to.

Try entering three example labels, selecting one, and then changing its label. The displayed option should update. Use these example labels while checking the page, then start a fresh session for your own sample notes.

Make a CSV That Preserves the Notes

readNotes() collects the fields into a JavaScript object. makeCsv() turns that object into a header, three sample rows and one overall-preference row.

The csvCell() helper quotes every cell and doubles any quotes inside it. That preserves commas, quotes and line breaks in a note. It also prefixes formula-like text with an apostrophe to reduce the risk that spreadsheet software interprets a note as a formula.

Choose View CSV text to inspect the output. This is also the fallback if a browser or embedded preview blocks downloads: copy the text into a plain-text file named tile-sample-observation-notes.csv, saved as UTF-8. After editing a note, choose View CSV text again to refresh the output.

The download button prepares the same CSV, but delivery of the file depends on the browser and host. If a download does not appear, use the CSV-text method above to keep your notes.

Understand the Printable Summary

The print button calls preparePrintSummary() and then requests the browser's print dialog. The summary uses text elements created with textContent, keeping user-entered notes as text rather than HTML.

The @media print rules hide the editable form and display the summary. Notes that were left blank become Not recorded. A browser may offer printing or saving to PDF; availability depends on the environment.

An embedded preview may restrict printing. If the print dialog does not open, use the CSV-text method to preserve the notes.

Keep a Copy Before Leaving

The worksheet does not store notes between visits. Its code clears the fields on initialisation and on the pageshow event. Save or copy the output before refreshing, navigating away or closing the page.

The worksheet code contains no network requests, analytics or browser-storage calls. An online host has its own data and privacy practices, so that code-level statement is not a privacy guarantee about the hosting service.

Once the example labels work, begin a fresh session with your actual samples. Record the setting and lighting conditions that matter to your comparison. Visual preference remains separate from technical specifications and installation requirements.

The worksheet was prepared for Tilekind Australia, an Australian online tile retailer. Code was developed with AI assistance.