如何让我的网站上的字体更大,更容易为某些用户阅读?

Mik*_*keN 0 html css jquery layout

我有一些用户抱怨我的网络应用程序上的字体太小而无法阅读.他们不满意尝试在浏览器上调整字体设置的大小,因为当他们使字体变大时,应用程序的尺寸和布局会发生变化.是否有任何现有的工具可以让我有一个很好的方法让最终用户选择一个小/中/大字体大小,并将网站的.css更改为更大的字体大小而不影响页面的布局?

Jas*_*son 5

这是我在我的一些网站上使用的代码.相应地应用您的HTML:

HTML:

<span>Font Size: </span>
<a href="#" onclick="decreaseFontSize();">
    <img src="/images/minus.png" alt="Decrease Font Size" />
</a>

<a href="#" onclick="increaseFontSize();">
    <img src="/images/plus.png" alt="Increase Font Size" />
</a>
Run Code Online (Sandbox Code Playgroud)

使用Javascript:

var min=8;
var max=18;
function increaseFontSize() {
 p = document.getElementById("[the id of container w/font you want to size]");
 if(p.style.fontSize) {
 var s = parseInt(p.style.fontSize.replace("px",""));
 } else {
  var s = 12;
 }
 if(s!=max) {
  s += 1;
 }
 p.style.fontSize = s+"px"
}
function decreaseFontSize() {
 p = document.getElementById("[the id of container w/font you want to size]");
      if(p.style.fontSize) {
         var s = parseInt(p.style.fontSize.replace("px",""));
      } else {
         var s = 12;
      }
      if(s!=min) {
         s -= 1;
      }
      p.style.fontSize = s+"px" 
}
Run Code Online (Sandbox Code Playgroud)