div[id^=canvas] { padding: 20px 20px 20px 20px; min-height: 180px; position: relative; margin-top: 47px; margin-left: 20px; } .pie-legend { list-style: none; position: absolute; right: 50px; top: 18px; } .pie-legend li span { display: block; position: absolute; left: 0; top: 0; width: 20px; height: 100%; border-radius: 5px; } .pie-legend li { display: block; padding-left: 30px; position: relative; margin-bottom: 4px; border-radius: 5px; padding: 2px 8px 2px 28px; font-size: 14px; cursor: default; -webkit-transition: background-color 200ms ease-in-out; -moz-transition: background-color 200ms ease-in-out; -o-transition: background-color 200ms ease-in-out; transition: background-color 200ms ease-in-out; }