This example shows a CMOSNOR gate. The output is low whenever one or both of the inputs is high, and high otherwise. Click on the inputs (on the left) to toggle their state.
The MOSFETs act as switches. When one of the inputs is high, the corresponding n-MOSFETs switches on to connect the output to ground. If both inputs are low, the p-MOSFETs switch on to connect the output to +5V.