Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can use: <code>line-height</code>!</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>.box { color: #fff; background: #444; height: 40px; line-height: 40px; /* Same as height */ }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;p class="box"&gt;some text &lt;input type="button" value="Button" /&gt;&lt;/p&gt;</code></pre> </div> </div> </p> <p>set for the button parent,<br> where, as you can see, <code>line-height</code> matches the element <code>height</code><br> and will align both texts at the element's (<code>p</code>) center. Otherwise, the button, being an <code>inline</code> element by default, it's subject to manipulations using the CSS property <code>vertical-align:</code> which basically aligns all *inline** elements vertically inside a <strong>block</strong> level element using this typography terms:<br></p> <pre><code>vertical-align: baseline; vertical-align: sub; vertical-align: super; vertical-align: text-top; vertical-align: text-bottom; vertical-align: middle; vertical-align: top; vertical-align: bottom; vertical-align: 10em; vertical-align: 4px; vertical-align: 20%; </code></pre> <p>*<sub><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/vertical-align" rel="nofollow noreferrer">https://developer.mozilla.org/en-US/docs/Web/CSS/vertical-align</a></sub></p> <p>exactly, you can even manually adjust the alignment using <code>PX</code> / <code>-PX</code> and <code>%</code> </p> <p>I've encountered some issues using line-height on Android browsers (), so sometimes the right solution was to play with the parent <strong>padding</strong> * and vertical-align rather than the inner children's alignments (with line-height).</p> <p>*<sub>(note: <strong>padding</strong> for block elements is more consistent than (top, bottom) used on inner inline elements.)</sub></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload