Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat Html markup for a focusable TD?
    primarykey
    data
    text
    <p>I want to practive, and even best-practice, with Html+JS+CSS. I use a one page client-only Sudoku page. My Sudoku markup is basically a <code>&lt;table&gt;</code>, with <code>&lt;td&gt;</code>.<br> (I'm open to suggestions to improve this).</p> <p>My requirements :</p> <ol> <li>Have a <strong>cell under focus</strong> (the keyboard notion of focus) (highlighed with css to a yellow background)</li> <li>Navigate through cells with arrow keys (plus Home etc).</li> <li>type-in an integer value sets that value to the currently focused cell</li> </ol> <p>I use an input button inside each cell. The Javascript works fine.</p> <p>My only problem is with the display. <strong>When a cell has the focus, it's highlighted display doesn't cover the whole TD</strong>, rather only the visual space included in the input button. I have some space around the button that isn't 'yellow'.</p> <p>I don't think I could go up in the CSS selection, to select the parent of the input, could I ? Such as :</p> <pre><code>input:focus '?? how to go up ??' td { background-color:yellow; </code></pre> <p>I tried a few tricks, like having always 5 characters in each button display (5 spaces when empty, changing the middle character when set), but nothing is visually satisfying. Even worse, it is clearly against best-practices to alter the content for the sake of visualizing. That's what the MVC distinction between Html/Css/Js is for !</p> <p>I already searched this site for answer, I found close but distinct questions and answer.</p> <p>I'm hoping someone could help improve my page ... and my markup skill :-)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload