body { display:flex; justify-content:center; align-items:center; flex-direction:column; } .rating { direction:rtl; width:125px; margin:20px; } .rating > span.s { display:inline-block; position:relative; width:1.5em; } .rating > span.s:hover:before,.rating > span.s:hover ~ span.s:before { content:"\2605"; color:red; position:absolute; } span.reds:before { content:"\2605"; color:red; position:absolute; }