Question

does anyone know of a combination of function to pass on font-size from one element to another.

Let's say my 'p' font-size is set at 90% and I want my font-size to be 1.5 larger than that, so in percentages that's 135%. (Like 150% is 1.5 larger than 100%). Is there a way in jquery or php to do so?

I'm quite new to all this.. I've tried the following in php but would'nt know how to use it for font-size.

$old = '90%';

    $new = ((int) rtrim($old, '')) * 1.5;

    echo $new.'%';

But it seems to me there must be something in jquery that could help me..

Anyone? Thanks in advance!

Was it helpful?

Solution

Here's a solution using PHP:

<?php
    $old_size = '90';
    $new_size = $old_size * 1.5;
?>

<p style='font-size:<?=$old_size?>%'>This is the old size</p>

<p style='font-size:<?=$new_size?>%'>This is the new size</p>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top