To simplify your styling, you can utilize a script that adjusts your padding and font-size properties:
function customizeMenu(){
if ($('#containerHeader').exists()) {
var resizeObject = {
'0-640': '9px,2px,-3px',
'640-800': '10px,2px,-5px',
'800-1024': '10px,8px,-13px',
'1024-1300': '12px,12px,-13px',
'1300-2000': '14px,20px,-21px'
}
var win = $(window);
var win_width = win.width();
if (win_width > 0 && win_width <= 640) {
var value = getValueByKey(resizeObject, '0-640')
modifyMenu(value);
console.log(win_width + ' : ' + value);
}
else
if (win_width > 640 && win_width <= 800) {
var value = getValueByKey(resizeObject, '640-800')
modifyMenu(value);
console.log(win_width + ' : ' + value);
}
else
if (win_width > 800 && win_width <= 1024) {
var value = getValueByKey(resizeObject, '800-1024')
modifyMenu(value);
console.log(win_width + ' : ' + value);
}
else
if (win_width > 1024 && win_width <= 1300) {
var value = getValueByKey(resizeObject, '1024-1300')
modifyMenu(value);
console.log(win_width + ' : ' + value);
}
else
if (win_width > 1300 ) {
var value = getValueByKey(resizeObject, '1300-2000')
modifyMenu(value);
console.log(win_width + ' : ' + value);
}
}
}
function modifyMenu(value){
var vals = value.split(',')
$('#containerHeader').find('.roundMenuLi').each(function(index, item){
$(item).find('a').css('font-size', vals[0]);
$(item).css('padding-right', vals[1]);
$(item).css('padding-left', vals[1]);
$(item).find('ul').css('margin-left', vals[2]);
});
}
function getValueByKey(obj, myKey){
$.each(obj, function(key, value){
if (key == myKey) {
returnValue = value;
}
});
return returnValue;
}
-Start by defining your resolutions from 0-600 ... 1300-2000. In the modifyMenu function, assign properties for CSS: 0position-font, 1position-padding left&right, 2position margin left for the second ul level.
Call the script on:
<body onresize="customizeMenu();" onload="customizeMenu();">