html - How can I improve cross browser compatibility of my CSS only slider menu? -
i have css menu, background must slide animation selected menu item:
.wrapper { font: 0/0 a; position: relative; white-space: nowrap; } .radio { -webkit-appearance: none; color: rgb(0, 0, 0); margin: 0 10px 0 0; outline: 0; padding-bottom: 10px; padding-top: 10px; position: relative; text-align: center; transition: color .5s linear; z-index: 2; } .radio:after { content: attr(data-text); } .radio:checked { color: rgb(255, 255, 255); } .bg { background: black; border-radius: 10px; bottom: 0; position: absolute; top: 0; transition: left .25s linear; z-index: 1; } .radio, .bg { width: 100px; } .radio:checked + .radio + .radio + .radio + .radio + .bg { left: 0; } .radio + .radio:checked + .radio + .radio + .radio + .bg { left: 110px; } .radio + .radio + .radio:checked + .radio + .radio + .bg { left: 220px; } .radio + .radio + .radio + .radio:checked + .radio + .bg { left: 330px; } .radio + .radio + .radio + .radio + .radio:checked + .bg { left: 440px; }
<div class="wrapper"> <input type="radio" class='radio' name="r" data-text="save" checked> <input type="radio" class='radio' name="r" data-text="fork"> <input type="radio" class='radio' name="r" data-text="info"> <input type="radio" class='radio' name="r" data-text="share"> <input type="radio" class='radio' name="r" data-text="edit"> <i class="bg"></i> </div>
i used radio
controls , checked
state in selectors , render text pseudo-elements of radio
. radio used -webkit-appearance: none
, fixed width.
the main point of menu - stay css only. , problems are:
- how can make menu more cross browser compatibility? (now works webkit only)
- i don't want use fixed width of navigation elements
code source more experiments.
how adding appearance css für other browsers?
.thing { -webkit-appearance: value; -moz-appearance: value; appearance: value; }
code here
Comments
Post a Comment