mercredi 12 février 2020

How can I alter the entire page text size in PHP/HTML?

I am trying to offer font size selection for accessibility purposes on my website. When the user clicks for example the small "A", it POSTS font-size=small in the URL.

Then, an if statement GETs the font-size and I would like to change the entire page:

<?PHP

$font_size = $_GET['font-size'];

if ($font_size=="small"){

  //this is incorrect and does not work
  document.body.style.fontSize='x-small';
}

?>

The HTML code below successfully changes the font size across the whole page, so how do I do the same thing in the PHP IF statement above?

<a href="#" onclick="document.body.style.fontSize='x-small';"> A </a>

Help is greatly appreciated.

Aucun commentaire:

Enregistrer un commentaire