Right-align form elements with CSS
Look mama, no table!
See how narrowing the Result window is handled.
HTML
<body>
<header>
<h1>Table</h1>
</header>
<main>
<form method="POST" action="/account">
<table>
<thead></thead>
<tbody>
<tr>
<td>
<label>Email address*</label>
</td>
<td align="right">
<input type="email" name="uid" placeholder="email@provider.com" required>
</td>
</tr>
<tr>
<td>
<label>Password*</label>
</td>
<td align="right">
<input type="password" name="pwd1" placeholder="********" required>
</td>
</tr>
<tr>
<td>
<label>Repeat password*</label>
</td>
<td align="right">
<input type="password" name="pwd2" placeholder="********" required>
</td>
</tr>
<tr>
<td colspan="2" align="right">
<input type="submit" value="Submit">
</td>
</tr>
</tbody>
</table>
</form>
</main>
<header>
<h1>Plain HTML</h1>
</header>
<main>
<form method="POST" action="/account">
<p>
<label>Email address*
<input type="email" name="uid" placeholder="email@provider.com" required>
</label>
</p>
<p>
<label>Password*
<input type="password" name="pwd1" placeholder="********" required>
</label>
</p>
<p>
...
CSS
body {
background-color: seashell;
font-family: sans-serif;
}
main {
background-color: rgba(255, 255, 255, 0.7);
padding: 0.2em;
}
p {
margin: 0.15em;
}
h1 {
font-size: larger;
}
input:not([type="submit"]) {
width: 15em;
}
input {
max-width: 95%;
}
label {
margin-right: 0.5em;
}
.right {
float: right;
}
input.right {
margin-top: 3px;
}
.justify {
display: flex;
justify-content: space-between;
align-items: center;
}
.flex {
display: flex;
}
.column {
display: flex;
flex-direction: column;
}