初心者向けHTML入門の決定版:タグHTML

base要素・baseタグとは

Facebook にシェア
このエントリーをはてなブックマークに追加
Tweet

ドキュメントの基本URIを指定するbase要素

base要素はhead要素内で使用されます。空要素なので閉じタグはありません。

href属性を使って、HTMLドキュメントの基本URIを指定することができます。

基本URIとは、相対URIを解決する際の基準として働くものです。具体例として以下のサンプルを見てみましょう。

HTMLソースコード例

<html>
  <head>
    <title>test</title>
    <base href="http://example.com/dir01/">
  </head>
  <body>
    <p><a href="sample01.html">XXX</a></p>
  </body>
</html>

上記例において、絶対URIを “http://example.com/dir01/” に指定しています。a要素のリンク先は相対URIで記述されています。
そのため、a要素のリンク先は “http://example.com/dir01/sample01.html” と解釈されることになります。

もし上記例の、絶対URIを “http://example.com/” に指定した場合、a要素のリンク先は “http://example.com/sample01.html” と解釈されることになります。

HTML要素(タグ)一覧

a  abbr  acronym  address  applet  area  b  base  basefont  bdo  big  blockquote  body  br  button  caption  center  cite  code  col  colgroup  dd  del  dfn  dir  div  dl  dt  em  fieldset  font  form  frame  frameset  h1 - h6  head  hr  html  i  iframe  img  input  ins  isindex  kbd  label  legend  li  link  map  menu  meta  noframes  noscript  object  ol  optgroup  option  p  param  pre  q  s  samp  script  select  small  span  strike  strong  style  sub  sup  table  tbody  td  textarea  tfoot  th  thead  title  tr  tt  u  ul  var  <!-- --> 

ブロックレベル要素一覧

p  h1-h6  ul  ol  dir  menu  pre  dl  div  center  noscript  noframes  blockquote  form  isindex  hr  table  fieldset  address 

インライン(テキストレベル)要素一覧

フォントスタイルに関するもの
tt  i  b  big  small
フレーズ・句に関するもの
em  strong  dfn  code  samp  kbd  var  cite  abbr  acronym
特別なもの
a  img  object  br  script  map  q  sub  sup  span  bdo
フォームに関するもの
input  select  textarea  label  button 

  • sitemap
  • 運営者情報
  • 免責事項
designed by ホームページ制作のササエル
Copyright © tagHTML All Rights Reserved.