Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

-webkit-baseline-middle and -moz-middle-with-baseline

Tags:

When using browsers web inspectors I came across two different and non-standard property for the CSS attribute vertical-align.

-webkit-baseline-middle is only available in Chrome while -moz-middle-with-baseline is available on Firefox. The naming is similar but NOT the same.

I couldn't find any information regarding these two on the web. They are not even listed on MDN.

My questions:

  • Are they part of any standards?
  • What is the expected behavior when using them?
like image 715
Vahid Amiri Avatar asked Aug 24 '17 03:08

Vahid Amiri


People also ask

What type of word is &?

As detailed above, 'and' is a conjunction. Conjunction usage: Boys and girls come out to play.

What is the English word for and?

And is a coordinating conjunction. We use and to connect two words, phrases, clauses or prefixes together: … Go and, come and.

Is or a conjunction?

Or is a conjunction that connects two or more possibilities or alternatives. It connects words, phrases and clauses which are the same grammatical type: Which do you prefer?

Does and/or mean two?

Meaning of and/or in English (used to refer to both things or either one of the two mentioned) either "and" or "or": If the game is cancelled, you will get a refund and/or new tickets.


1 Answers

@VSG24:
Are they part of any standards?

Both properties are not part of any standards, according to W3C CSS reference. They only seem to be used by Webkit and Gecko to behave correctly, as expected in CSS 2.1 specification:

Align the vertical midpoint of the box with the baseline of the parent box plus half the x-height of the parent.
CSS 2.1 specs, p170

Diagram showing the effect of various values of 'vertical-align' on table cells


@VSG24:
What is the expected behavior when using them?

After some search on the web, here's what I've found about -webkit-baseline-middle on the Safari CSS Reference:

vertical-align: -webkit-baseline-middle:
The center of the element is aligned with the baseline of the text.

I was unable to get any info about -moz-middle-with-baseline other than this one :

Q: Webkit-baseline-middle - are there alternatives?

A: the same, only for Mozilla
>vertical-align: -moz-middle-with-baseline;

https://toster.ru/q/255210


Below is a test, you may try it using Webkit based browsers (such as Chrome) and Gecko (Firefox):

div {   width: 15%;   height: 100px;   display: inline-block;   box-sizing: border-box; }  hr {   width: 100%;   position: absolute;   top: 90px;   height: 1px;   background: hotpink;   border: none; }  .container {   border: 2px solid hotpink;   position: absolute;   top: 0;   left: 0;   height: 200px;   width: 100%;   z-index: -1; }  .reference {   background: darkblue; }  .standard {   background: teal;   vertical-align: middle; }  .moz {   background: antiquewhite;   vertical-align: -moz-middle-with-baseline; }  .webkit {   background: darksalmon;   vertical-align: -webkit-baseline-middle }
<div class="container">   <hr />   <div class="reference"></div>   <div class="standard"></div>   <div class="moz"></div>   <div class="webkit"></div> </div>

References :

  • Safari and WebKit implement a large subset of the CSS 2.1 Specification defined by the World Wide Web Consortium (W3C), along with portions of the CSS 3 Specification. This reference describes the supported properties and provides Safari availability information. If a property is not listed here, it is not implemented by Safari and WebKit.
    Safari CSS Reference
  • Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification

Hope I helped a bit :)

like image 184
Puka Avatar answered Sep 21 '22 17:09

Puka