ホーム HTML CSS XML JAVASCRIPT   PHP SQL MORE...   リファレンス 事例集    

HTML5 チュートリアル

HTML5 ホーム
HTML5 概要
HTML5 新しい要素
HTML5 ビデオ
HTML5 ビデオ/DOM
HTML5 オーディオ
HTML5 キャンバス
HTML5 Geolocation
HTML5 Web ストレージ

HTML5 フォーム

HTML5 Input タイプ
HTML5 フォーム要素
HTML5 フォーム属性

HTML5 リファレンス

HTML5 タグ
HTML5 属性
HTML5 イベント
HTML5 キャンバス 2d
HTML 妥当な DTD

HTML5 タグ

<!-->
<a>
<abbr>
<acronym>
<address>
<applet>
<area>
<article>
<aside>
<audio>
<b>
<base>
<basefont>
<bdi>
<bdo>
<big>
<blockquote>
<body>
<br>
<button>
<canvas>
<caption>
<center>
<cite>
<code>
<col>
<colgroup>
<command>
<datalist>
<dd>
<del>
<details>
<dfn>
<dir>
<div>
<dl>
<dt>
<em>
<embed>
<fieldset>
<figcaption>
<figure>
<font>
<footer>
<form>
<frame>
<frameset>
<h1> - <h6>
<head>
<header>
<hgroup>
<hr>
<html>
<i>
<iframe>
<img>
<input>
<ins>
<keygen>
<kbd>
<label>
<legend>
<li>
<link>
<map>
<mark>
<menu>
<meta>
<meter>
<nav>
<noframes>
<noscript>
<object>
<ol>
<optgroup>
<option>
<output>
<p>
<param>
<pre>
<progress>
<q>
<rp>
<rt>
<ruby>
<s>
<samp>
<script>
<section>
<select>
<small>
<source>
<span>
<strike>
<strong>
<style>
<sub>
<summary>
<sup>
<table>
<tbody>
<td>
<textarea>
<tfoot>
<th>
<thead>
<time>
<title>
<tr>
<track>
<tt>
<u>
<ul>
<var>
<video>
<wbr>

HTML5 canvas font 属性

HTML5 track Tag Reference HTML5 canvas リファレンス

フォント "Arial" を使用して、キャンバスへ高さ 30px の "Hello World" 書出します:

あなたのブラウザは canvas タグをサポートしていません。

JavaScript:

var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
ctx.font="30px Arial";
ctx.fillText("Hello World",10,50);

Try it yourself »

定義と用法

font 属性は、キャンバスに書くテキストの font プロパティ指定を可能にします。

font 属性は、 CSS フォント・プロパティと同じ構文を使用します。

デフォルト値: 10px sans-serif
JavaScript 構文: context.font="italic small-caps bold 12px arial";


ブラウザ・サポート

Internet Explorer Firefox Opera Google Chrome Safari

font 属性は、主要な全ブラウザがサポートしています。


属性値

説明 Play it
font-style フォントのスタイルを指定する Play it »
font-variant フォントのバリアントを指定する Play it »
font-weight フォントの太さを指定する Play it »
font-size/line-height フォントサイズと行の高さを指定する Play it »
font-family フォントファミリを指定する Play it »
caption キャプション・コントロール(ボタン、ドロップダウンなど)に使用しているフォントを使用する Play it »
icon アイコンのラベルで使用しているフォントを使用する Play it »
menu ドロップダウンメニューで使用しているフォントを使用する Play it »
message-box ダイアログボックスで使用しているフォントを使用する Play it »
small-caption キャプションのフォントの縮小版 Play it »
status-bar ステータスバーで使用しているフォントを使用する Play it »

HTML5 track Tag Reference HTML5 canvas リファレンス