recursal/MDN huggingface dataset:
Box alignment in multi-column layout
====================================

The box alignment specification details how alignment works in various layout methods; on this page we explore how Box Alignment works in the context of multi-column Layout. As this page aims to detail things which are specific to Multi-column Layout and Box Alignment, it should be read in conjunction with the main box alignment page which details the common features of Box Alignment across layout methods.

In multi-column layout the alignment container is the content box of the multicol container. The alignment subject is the column box. The properties which apply to multi-column layouts are detailed below.

**Note:** Multi-column layout predates the box alignment specification. And the properties listed here, while specified for Multicol, may not be supported in browsers.

align-content and justify-content
---------------------------------

The `align-content` property applies to the block axis and `justify-content` to the inline axis. Any spacing added to the columns due to use of space distribution will be added to the gap between the columns, therefore making the gap larger than might be specified by the `column-gap` property.

Using a value of `justify-content` other than `normal` or `stretch` will cause column boxes to display at the `column-width` specified on the multicol container, and the remaining space distributed according to the value of justify-content.

column-gap
----------

The `column-gap` property was specified in earlier versions of the multiple-column layout specification, and has now been unified with the gap properties for other layout methods in box alignment. While other layout methods treat the initial value of column-gap as 0 multicol treats it as 1em, as in general you would not want to have no gap between columns.

Reference
---------

### CSS Properties

* `justify-content`
* `align-content`
* `column-gap`
### Glossary Entries

* Alignment subject
* Alignment container
* Fallback alignment
The Web Open Font Format (WOFF)
===============================

Baseline Widely available
-------------------------

This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2016.

* Learn more
* See full compatibility
* Report feedback
**WOFF** (the **Web Open Font Format**) is a web font format developed by Mozilla in concert with Type Supply, LettError, and other organizations. It uses a compressed version of the same table-based `sfnt` structure used by TrueType, OpenType, and Open Font Format, but adds metadata and private-use data structures, including predefined fields allowing foundries and vendors to provide license information if desired.

There are three main benefits to using WOFF:

1. The font data is compressed, so sites using WOFF will use less bandwidth and will load faster than if they used equivalent uncompressed TrueType or OpenType files.
2. Many font vendors that are unwilling to license their TrueType or OpenType format fonts for use on the web will license WOFF format fonts. This improves availability of fonts to site designers.
3. Both proprietary and free software browser vendors like the WOFF format, so it has the potential of becoming a truly universal, interoperable font format for the web, unlike other current font formats.

There are two versions of WOFF: WOFF and WOFF2. They mostly differ in regard to the compression algorithm used. In `@font-face` they are identified by the `'woff'` and `'woff2'` format descriptor respectively.

Using WOFF
----------

You can use the `@font-face` CSS property to use WOFF fonts for text in web content. It works exactly like OpenType and TrueType format fonts do, except it will likely let your content download more efficiently due to the addition of compression.

Tools for working with WOFF fonts
---------------------------------

* Tools for working with WOFF fonts are available. `sfnt2woff` and `woff2sfnt` convert between WOFF and OpenType.
Specifications
--------------

| Specification |
| --- |
| WOFF File Format 1.0 # OverallStructure |
| WOFF File Format 2.0 # FileStructure |

Browser compatibility
---------------------

### css.at-rules.font-face.WOFF

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

### css.at-rules.font-face.WOFF\_2

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* `@font-face`
Functions
=========

The following is an annotated list of core XPath functions and XSLT-specific additions to XPath, including a description, syntax, a list of arguments, result-type, source in the appropriate W3C Recommendation. For further information on using XPath/XSLT functions, please see the For Further Reading page.

* boolean()
* ceiling()
* choose()
* concat()
* contains()
* count()
* current() *XSLT-specific*
* document() *XSLT-specific*
* element-available()
* false()
* floor()
* format-number() *XSLT-specific*
* function-available()
* generate-id() *XSLT-specific*
* id()
* key() *XSLT-specific*
* lang()
* last()
* local-name()
* name()
* namespace-uri()
* normalize-space()
* not()
* number()
* position()
* round()
* starts-with()
* string()
* string-length()
* substring()
* substring-after()
* substring-before()
* sum()
* system-property() *XSLT-specific*
* translate()
* true()
* unparsed-entity-url() *XSLT-specific*
Axes
====

