1) In liquid, hydrogen bonds are weak, so water is the shape of the container. The molecules have no order, and very transient h bonds.
2) In solid, the low temperature causes very low kinetic energy, so the h bonds are strong enough to hold molecules in place. thThe average distance between each water molecule is larger, so ice is less dense than liquid water.
3) gas - less order, and has very few h bonds because the molecules are moving so fast that they can't get close enough to each other to h bond.