Pen Settings

HTML

CSS

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

JavaScript

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

Behavior

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.

HTML

              
                <table id="tic-tac-toe">
	<tbody>
		<tr>
			<td>
				<fieldset>
					<legend>top left field</legend>
					<input type="radio" name="top-left" id="top-left-x">
					<label for="top-left-x">x</label>
					<input type="radio" name="top-left" id="top-left-o">
					<label for="top-left-o">o</label>
				</fieldset>
			</td>
			<td>
				<fieldset>
					<legend>top center field</legend>
					<input type="radio" name="top-center" id="top-center-x">
					<label for="top-center-x">x</label>
					<input type="radio" name="top-center" id="top-center-o">
					<label for="top-center-o">o</label>
				</fieldset>
			</td>
			<td>
				<fieldset>
					<legend>top right field</legend>
					<input type="radio" name="top-right" id="top-right-x">
					<label for="top-right-x">x</label>
					<input type="radio" name="top-right" id="top-right-o">
					<label for="top-right-o">o</label>
				</fieldset>
			</td>
		</tr>
		<tr>
			<td>
				<fieldset>
					<legend>middle left field</legend>
					<input type="radio" name="middle-left" id="middle-left-x">
					<label for="middle-left-x">x</label>
					<input type="radio" name="middle-left" id="middle-left-o">
					<label for="middle-left-o">o</label>
				</fieldset>
			</td>
			<td>
				<fieldset>
					<legend>middle center field</legend>
					<input type="radio" name="middle-center" id="middle-center-x">
					<label for="middle-center-x">x</label>
					<input type="radio" name="middle-center" id="middle-center-o">
					<label for="middle-center-o">o</label>
				</fieldset>
			</td>
			<td>
				<fieldset>
					<legend>middle right field</legend>
					<input type="radio" name="middle-right" id="middle-right-x">
					<label for="middle-right-x">x</label>
					<input type="radio" name="middle-right" id="middle-right-o">
					<label for="middle-right-o">o</label>
				</fieldset>
			</td>
		</tr>
		<tr>
			<td>
				<fieldset>
					<legend>bottom left field</legend>
					<input type="radio" name="bottom-left" id="bottom-left-x">
					<label for="bottom-left-x">x</label>
					<input type="radio" name="bottom-left" id="bottom-left-o">
					<label for="bottom-left-o">o</label>
				</fieldset>
			</td>
			<td>
				<fieldset>
					<legend>top center field</legend>
					<input type="radio" name="bottom-center" id="bottom-center-x">
					<label for="bottom-center-x">x</label>
					<input type="radio" name="bottom-center" id="bottom-center-o">
					<label for="bottom-center-o">o</label>
				</fieldset>
			</td>
			<td>
				<fieldset>
					<legend>bottom right field</legend>
					<input type="radio" name="bottom-right" id="bottom-right-x">
					<label for="bottom-right-x">x</label>
					<input type="radio" name="bottom-right" id="bottom-right-o">
					<label for="bottom-right-o">o</label>
				</fieldset>
			</td>
		</tr>
	</tbody>
</table>
              
            
!

CSS

              
                #tic-tac-toe
{
	border-collapse: collapse;
}

#tic-tac-toe td
{
	width: 30vmin;
	height: 30vmin;
	border: 1px solid;
	position: relative;
	text-align: center;
}

#tic-tac-toe fieldset
{
	border: none;
}

#tic-tac-toe legend
{
	border: 0;
	clip: rect(0 0 0 0);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
}

#tic-tac-toe input
{
	display: none;
}

#tic-tac-toe label
{
	font-size: 0;
}

#tic-tac-toe label[for$="-x"] {background: hsla(0, 100%, 50%, 0.2)}
#tic-tac-toe label[for$="-o"] {background: hsla(240, 100%, 50%, 0.2)}

#tic-tac-toe label::after
{
	content: "";
	position: absolute;
	top: 0;
	width: 25%;
	height: 25%;
	cursor: pointer;
	/* transition: width, height, left 0.1s; */
}

#tic-tac-toe label[for$="-x"]::after
{
	left: 0;
	background-image: url('data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%201%201%22%3E%3Cline%20x1%3D%220.1%22%20y1%3D%220.1%22%20x2%3D%220.9%22%20y2%3D%220.9%22%20stroke-width%3D%220.1%22%20stroke%3D%22red%22%2F%3E%3Cline%20x1%3D%220.1%22%20y1%3D%220.9%22%20x2%3D%220.9%22%20y2%3D%220.1%22%20stroke-width%3D%220.1%22%20stroke%3D%22red%22%2F%3E%3C%2Fsvg%3E');
}

#tic-tac-toe label[for$="-o"]::after
{
	content: "";
	left: 37.5%;
	background-image: url('data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%201%201%22%3E%3Ccircle%20cx%3D%220.5%22%20cy%3D%220.5%22%20r%3D%220.4%22%20fill%3D%22none%22%20stroke-width%3D%220.1%22%20stroke%3D%22blue%22%2F%3E%3C%2Fsvg%3E');
}

#tic-tac-toe label:focus::after
{
	outline: 1px dashed;
}

#tic-tac-toe :checked + label::after
{
	left: 0;
	width: 100%;
	height: 100%;
	z-index: -1;
}

@supports (transform: scale(1))
{
	#tic-tac-toe label::after
	{
		width: 100%;
		height: 100%;
		transform: scale(0.25);
		transition: transform 0.1s;
	}
	
	#tic-tac-toe label[for$="-x"]::after
	{
		transform-origin: left top;		
	}
	
	#tic-tac-toe label[for$="-o"]::after
	{
		left: 0;		
		transform-origin: center top;	
	}
	
	#tic-tac-toe :checked + label::after
	{
		transform: scale(1);
	}
}
              
            
!

JS

              
                
              
            
!
999px

Console