Define a Section

<section> tag ဟာ ပံုမွႏ္ အားျဖင့္ web page မွာ အုပ္စုတစ္ခု အေနနဲ႕ ဖြဲ႕ဖို႕ အတြက္ အသံုးျပဳပါတယ္။ <section> tag ထဲမွာ ပံုမွန္အားျဖင့္ content ေတြ ပါဝင္တတ္ပါတယ္။ Single page website ေတြမွာ ဆုိရင္ section tag နဲ႕ အပိုင္းေတြ ခြဲျပီး သံုးတတ္ပါတယ္။ HTML 5 မွာ section tag ဟာ div tag ထက္ ပိုျပီး အေသးစိတ္အေၾကာင္းအရာေတြ ပါဝင္တယ္လုိ႕ ဆုိႏိုင္တယ္။ ဥပမာ <article> tag ဆုိရင္ blog post ေတြ သတင္း အေၾကာင္းအရာေတြ ေရးသားထားတယ္လုိ႕ ဆိုႏိုင္ပါတယ္။ <nav> ဆုိရင္ေတာ့ navigation link ေတြ ျဖစ္တယ္ဆိုတာကို သိႏို္ငပါတယ္။

<html>
<head>
  <meta charset="utf8">
  <title>Section</title>
</head>
<body>
  <h1>One Piece</h1>
  <section id="intro">
    <p>One Piece is a Japanese manga series written and illustrated by Eiichiro Oda. It has been serialized in Weekly Shōnen Jump since August 4, 1997; the individual chapters are being published in tankōbon volumes by Shueisha, with the first released on December 24, 1997, and the 73rd volume released as of March 2014. One Piece follows the adventures of Monkey D. Luffy, a young boy whose body gains the properties of rubber after unintentionally eating a Devil Fruit, and his diverse crew of pirates, named the Straw Hat Pirates. Luffy explores the ocean in search of the world's ultimate treasure known as One Piece in order to become the next Pirate King.</p>
  </section>
</body>
</html>

အဲဒီ code ဟာ browser မွာ ဆုိရင္ ပံုမွန္ div နဲ႕ အသံုးျပဳထားသလို ဘာမွ ထူးထူးျခားျခား မေျပာင္းလဲပါဘူး။

ကၽြန္ေတာ္တုိ႕ section အတြက္ margin ေလးထည့္ၾကည့္ရေအာင္။

<html>
<head>
  <meta charset="utf8">
  <title>Section</title>
  <style>
  section#intro {
    margin-left:20px;
  }
  </style>
</head>
<body>
  <h1>One Piece</h1>
  <section id="intro">
    <p>One Piece is a Japanese manga series written and illustrated by Eiichiro Oda. It has been serialized in Weekly Shōnen Jump since August 4, 1997; the individual chapters are being published in tankōbon volumes by Shueisha, with the first released on December 24, 1997, and the 73rd volume released as of March 2014. One Piece follows the adventures of Monkey D. Luffy, a young boy whose body gains the properties of rubber after unintentionally eating a Devil Fruit, and his diverse crew of pirates, named the Straw Hat Pirates. Luffy explores the ocean in search of the world's ultimate treasure known as One Piece in order to become the next Pirate King.</p>
  </section>
</body>
</html>

အဲဒါဆုိရင္ေတာ့ ဘယ္ဘက္ကေန 20px ကြာသြားတာကို ေတြ႕ရပါလိမ့္မယ္။

Figure 9-1

Figure 9-1

ဘာေၾကာင့္ semantic tags ဟာ အေရးပါလဲ ?

HTML မွာ structure နဲ႕ ပတ္သက္ျပီးေတာ့ သတ္သတ္မွတ္မွတ္ မရိွခဲ့ပါဘူး။ ဥပမာ။ page header ကိုလည္း <div> အသံုးျပဳျပီးေတာ့ class သို႕မဟုတ္ id name ကို header လို႕ေပးျပီး အသံုးျပဳၾကတယ္။ HTML 5 မွာ ေတာ့ header , navgitation , footer နဲ႕ အျခား element ေတြဟာ tag အေနနဲ႕ သတ္သတ္မွတ္မွတ္ရိွလာပါတယ္။ အဲဒါေၾကာင့္ ပိုျပီး နားလည္မႈ လြယ္ကူျပီးေတာ့ web designer ေတြ အေနနဲ႕လည္း code ေရးရတာ ပိုျပီး ရွင္းလင္းသြားပါတယ္။

results matching ""

    No results matching ""