This example shows a CMOS NAND gate. The output is low whenever both inputs are high, and high otherwise. Click on the inputs (on the left) to toggle their state.
The MOSFETs act as switches. When both inputs are high, the n-MOSFETs switch on to connect the output to ground. If either input is low, the path to ground is cut off, and one of the p-MOSFETs switch on to connect the output to +5V.
Next: CMOS NOR
Previous: Inverter Oscillator