One of the major challenges in finite element methods is the mitigation of spurious oscillations near sharp layers and discontinuities known as the Gibbs phenomenon. In this article, we propose a set of functionals to identify spurious oscillations in best approximation problems in finite element spaces. Subsequently, we adopt these functionals in the formulation of constraints in an effort to eliminate the Gibbs phenomenon. By enforcing these constraints in best approximation problems, we can entirely eliminate over-and undershoot in one dimensional continuous approximations, and significantly suppress them in one-and higher-dimensional discontinuous approximations.