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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource


Babel includes JSX processing.

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


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

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

Visit your global Editor Settings.


                <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;