The snippet presents a series of columns containing a single letter. I'd like to have the center of the glyph in the center of each, but as you can see, they not quite centered -- appearing just off to the right. (I suspect by half the glyph width, but I'm not sure).
I've tried justify-content: center
, margin: auto
to no avail. Inspecting the pure, I don't see anything that should prevent what I'm aiming for. Can you help me fix it?
.centered-cols {
justify-content: center;
}
.key {
text-align: center;
min-width: 1.9em;
margin: 0.2em;
border-radius: 0.4em;
background-color: lightgrey;
}
<link href="https://unpkg.com/purecss@2.0.6/build/pure-min.css" rel="stylesheet" />
<div class="pure-g centered-cols">
<div id="q" class="pure-u-1-10 key"><p>A</p></div>
<div id="w" class="pure-u-1-10 key"><p>B</p></div>
<div id="e" class="pure-u-1-10 key"><p>C</p></div>
<div id="r" class="pure-u-1-10 key"><p>D</p></div>
<div id="t" class="pure-u-1-10 key"><p>E</p></div>
<div id="y" class="pure-u-1-10 key"><p>F</p></div>
<div id="u" class="pure-u-1-10 key"><p>G</p></div>
<div id="i" class="pure-u-1-10 key"><p>H</p></div>
<div id="o" class="pure-u-1-10 key"><p>I</p></div>
<div id="p" class="pure-u-1-10 key"><p>J</p></div>
</div>
Add letter-spacing: 0
in your .key
css class:
.key {
letter-spacing: 0;
text-align: center;
min-width: 1.9em;
margin: 0.2em;
border-radius: 0.4em;
background-color: lightgrey;
}
<link href="https://unpkg.com/purecss@2.0.6/build/pure-min.css" rel="stylesheet" />
<div class="pure-g centered-cols">
<div id="q" class="pure-u-1-10 key">
<p>A</p>
</div>
<div id="w" class="pure-u-1-10 key">
<p>B</p>
</div>
<div id="e" class="pure-u-1-10 key">
<p>C</p>
</div>
<div id="r" class="pure-u-1-10 key">
<p>D</p>
</div>
<div id="t" class="pure-u-1-10 key">
<p>E</p>
</div>
<div id="y" class="pure-u-1-10 key">
<p>F</p>
</div>
<div id="u" class="pure-u-1-10 key">
<p>G</p>
</div>
<div id="i" class="pure-u-1-10 key">
<p>H</p>
</div>
<div id="o" class="pure-u-1-10 key">
<p>I</p>
</div>
<div id="p" class="pure-u-1-10 key">
<p>J</p>
</div>
</div>