Another question about CMOS tri-state buffer internal structure
Very roughly, the action of a MOSFET is controlled by the voltage between the gate and the source terminal. More detailed schematic symbols for MOSFETs make these two terminals look different:



In your circuit, the source is the one connected to the positive power supply node. The action is controlled by how far below the source is the gate voltage.