/

HTML / CSS / JavaScript Tutorial

CSS Property: column-fill

[this page | pdf | back links]

The CSS (CSS3) column-fill property specifies how to fill columns.

 

Valid property values (other than inherit and initial) are:

 

Value

Description

auto

Columns filled sequentially and therefore may have different lengths

balance

(default value). Columns are balanced and browsers should minimise variation in column length

 

Default Value:

balance

JavaScript syntax:

e.g. object.style.columnFill="auto"

Inherited:

No

Animatable:

No

 

EXAMPLE:


HTML USED IN THIS EXAMPLE:
<!DOCTYPE html>
<html> <!-- Copyright (c) Nematrian Limited 2018 -->
<head>
<style>
p {width: 200px; height: 90px; column-count: 2;}
p.x1 {column-fill: auto;}
</style>
</head>
<body>
Note: this style property is not supported by many browsers<br><br>
1. Element with default property<br>
<p>Some text that may be broken into several columns</p><br><br>
2. Element set using in-file HTML style
<p class="x1">Some text that may be broken into several columns</p><br><br>
3. Element set using JavaScript
<p id="x2">Some text that may be broken into several columns</p>

<script>
document.getElementById("x2").style.columnFill = "auto";
</script>

</body>
</html>

FUNCTION THAT MAY ASSIST IN TESTING WHETHER FEATURE IS SUPPORTED:
function isSupportedCSSPropertyColumnFill() {
  var x = document.createElement("DIV"); x.style.columnFill = "auto"; return (window.getComputedStyle(x, null).columnFill == "auto");
}


NAVIGATION LINKS
Contents | Prev | Next | CSS Properties


Desktop view | Switch to Mobile