Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.


              <h1>Automatic grid "tic-tac-toe-like".</h1>
<p>Just change the number of columns and rows in the SCSS, adapt your HTML to match, and you get your grid. Left items won't get a left border, right ones won't get any border on the right, and the same for top and bottom rows.</p>
<div class="ttt" id="tic-tac-toe">
    <div class="ttt__box">1</div>
    <div class="ttt__box">2</div>
    <div class="ttt__box">3</div>
    <div class="ttt__box">4</div>
    <div class="ttt__box">5</div>
    <div class="ttt__box">6</div>
    <div class="ttt__box">7</div>
    <div class="ttt__box">8</div>
    <div class="ttt__box">9</div>
    <div class="ttt__box">10</div>
    <div class="ttt__box">11</div>
    <div class="ttt__box">12</div>
My "Proposition" for a tic-tac-toe-like grid...


              .ttt {
    $columnsQty: 3;     // adapt to your needs
    $rowsQty: 4;        // adapt to your needs
    @function findLastRow($cols, $rows) {
        @return $cols * $rows - $cols + 1;
    @function findFirstOfRow($cols) {
        @return $cols - 1;
    $firstOfRow: findFirstOfRow($columnsQty);
    $theLastRow: findLastRow($columnsQty, $rowsQty);
    display: grid;
    grid-template-columns: repeat($columnsQty, 1fr);
    grid-template-rows: repeat($rowsQty, 1fr);
    margin: 10vh auto;
    width: 80vh;    // adapt to your needs
    height: 80vh;   // adapt to your needs
    &__box {
        display: flex;
        justify-content: center;
        align-items: center;
        position: relative;
        height: 100%;
        text-align: center;
        &:not(:nth-child(#{$columnsQty}n - #{$firstOfRow}))::before {
            display: block;
            position: absolute;
            left: 0;
            top: 0;
            border-left: 1px solid #000;
            width: 0;
            height: 100%;
            content: '';
        &:not(:nth-child(n + #{$theLastRow}))::after {
            display: block;
            position: absolute;
            bottom: 0;
            left: 0;
            border-bottom: 1px solid #000;
            width: 100%;
            height: 0;
            content: '';

     General appearance, nothing related to what you see ;-)
* {
     box-model: border-box;
body {
     line-height: 1.2em;
     font-family: "Segoe UI", sans-serif;