There are thirteen different axes in the XPath specification. An axis represents a relationship to the context node, and is used to locate nodes relative to that node on the tree.

For further information on using XPath expressions, please see the For Further Reading section at the end of Transforming XML with XSLT document. Also see the 'axes' section in the xpath spec.

`ancestor`

Indicates all the ancestors of the context node beginning with the parent node and traveling through to the root node.

`ancestor-or-self`

Indicates the context node and all of its ancestors, including the root node.

`attribute`

Indicates the attributes of the context node. Only elements have attributes. This axis can be abbreviated with the at sign (`@`).

`child`

Indicates the children of the context node. If an XPath expression does not specify an axis, this is understood by default. Since only the root node or element nodes have children, any other use will select nothing.

`descendant`

Indicates all the children of the context node, and all of their children, and so forth. Attribute and namespace nodes are **not** included - the `parent` of an `attribute` node is an element node, but `attribute` nodes are not the children of their parents.

`descendant-or-self`

Indicates the context node and all of its descendants. Attribute and namespace nodes are **not** included - the `parent` of an `attribute` node is an element node, but `attribute` nodes are not the children of their parents.

`following`

Indicates all the nodes that appear after the context node, except any `descendant`, `attribute`, and `namespace` nodes.

`following-sibling`

Indicates all the nodes that have the same parent as the context node and appear after the context node in the source document.

`namespace` *(not supported)*

Indicates all the nodes that are in scope for the context node. In this case, the context node must be an element node.

`parent`

Indicates the single node that is the parent of the context node. It can be abbreviated as two periods (`..`).

`preceding`

Indicates all the nodes that precede the context node in the document except any `ancestor`, `attribute` and `namespace` nodes.

`preceding-sibling`

Indicates all the nodes that have the same parent as the context node and appear before the context node in the source document.

`self`

Indicates the context node itself. It can be abbreviated as a single period (`.`).
Comparison of CSS Selectors and XPath
=====================================

This article seeks to document the difference between CSS Selectors and XPath for web developers to be able to better choose the right tool for the right job.

| XPath feature | CSS equivalent |
| --- | --- |
| `ancestor`, `parent` or `preceding-sibling` axis | `:has()` selector 
Experimental
 |
| `attribute` axis | Attribute selectors |
| `child` axis | Child combinator |
| `descendant` axis | Descendant combinator |
| `following-sibling` axis | Subsequent-sibling combinator or Next-sibling combinator |
| `self` axis | `:scope` or `:host` selector |
substring-after
===============

The `substring-after` function returns a string that is the rest of a given string after a given substring.

### Syntax
```

substring-after( haystack, needle )
```

### Arguments

`haystack`

The string to be evaluated. Part of this string will be returned.

`needle`

The substring to search for. Everything after the first occurrence of `needle` in `haystack` will be returned.

### Returns

A string.

### Examples

| XPath Example | Output |
| --- | --- |
| `substring-after('aa-bb','-')` | `bb` |
| `substring-after('aa-bb','a')` | `a-bb` |
| `substring-after('aa-bb','b')` | `b` |
| `substring-after('aa-bb','q')` | (empty string) |

### Defined

XPath 1.0 4.2

### Gecko support

Supported.
ceiling
=======

The `ceiling` function evaluates a decimal number and returns the smallest integer greater than or equal to the decimal number.

### Syntax
```

ceiling( number )
```

### Arguments

`number`

The number to be evaluated.

### Returns

The nearest integer greater than or equal to `number`.

for example:

`ceiling (5.2)` = *6*

`ceiling (-5.2)` = *-5*

### Defined

XPath 1.0 4.4

### Gecko support

Supported.
boolean
=======

