Important Announcement
PubHTML5 Scheduled Server Maintenance on (GMT) Sunday, June 26th, 2:00 am - 8:00 am.
PubHTML5 site will be inoperative during the times indicated!

Home Explore หน่วยที่2HTML

หน่วยที่2HTML

Published by วิรยา สีขาว, 2019-05-26 23:36:25

Description: หน่วยที่2HTML

Search

Read the Text Version

การสรา งตาราง (TABLE)

<table border = 5 width=100% bgcolor=“#ccaa00”> <caption align=\"top\">ตารางรายรบั รายจายประจําเดอื น </caption> <tr> <th>หวั ขอ </th><th>หัวขอ </th><th>หัวขอ</th> </tr> <tr> <td>ขอมลู </td> <td>ขอ มูล</td> <td>ขอ มูล</td> </tr> <tr> <td>ขอมูล</td> <td>ขอ มลู </td> <td>ขอ มลู </td> </tr> </table>

คาํ อธบิ าย รปู แบบ<table> .... </table> <table bgcolor=\"color\"> .... </table> กาํ หนดสพี นื้ ในตาราง <table border=\"pixels\"> .... </table> กาํ หนดขนาดขอบตาราง <table width=\"pixels/%\"> .... </table> กําหนดความกวาง การสรางตารางขอมลู โดยจะมคี าํ สัง่ ท่ีใชร ว มกันคอื คาํ สัง่ <TR> ในการสรา งแถวเซลลข อ มลู , คําสง่ั <TD> ในการสรา ง เซลลขอมูล, คําสง่ั <TH> ในการสรางหวั ตาราง

<body> <table border= 1 width=100% borderColor=steelblue> <tr width=\"30%\" bgColor=skyblue> <th>ลําดบั </th> <th>รายการ</th> <th>ราคา </th></tr> <tr> <TD width=\"30%“>1</TD><TD width=\"30%\">สบู </TD> <TD width=\"30%\">27.50</TD> </tr> <tr> <td>2</td><td>ผงซักฟอก </td><td>99.00</td></tr> </table></body>

การกาํ หนดขอ ความกาํ กบั ตาราง (table CAPTION)

<body><table border=1> <caption align=\"top\">ตารางรายรบั รายจายประจําเดอื น </caption> <tr> <th>เดอื น</th><th>มกราคม</th><th>กุมภาพันธ </th><th>มีนาคม</th></tr> <tr> <td>รายรับ </td><td>25000</td><td>23000</td><td>24500 </td></tr> <tr> <td>รายจาย </td><td>21000</td><td>22500</td><td>23100 </td></tr></table></body>

การกําหนดการจัดวางขอความ <TABLE BORDER=\"1\" WIDTH=\"95%\" HEIGHT=\"100\"> <TR> <TD align=\"left\" valign=\"top\">ซายบน</TD> <TD align=\"right\" valign=\"middle\">ขวากลาง </TD> </TR> <TR> <TD align=\"center\" valign=\"bottom\">กลางลาง </TD> <TD align=\"right\" valign=\"top\">ขวาบน</TD> </TR> </TABLE>

คําอธบิ าย ใชแ สดงคําอธิบาย หรือ ขอ ความประกอบตารางไว บนสว นบนหรือสว นลางของตารางขอ มลู รปู แบบ <caption align=\" top | bottom | left | right \"> กําหนดตําแหนงของคําอธบิ ายตาราง

การสรางหัวเรอ่ื งของตาราง (Table Heading) และ การสรางเซลลขอมลู (Table Data)

<br><br><table border=3> <tr> <th colspan=\"2\" bgcolor=\"#ffffe0\">CPU</th> <th colspan=\"2\">RAM</th> </tr> <tr> <td rowspan=\"2\">Mhz</td> <td>450</td> <td>500</td> <td>550</td> </tr> <tr> <td>600</td> <td>700</td> <td>750</td> </tr> </table>

คาํ อธบิ าย เปนการสรา งเซลล หวั ตาราง ซง่ึ ทาํ หนาท่ีกาํ กบั เซลขอ มลู ในแนวคอลมั นท ่ี กาํ หนด รปู แบบ<th align=\"left | right | center | justify | char\"> .... </th> กาํ หนดตาํ แหนงของขอ ความในตารางตามแนวนอน <th valign=\"top | middle | bottom | baseline\"> .... </th> กําหนดตาํ แหนง ของขอความในตารางตามแนวต้งั <th bgcolor=\"color\"> .... </th> กําหนดสพี นื้ ของตาราง <th height=\"pixels | %\"> .... </th> กําหนดความสูงของตาราง <th width=\"pixels | %\"> .... </th> กาํ หนดความกวางของตาราง <th rowspan=\"number\"> .... </th> กําหนดการรวมชองเซลลใ นแนวต้งั <th colspan=\"number\"> .... </th> กําหนดการรวมชองเซลลในแนวนอน

ใหน กั ศกึ ษาสรา งตารางดงั นี้ ตารางขายสนิ คา ลําดบั ช่ือสนิ คา จาํ นวน ราคา 1 2 3 4 รวมเปนเงนิ

The HTML Style Attribute  <tagname style=\"property:value;\">  ตัวอยา ง  <p style=\"color:red\">I am a paragraph.</p> 

