Forum Moderators: open
<style>
.large { font-size: 16px }
p { font-size: 12px }
.small { font-size: 11px }
</style>
<main>
<section>
<div class="large">This is the title <span class="small">»</span></div>
<p>
Hey there, WebmasterWorld!
<br>
<span class="small">Nice place you have here</span>
</p>
</section>
</main> function defaultFontSize() {
var font_size = getCookie('font_size');
font_size = font_size || 12;
$('p').each(function() {
$(this).css({ fontSize : font_size });
});
} var font_size = getCookie('font_size');
font_size = font_size || 100;
$('section').css({ fontSize: font_size + '%' }); var font_size = getCookie('font_size');
font_size = font_size || 100;
$('p, div, span').each(function() {
$(this).css({ fontSize : font_size + '%' });
});
}
$('section *').each(function() {
var currSize = parseInt($(this).css('font-size'));
/* Double size */
var newSize = ((currSize * 200) / 100);
/* Debugging */
console.log($(this).prop("tagName") + ' current size = ' + currSize + ' new size = ' + newSize);
$(this).css('font-size', newSize);
});
if (font_size == 100)
$(this).css({ fontSize : '12px' });
else
$(this).css({ fontSize : font_size + '%' }); <div class="wrapper">
<section>
<div class="large">
<span class="small"></span>
</div>
</section>
</div>and .wrapper { font-size: 12px; }
section { font-size: 100%; }
.large { font-size: 120%; }
.small { font-size: 70%; }