The `boolean` function evaluates an expression and returns true or false.

Syntax
------


```js
boolean( expression )
```

Arguments
---------

`expression`

The expression to be evaluated. The expression can refer to numbers and node-sets as well as booleans.

Returns
-------

Boolean `true` or `false` after evaluating `expression`.

Notes
-----

* A number evaluates to false if it is positive or negative zero or `NaN`. Otherwise, it evaluates true.
* A node-set evaluates to true if it is non-empty.
* A string evaluates to false if it an empty string. Otherwise, it evaluates to true.
* An object of a type other than the four basic types is converted to a boolean in a way that is dependent on that type.
Defined
-------

XPath 1.0 4.3

Gecko support
-------------

Supported.
starts-with
===========

The `starts-with` checks whether the first string starts with the second string and returns true or false.

### Syntax
```

starts-with(haystack, needle)
```

### Arguments

`haystack`

The string to look in.

`needle`

The string to look for.

### Returns

`true` if `haystack` starts with `needle`. Otherwise, `false`.

### Defined

XPath 1.0 4.2

### Gecko support

Supported.
position
========

The `position` function returns a number equal to the context position from the expression evaluation context.

### Syntax
```

position()
```

### Returns

An integer equal to the context position from the expression evaluation context.

### Notes

* Note that a node's position in a context is not zero-based. The first node has a position of 1.
* The context is determined by the rest of the path.

```xml
<xsl:template match="//a[position() = 5]">
  <!-- this template matches the fifth a element
 anywhere in the document. -->
</xsl:template>
```



```xml
<xsl:template match="//div[@class='foo']/bar[position() = 1]">
  <!-- this template matches the first bar element that is
 a child of a div element with a class attribute equal to "foo" -->
</xsl:template>
```

### Defined

XPath 1.0 4.1

### Gecko support

Supported.
number
======

The `number` function converts an object to a number and returns the number.

### Syntax
```

number( [object] )
```

### Arguments

`object` (optional)

The object to be converted to a number. If this argument is omitted, the current context node will be used.

### Returns

The resulting number after converting the object.

### Notes

* Strings are converted to a number by stripping the leading whitespace in the string before the number and ignoring whitespace after the number. If the string does not match this pattern, then the string is converted to NaN.
* Boolean true is converted to 1. False is converted to 0.
* A node-set is first converted to a string as if by a call to the string() function and then converted in the same way as a string argument.
* An object of a type other than the four basic types is converted to a number in a way that is dependent on that type.
### Defined

XPath 1.0 4.4

### Gecko support

Supported.
round
=====

The `round` function returns a number that is the nearest integer to the given number.

### Syntax
```

round( decimal )
```

### Arguments

`decimal`

The decimal number to be rounded.

### Returns

The nearest integer less then, greater than, or equal to `decimal`.

### Notes

* -0.5 rounds to negative zero. 0.4 rounds to positive zero.
### Defined

XPath 1.0 4.4

### Gecko support

Supported.
lang
====

The `lang` function determines whether the context node matches the given language and returns boolean true or false.

### Syntax
```

lang(string )
```

### Arguments

`string`

The language code or localization (language and country) code to be matched.

### Returns

`true` if the context node matches the given languages. Otherwise, `false`.

### Notes

* A node's language is determined by its `xml:lang` attribute. If the current node does not have an `xml:lang` attribute, then the value of the `xml:lang` attribute of the nearest ancestor that has an `xml:lang` attribute will determine the current node's language. If the language cannot be determined (no ancestor has an `xml:lang` attribute), this function will return false.
* If the given `string` does not specify a country code, this function will match nodes of that language with any country code. The converse is not true.

Given this fragment of XML:


```xml
<p xml:lang="en">I went up a floor.</p>
<p xml:lang="en-GB">I took the lift.</p>
<p xml:lang="en-US">I rode the elevator.</p>
```


And this part of an XSL template:


