It is common knowledge that one mole of ideal gas occupies a volume of 22.41 L at standard temperature and pressure (0°C and 1 atm). However, this goes against the claim that gases don't have a fixed volume. So what does it mean for a gas to "occupy" a certain volume under specific temperature and pressure? How is this observed/measured/experimentally found? Do the gas molecules stay relatively close to each other that the volume in which they are huddled together is said to be the volume they occupy?
When saying that a gas occupies 22.41 litres of volume at S.T.P. , it means that the gas is under constant pressure even though it's volume isn't kept fixed.
You are right that a gas expands to fill it's container, but that happens only when there is no pressure applied on gas.
Imagine it like this, there is a cylindrical container whose one circular end is fixed and at the other end is a piston which is free to move and is filled with a gas. If you apply a certain fixed force on the piston, gas will compress. As you decrease the force applied, the gas will occupy more and more volume and if you increase the force gas will occupy less volume.
Gas in atmosphere is constantly under pressure from the gas above it and also is under gravitational force, thus doesn't expand freely as a force is acting on it. If you release some gas in very less pressure environment, like in outer space, it will expand freely, if isn't under influence of any other force.
I would also like to point out that gas clouds in space, like nebulae also don't expand freely as their own gravity is stopping them.
Thus, it isn't that gas doesn't have a fix volume, but it doesn't have a fix volume if allowed to expand freely under no pressure.
Volume of gas is measured similarly as you would measure liquid, only the pressure, temperature and number of moles also need to be mentioned.
Besides if you think the volume of liquids(even solids) also vary with temperature and pressure so there also isn't a "perfect" way to measure volume. It's just that their rate change of volume with changing conditions is not as pronounced as that in gases as intermolecular forces which keep them together or apart is weaker in gases.
Yes gases have no fixed volume,but only in condition when no pressure is applied on them,and when they aren't under the the influence of any force,but in case of molar volume we are applying a condition of STP,which show that there is a constant pressure of 1atmosphere, so in this case volume can be calculated as a fix volume.