jquery - Enlarge font-size in % for all texts with single rule? -
i work e-shop engine lot of text-styles defined in pixels directly (each element - own ruler), not in relative units. customer ask me enlarge texts (texts, labels, titles , such) on 10%. don't want go throw styles , write individual new rules each element.
so i looking solution can enlarge font-size elements simple rules in css, or, if it's impossible jquery
i tried use in css rule * { font-size: 110% !important; } works recursively (ancestor -> child -> child - each level +10%) text elements have several ancestors became realy huge.
so used code lukasz dziedzia's answer text in page.
now use $(this).css({ "font-size":($(this).css("font-size").replace('px','')*1.1 + "px"}); change font-size of each element.
notice use of replace('px','');, used here because $(this).css("font-size") returns value letters "px" @ end. after removing these 2 letters can math : $(this).css("font-size").replace('px','')*1.1.
this better first answer :)
fiddle: http://jsfiddle.net/dqsnk/4/
Comments
Post a Comment