In this paper we describe a new approach for developing adaptive Web based courses. These courses are defined by means of teaching tasks which correspond to basic knowledge units, and rules which describe how teaching tasks are divided into subtasks. Both tasks and rules are used at execution time to guide the students during their learning process by determining the set of achievable tasks to be presented to the student at every step. Adaptivity is implemented by presenting students with different HTML pages depending on their profile, their previous actions, and the active learning strategy. The HTML pages presented to the students are generated dynamically from general information about the type of media elements associated to each task and their layout. The whole approach is exemplified by means of a course on traffic signs.