```xml
<xsl:value-of select="count(//p[lang('en')])" />
<xsl:value-of select="count(//p[lang('en-GB')])" />
<xsl:value-of select="count(//p[lang('en-US')])" />
<xsl:value-of select="count(//p[lang('de')])" />
```


The output might be:
```

3
1
1
0
```

### Defined

XPath 1.0 4.3

### Gecko support

Supported.
sum
===

The `sum` function returns a number that is the sum of the numeric values of each node in a given node-set.

### Syntax
```

sum(node-set)
```

### Arguments

`node-set`

The node-set to be evaluated. Each node in this node-set is evaluated as if it were passed to the number() function, and a sum of the resulting numbers is returned.

### Returns

A number.

### Notes

None.

### Defined

XPath 1.0 4.3

### Gecko support

Supported.
name
====

The `name` function returns a string representing the QName of the first node in a given node-set.

### Syntax
```

name( [node-set] )
```

### Arguments

`node-set` (optional)

The QName of the first node in this node-set will be returned. If this argument is omitted, the current context node will be used.

### Returns

A string representing the QName of a node.

### Notes

* The QName is the node's qualified name, including its namespace prefix and its local name.
### Defined

XPath 1.0 4.1

### Gecko support

Supported.
contains
========

The `contains` function determines whether the first argument string contains the second argument string and returns boolean true or false.

### Syntax
```

contains(haystack, needle)
```

### Arguments

`haystack`

The string to be searched

`needle`

The string to look for as a substring of `haystack`

### Returns

`true` if `haystack` contains `needle`. Otherwise, `false`.

### Defined

XPath 1.0 4.2

### Gecko support

Supported.
false
=====

The `false` function returns boolean false.

### Syntax
```

false()
```

### Returns

Boolean `false`.

### Notes

This function is useful part of a comparison:


```xml
<xsl:if test="boolean((1 &gt; 2) = false())">
  The expression evaluates as true
</xsl:if>
```

### Defined

XPath 1.0 4.3

### Gecko support

Supported.
unparsed-entity-url
===================

The `unparsed-entity-url()` function returns the URI of the unparsed entity with the given name. This is non-XML data referenced in the DTD of the source document.

### Syntax
```

string unparsed-entity-url(string)
```

### Arguments

The name of the unparsed entity. If the argument is not a string, it is converted using the rules of the string() function. The name should be an XML Name.

### Returns

The URI of the unparsed entity retrieved from the DTD, if it exists. Otherwise an empty string.

### Defined

XSLT 1.0 12.4

### Gecko support

Not supported.
string-length
=============

The `string-length` function returns a number equal to the number of characters in a given string.

### Syntax
```

string-length( [string] )
```

### Arguments

`string` (optional)

The string to evaluate. If omitted, string used will be the same as the context node converted to a string.

### Returns

An integer equal to the number of characters in the string.

### Defined

XPath 1.0 4.2

### Gecko support

Supported.
function-available
==================

The `function-available` function determines if a given function is available and returns boolean true or false.

### Syntax
```

function-available( name )
```

### Arguments

`name`

The name of the function to test.

### Returns

Boolean `true` or `false`.

### Defined

XSLT 1.0 15

### Gecko support

Supported.
normalize-space
===============

The `normalize-space` function strips leading and trailing white-space from a string, replaces sequences of whitespace characters by a single space, and returns the resulting string.

### Syntax
```

normalize-space( [string] )
```

### Arguments

`string` (optional)

The string to be normalized. If omitted, string used will be the same as the context node converted to a string.

### Returns

The normalized string.

### Defined

XPath 1.0 4.2

### Gecko support

Supported.
namespace-uri
=============

The `namespace-uri` function returns a string representing the namespace URI of the first node in a given node-set.

### Syntax
```

namespace-uri( [node-set] )
```

### Arguments

`node-set` (optional)

The namespace URI of the first node in this node-set will be returned. If this argument is omitted, the current context node will be used.

### Returns

A string representing URI of the namespace in which the given node resides.

### Notes

* If the given node does not have a specified namespace, the returned string will be an empty string.
* For nodes other than element and attribute nodes, the returned string will always be an empty string.
### Defined

