The problem of boundary bias is associated with kernel estimation for data with a compact support when the regression curve or density functions are discontinuous at the boundary points. This paper proposes a simple and unified approach for remedying boundary bias in nonparametric regression, without dividing the compact support into interior and boundary areas and without applying explicitly different smoothing treatments separately. The approach uses the beta family of density functions as kernels. The shapes of the kernels vary according to the position where the curve estimate is made. They are symmetric at the middle of the support interval, and become more and more asymmetric nearer the boundary points. The kernels never put any weight outside the data support interval, and thus avoid boundary bias. The method is a generalisation of classical Bernstein polynomials, one of the earliest methods of statistical smoothing. The proposed estimator have optimal mean integrated squared error at an order of magnitude equivalent to that of standard kernel estimators when the curve has an unbounded support.