2018-09-01 22:35:20 +02:00
|
|
|
---
|
|
|
|
title: null
|
|
|
|
---
|
|
|
|
|
|
|
|
The value `null` is the only value of its type. It represents the absence of a
|
|
|
|
value, and is often returned by [functions][] to indicate the lack of a result.
|
|
|
|
|
|
|
|
[functions]: ../at-rules/function
|
|
|
|
|
|
|
|
<% example(autogen_css: false) do %>
|
2018-10-23 22:42:40 +02:00
|
|
|
@debug str-index("Helvetica Neue", "Roboto"); // null
|
|
|
|
@debug map-get(("large": 20px), "small"); // null
|
|
|
|
@debug &; // null
|
|
|
|
===
|
|
|
|
@debug str-index("Helvetica Neue", "Roboto") // null
|
|
|
|
@debug map-get(("large": 20px), "small") // null
|
|
|
|
@debug & // null
|
2018-09-01 22:35:20 +02:00
|
|
|
<% end %>
|
|
|
|
|
|
|
|
If a [list][] contains a `null`, that `null` is omitted from the generated CSS.
|
|
|
|
|
|
|
|
[list]: lists
|
|
|
|
|
|
|
|
<% example do %>
|
2018-10-23 22:42:40 +02:00
|
|
|
$fonts: ("serif": "Helvetica Neue", "monospace": "Consolas");
|
2018-09-01 22:35:20 +02:00
|
|
|
|
2018-10-23 22:42:40 +02:00
|
|
|
h3 {
|
|
|
|
font: 18px bold map-get($fonts, "sans");
|
|
|
|
}
|
|
|
|
===
|
|
|
|
$fonts: ("serif": "Helvetica Neue", "monospace": "Consolas")
|
2018-09-01 22:35:20 +02:00
|
|
|
|
2018-10-23 22:42:40 +02:00
|
|
|
h3
|
|
|
|
font: 18px bold map-get($fonts, "sans")
|
2018-09-01 22:35:20 +02:00
|
|
|
<% end %>
|
|
|
|
|
|
|
|
If a property value is `null`, that property is omitted entirely.
|
|
|
|
|
|
|
|
<% example do %>
|
2018-10-23 22:42:40 +02:00
|
|
|
$fonts: ("serif": "Helvetica Neue", "monospace": "Consolas");
|
2018-09-01 22:35:20 +02:00
|
|
|
|
2018-10-23 22:42:40 +02:00
|
|
|
h3 {
|
|
|
|
font: {
|
|
|
|
size: 18px;
|
|
|
|
weight: bold;
|
|
|
|
family: map-get($fonts, "sans");
|
|
|
|
}
|
2018-09-01 22:35:20 +02:00
|
|
|
}
|
2018-10-23 22:42:40 +02:00
|
|
|
===
|
|
|
|
$fonts: ("serif": "Helvetica Neue", "monospace": "Consolas")
|
2018-09-01 22:35:20 +02:00
|
|
|
|
2018-10-23 22:42:40 +02:00
|
|
|
h3
|
|
|
|
font:
|
|
|
|
size: 18px
|
|
|
|
weight: bold
|
|
|
|
family: map-get($fonts, "sans")
|
2018-09-01 22:35:20 +02:00
|
|
|
<% end %>
|
|
|
|
|
|
|
|
`null` is also [*falsey*][], which means it counts as `false` for any rules or
|
|
|
|
[operators][] that take booleans. This makes it easy to use values that can be
|
|
|
|
`null` as conditions for [`@if`][] and [`if()`][].
|
|
|
|
|
|
|
|
[*falsey*]: ../at-rules/control/if#truthiness-and-falsiness
|
|
|
|
[operators]: ../operators/boolean
|
|
|
|
[`@if`]: ../at-rules/control/if
|
|
|
|
[`if()`]: ../functions#if
|
|
|
|
|
|
|
|
<%= partial 'code-snippets/example-if-parent-selector' %>
|