How is a "Star Tracker" mounted on a spacecraft able to compute "absolute attitude"?
Modern star trackers are digital cameras coupled with sophisticated computer equipment that uses pattern matching techniques to determine which stars are in the image taken by the camera. The location of one star in the camera frame yields two pieces of information, which isn't quite enough to determine the orientation of the star tracker. Two stars are needed, at a minimum, providing four pieces of information. In practice, multiple stars are used and orientation is determined via a least squares filter.
Having the Sun or a bright planet in the field of view would damage the sensitive equipment. Star trackers typically use a sun sensor to close the shutter on the star tracker camera. Having the shutter closed means the star tracker is temporarily off-line. Some vehicles use multiple star trackers or star trackers with multiple heads because of this.
At least on the Shuttle orbiter, a predefined, known pair of stars was acquired in the two star trackers (one per tracker). This defined the vehicle's attitude since the position of the stars was known, and the position of the trackers in the vehicle was known. This was done because...
Alignment of the IMUs is required approximately every 12 hours to correct IMU drift, within one to two hours before major on-orbit thrusting duration or after a crewman optical alignment sight IMU alignment. IMU alignment is accomplished by using the star trackers to measure the line-of-sight vector to at least two stars. With this information, the GPC calculates the orientation between these stars and the orbiter to define the orbiter's attitude. A comparison of this attitude with the attitude measured by the IMU provides the correction factor necessary to null the IMU error.
IMU = inertial measurement unit GPC = general purpose computer
From here. (the references to how often the IMUs require alignment are from early in the program, before IMU upgrades).