The style Attribute  <!DOCTYPE html>  <html><body>  <h2>The style Attribute</h2>  <p>The style attribute is used to specify the styling of an element, like color:</p>  <p style=\"color:red\">I am a paragraph.</p>  </body>  </html>

 <!DOCTYPE html>  <html><body>  <p>I am normal</p>  <p style=\"color:red;\">I am red</p>  <p style=\"color:blue;\">I am blue</p>  <p style=\"font-size:50px;\">I am big</p>  </body></html>

HTML Background Color <!DOCTYPE html> <html> <body style=\"background-color:powderblue;\"> <h1>This is a heading</h1> <p>This is a paragraph.</p> </body></html>

HTML Text Color <!DOCTYPE html> <html><body> <h1 style=\"color:blue;\">This is a heading</h1> <p style=\"color:red;\">This is a paragraph.</p> </body></html>

HTML Fonts <!DOCTYPE html> <html><body> <h1 style=\"font-family:verdana;\">This is a heading</h1> <p style=\"font-family:courier;\">This is a paragraph.</p> </body></html>

HTML Text Size <!DOCTYPE html> <html><body> <h1 style=\"font-size:300%;\">This is a heading</h1> <p style=\"font-size:160%;\">This is a paragraph.</p> </body></html>

HTML Text Alignment <!DOCTYPE html> <html><body> <h1 style=\"text-align:center;\">Centered Heading</h1> <p style=\"text-align:center;\">Centered paragraph.</p> </body> </html>

The title Attribute  <!DOCTYPE html>  <html>  <body>  <h2 title=\"I'm a header\">The title Attribute</h2>  <p title=\"I'm a tooltip\">  Mouse over this paragraph, to display the title attribute as a tooltip.  </p></body></html>

Bigger Headings  <!DOCTYPE html>  <html><body>  <h1 style=\"font-size:60px;\">Heading 1</h1>  <p>You can change the size of a heading with the style attribute, using the font-size property.</p>  </body></html>

 <abbr> กําหนดคํายอหรือตวั ยอ <address> กาํ หนดขอมลู การตดิ ตอ สาํ หรับผเู ขียน / เจาของเอกสาร <bdo> กําหนดทิศทางขอ ความ <blockquote> กาํ หนดสวนทยี่ กมาจากแหลงอ่นื <cite> ระบุช่อื งาน <q> แสดงเครอ่ื งหมายคาํ พูด

HTML Colors  รูปแบบสีแบบพิเศษ ใน HTML ที่เพม่ิ ขน้ึ

 <html><body>  <h1 style=\"background-color:Tomato;\">Tomato</h1>  <h1 style=\"background-color:Orange;\">Orange</h1>  <h1 style=\"background- color:DodgerBlue;\">DodgerBlue</h1>  <h1 style=\"background- color:MediumSeaGreen;\">MediumSeaGreen</h1>  <h1 style=\"background-color:Gray;\">Gray</h1>  <h1 style=\"background-color:SlateBlue;\">SlateBlue</h1>  <h1 style=\"background-color:Violet;\">Violet</h1>  <h1 style=\"background- color:LightGray;\">LightGray</h1>  </body></html>

 <html><body>  <h3 style=\"color:Tomato;\">Hello World</h3>  <p style=\"color:DodgerBlue;\">test1</p>  <p style=\"color:MediumSeaGreen;\">test2</p>  <h1 style=\"border: 2px solid Tomato;\">Hello World</h1>  <h1 style=\"border: 2px solid DodgerBlue;\">Hello World</h1>  <h1 style=\"border: 2px solid Violet;\">Hello World</h1>  </body></html>

Color Values ตัวอยางการบอกคา สเี ปนระดับหมายเลขของโหมดสตี างๆ <h1 style=\"background-color:rgb(255, 99, 71);\">...</h1> <h1 style=\"background-color:#ff6347;\">...</h1> <h1 style=\"background-color:hsl(9, 100%, 64%);\">...</h1> <h1 style=\"background-color:rgba(255, 99, 71, 0.5);\">...</h1> <h1 style=\"background-color:hsla(9, 100%, 64%, 0.5);\">...</h1>



HSL Value  hsl(hue, saturation, lightness)  Hue is a degree on the color wheel from 0 to 360. 0 is red, 120 is green, and 240 is blue.  Saturation is a percentage value, 0% means a shade of gray, and 100% is the full color.  Lightness is also a percentage, 0% is black, 50% is neither light or dark, 100% is white

Saturation  Saturation can be described as the intensity of a color.  100% is pure color, no shades of gray  50% is 50% gray, but you can still see the color.  0% is completely gray, you can no longer see the color.

Lightness  The lightness of a color can be described as how much light you want to give the color, where 0% means no light (black), 50% means 50% light (neither dark nor light) 100% means full lightness (white).

 Shades of gray are often defined by setting the hue and saturation to 0, and adjust the lightness from 0% to 100% to get darker/lighter shades:

RGBA Value  RGBA is specified with:  rgba(red, green, blue, alpha)  The alpha parameter is a number between 0.0 (fully transparent) and 1.0 (not transparent at all):

HSLA Value  hsla(hue, saturation, lightness, alpha)

HTML <blockquote> for Quotations  <p>Here is a quote from WWF's website:</p> <blockquote cite=\"http://www.worldwildlife.org/who/index.html\"> For 50 years, WWF has been protecting the future of nature. The world's leading conservation organization, WWF works in 100 countries and is supported by 1.2 million members in the United States and close to 5 million globally. </blockquote>


Like this book? You can publish your book online for free in a few minutes!
Create your own flipbook