font-family



Это список безопасных шрифтов:


  • Arial
  • Arial Black
  • Courier New
  • Comic Sans MS
  • Georgia
  • Impact
  • Times New Roman
  • Trebuchet MS
  • Verdana

значения свойства:


  • font name
  • family
  • inherit



css/style.css
  • p {
  •  font-size: 20px;
  • }
  •  
  • .a {
  •  font-family: Arial, Verdana;
  • }
  •  
  • .c {
  •  font-family: "Courier New";
  • }
p {
 font-size: 20px;
}

.a {
 font-family: Arial, Verdana;
}

.c {
 font-family: "Courier New";
}


index.html
  • <!DOCTYPE html>
  • <html>
  • <head>
  •  <meta charset="utf-8" />
  •  <title>New Page</title>
  •  <link href="css/style.css" rel="stylesheet" />
  •  <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
  • </head>
  • <body>
  •  <p class="a">Hello World!</p>
  •  <br />
  •  <p id="p1">Hello World!</p>
  •  <br />
  •  <p class ="b">Hello World!</p>
  •  <br />
  •  <p class="c">Hello World!</p>
  • <script>
  •  /*JavaScript*/
  •  document.getElementById("p1").style.fontFamily = "Georgia, Times New Roman";
  •  /*jQuery*/
  •  $(document).ready(function () {
  •   $(".b").css({ "font-family": "Comic Sans MS" });
  •  });
  • </script>
  • </body>
  • </html>
  • <!DOCTYPE html>
  • <html>
  • <head>
  •  <meta charset="utf-8" />
  •  <title>New Page</title>
  •  <link href="css/style.css" rel="stylesheet" />
  •  <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
  • </head>
  • <body>
  •  <p class="a">Hello World!</p>
  •  <br />
  •  <p id="p1">Hello World!</p>
  •  <br />
  •  <p class ="b">Hello World!</p>
  •  <br />
  •  <p class="c">Hello World!</p>
  • <script>
  •  /*JavaScript*/
  •  document.getElementById("p1").style.fontFamily = "Georgia, Times New Roman";
  •  /*jQuery*/
  •  $(document).ready(function () {
  •   $(".b").css({ "font-family": "Comic Sans MS" });
  •  });
  • </script>
  • </body>
  • </html>