In the CSS code , I have set the height and width , margin and its position to relative to the menu class .
For the menu <li> I have to float it left with 25%. Now to the anchor tag nested in the menu class I have set its height and width to 100% with the position to relative.
To the first <li> of the menu class with the class name as active I have sets its background color.
Now to provide the transition effect to the slider class I had made its position to absolute and adjusted its height and width.
To this, I have set the transition to left for 0.4s with a different background-color.
Instead of applying the media query I have taken pseudo- elements i.e. the (nth-child) .
As in the example, I have taken four <li> so to each <li> (nth-child) whenever it has hovered, focused and active of the slider class , the background color changes to the left at different percentages with a particular order.
Hence, A responsive menu with the hover effect has been created.
Note:- The above code will run over all modern browsers such as on Firefox 7.0.1, Chrome 15.0, Internet Explorer 9.0 , Safari 5.1.1.