<!DOCTYPE html>
<html>
<head>
<style>
div#main {
width: 220px;
height: 300px;
border: 1px solid black;
display: flex;
align-items: center;
}
div#main div {
flex: 1;
}
</style>
</head>
<body>
<h1>Change align-items with JavaScript</h1>
<div id="main">
<div style="background-color:coral;">RED</div>
<div style="background-color:lightblue;">BLUE</div>
<div style="background-color:lightgreen;">Green div with more content.</div>
</div>
<p>Click the "Try it" button to set the value of the alignItems property to "flex-start"</p>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction() {
document.getElementById("main").style.alignItems = "flex-start";
}
</script>
</body>
</html>