JSFiddle - React, Tailwind, and code Playground

by Znarkus

HTML

<script src="https://raw.github.com/Znarkus/jquery.inlineLabel/master/jquery.inlineLabel.js"></script>
<fieldset id="style1">
    <legend>Code style 1</legend>
    
    <label>
        <span>First name</span>
        <input>
    </label>
    
    <label>
        <span>Last name</span>
        <input>
    </label>
</fieldset >

<fieldset id="style2">
    <legend>Code style 2</legend>
    
    <label for="first_name">First name</label>
    <input id="first_name">
    
    <label for="last_name">Last name</label>
    <input id="last_name">
</fieldset>

CSS

body { padding: 50px; font: 15px/1.4em "Helvetica Neue", Helvetica, Tahoma, Geneva, sans-serif; }
legend { font-weight: bold; }

input {
    display: block;
    width: 300px;
    padding: 6px;
    font: 20px/1em Arial;
    margin-bottom: 30px;
}

#style1 label {
    display: block;
}

JavaScript

$('label').inlineLabel();