XPath 1.0 4.1

### Gecko support

Supported.
last
====

The `last` function returns a number equal to the context size from the expression evaluation context.

### Syntax
```

last()
```

### Returns

An integer equal to the context size from the expression evaluation context.

### Notes

* This is often used with the position() function to determine if a particular node is the last in a node-set.
### Defined

XPath 1.0 4.1

### Gecko support

Supported.
element-available
=================

The `element-available` function determines if an element is available and returns true or false.

### Syntax
```

element-available( QName )
```

### Arguments

`QName`

Must evaluate to a valid QName. The QName is expanded into an expanded-name using the namespace declarations in scope for the expression.

### Returns

Returns true if and only if the expanded-name is the name of an instruction. If the expanded-name has a namespace URI equal to the XSLT namespace URI, then it refers to an element defined by XSLT. Otherwise, it refers to an extension element. If the expanded-name has a null namespace URI, the element-available function will return false.

### Defined

XSLT 1.0 15

### Gecko support

Supported.
generate-id
===========

The `generate-id` function generates a unique id for the first node in a given node-set and returns a string containing that id.

### Syntax
```

generate-id( [node-set] )
```

### Arguments

`node-set` (optional)

An id will be generated for the first node in this node-set. If omitted, the current context node will be used.

### Returns

A string containing the generated id.

### Notes

* The same id must be generated every time for the same node in the current document in the current transformation.
* The generated id may not be the same in subsequent transformations.

This function is an XSLT-specific addition to XPath. It is not a part of the core XPath function library.

### Defined

XSLT 1.0 12.4

### Gecko support

Supported.
substring-before
================

The `substring-before` function returns a string that is the part of a given string before a given substring.

### Syntax
```

substring-before( haystack, needle )
```

### Arguments

`haystack`

The string to be evaluated. Part of this string will be returned.

`needle`

The substring to search for. Everything before the first occurrence of `needle` in `haystack` will be returned.

### Returns

A string.

### Examples

| XPath Example | Output |
| --- | --- |
| `substring-before('aa-bb','-')` | `aa` |
| `substring-before('aa-bb','a')` | `(empty string)` |
| `substring-before('aa-bb','b')` | `aa-` |
| `substring-before('aa-bb','q')` | (empty string) |

### Defined

XPath 1.0 4.2

### Gecko support

Supported.
count
=====

The `count` function counts the number of nodes in a node-set and returns an integer.

### Syntax
```

count( node-set )
```

### Arguments

`node-set`

The node set to be counted.

### Returns

An integer representing the number of nodes in a node-set.

### Defined

XPath 1.0 4.1

### Gecko support

Supported.
string
======

The `string` function converts the given argument to a string.

### Syntax
```

string( [object] )
```

### Arguments

`object` (optional)

The object to convert to a string. If omitted, the context node is used.

### Returns

A string

### Notes

* If the object is a node-set, the string value of the first node in the set is returned.
* A number is converted as follows:
    + NaN is converted to the string NaN.
    + Positive zero is converted to the string 0.
    + Negative zero is converted to the string 0.
    + Positive infinity is converted to the string Infinity.
    + Negative infinity is converted to the string -Infinity.
    + Decimal numbers between -1 and 1 are converted to a string with a single leading 0 before the decimal point.
    + Boolean true is converted to the string true.
    + Boolean false is converted to the string false.
### Defined

XPath 1.0 4.2

### Gecko support

Supported.
substring
=========

The `substring` function returns a part of a given string.

### Syntax
```

substring(string, start)
substring(string, start, length)
```

### Arguments

`string`

The string to evaluate.

`start`

The position within `string` the substring begins

`length` Optional

 The length of the substring.
 If omitted, the returned string will contain every character from the `start` position to the end of `string`.


### Returns

A string.

### Notes

As in other XPath functions, the position is not zero-based. The first character in the string has a position of 1, not 0.

### Defined

XPath 1.0 4.2

### Gecko support

Supported.