I am trying to center a simple div but I am failing miserably. Nothing I try works, including many examples here on Stack Overflow. Here is (the main part of) my CSS:
body {
min-height: 640px;
background: #282a36;
color: #bcc3cd;
font-size: 12px;
margin: 0;
font-family: 'Source Sans Pro', sans-serif;
}
#nickbox {
border: 1px solid white;
display: inline;
padding: 5px;
background-color: #ffffff00;
}
<div id="welcome">
<p tabindex="0" class="title">
Cards Against Oakbank
</p>
<p class="subtitle">A Cards Against Humanity clone.</p>
<div id="nickbox">
<label for="nickname">Nickname:</label>
<input type="text" id="nickname" value="" maxlength="20" role="textbox"
aria-label="Enter your nickname." data-lpignore="true" />
<input type="button" id="nicknameconfirm" value="Set" />
<span id="nickbox_error" class="error"></span>
</div>
</div>
There's no attempt at centering in there right now as I've run out of ideas. What should I use? I just want the #nickbox
to be centered horizontally on every screen. I don't really care about supporting older browsers, it's varying resolutions that I care about. Thanks.