Note: my terminology is probably off, I'm from the Netherlands and I'm not used using English DIY terms. So these are the terms I'll be using:
- live: the wire that "gives power", the phase wire, the hot wire.
- neutral: opposite of live, the wire where "power flows off".
- earth: the protective wire, earth, ground, the "safety wire".
Important Edit: Please look at this
DIY SE question. @Tester101 (the guy with most rep on DIY SE) says you need to check the fine print on the dimmer. Also,
Using a standard dimmer with a ceiling fan can damage the motor, and/or cause the dimmer and/or motor to overheat and cause a fire. just like @ThreePhaseEel says in the comments and @Ed-beal in his answer. I only speak of personal experience (well, from colleagues), those three have a lot of questions answered on this site and probably have more experience.
Option 1 : use a special dimmer for both the fan and lamp
You can just use a dimmer switch to dim the light, however the speed of the fan will also be "dimmed". Make sure you use the right dimmer for your lamp, otherwise you can hear noise. Also check for minimum/maximum wattage.
Edit: This works for some people, not for all. I work in a retail shop and some customers and colleagues have this working setup. However, after seeing @Ed-beals answer and some Googling, I found out this doesn't work for all people. There are special dimmer-switches for ceiling fans, this is a better solution.
Option 2: use a switch for the fan and a dimmer for the light
There are probably three wires going into your ceiling fan, a live one, a neutral and an earth. When you open your fan, you should see that the live wire splits (with a wire connector). One wire goes to the lamp, the other goes to the motor. You can take out the one that goes to the lamp and connect it to the live wire of the dimmer. This way your light will be dimmed with the dimmer and the fan still worked the old way (with a regular switch I presume).