HTML ²¼¾Ö
ÍøÕ¾³£³£ÒÔ¶àÁÐÏÔʾÄÚÈÝ£¨¾ÍÏñÔÓÖ¾ºÍ±¨Ö½£©¡£
ʹÓà <div> ÔªËØµÄ HTML ²¼¾Ö
×¢ÊÍ£º<div> ÔªËØ³£ÓÃ×÷²¼¾Ö¹¤¾ß£¬ÒòΪÄܹ»ÇáËɵØÍ¨¹ý CSS ¶ÔÆä½øÐж¨Î»¡£
Õâ¸öÀý×ÓʹÓÃÁËËĸö <div> ÔªËØÀ´´´½¨¶àÁв¼¾Ö£º
ʵÀý
<body> <div id="header"> <h1>City Gallery</h1> </div> <div id="nav"> London<br> Paris<br> Tokyo<br> </div> <div id="section"> <h1>London</h1> <p> London is the capital city of England. It is the most populous city in the United Kingdom, with a metropolitan area of over 13 million inhabitants. </p> <p> Standing on the River Thames, London has been a major settlement for two millennia, its history going back to its founding by the Romans, who named it Londinium. </p> </div> <div id="footer"> Copyright W3School.com.cn </div> </body>
CSS£º
<style> #header { background-color:black; color:white; text-align:center; padding:5px; } #nav { line-height:30px; background-color:#eeeeee; height:300px; width:100px; float:left; padding:5px; } #section { width:350px; float:left; padding:10px; } #footer { background-color:black; color:white; clear:both; text-align:center; padding:5px; } </style>
ʹÓà HTML5 µÄÍøÕ¾²¼¾Ö
HTML5 ÌṩµÄÐÂÓïÒåÔªËØ¶¨ÒåÁËÍøÒ³µÄ²»Í¬²¿·Ö£º
HTML5 ÓïÒåÔªËØ
header | ¶¨ÒåÎĵµ»ò½ÚµÄҳü |
nav | ¶¨Òåµ¼º½Á´½ÓµÄÈÝÆ÷ |
section | ¶¨ÒåÎĵµÖÐµÄ½Ú |
article | ¶¨Òå¶ÀÁ¢µÄ×Ô°üº¬ÎÄÕ |
aside | ¶¨ÒåÄÚÈÝÖ®ÍâµÄÄÚÈÝ£¨±ÈÈç²àÀ¸£© |
footer | ¶¨ÒåÎĵµ»ò½ÚµÄÒ³½Å |
details | ¶¨Òå¶îÍâµÄϸ½Ú |
summary | ¶¨Òå details ÔªËØµÄ±êÌâ |
Õâ¸öÀý×ÓʹÓà <header>, <nav>, <section>, ÒÔ¼° <footer> À´´´½¨¶àÁв¼¾Ö£º
ʵÀý
<body> <header> <h1>City Gallery</h1> </header> <nav> London<br> Paris<br> Tokyo<br> </nav> <section> <h1>London</h1> <p> London is the capital city of England. It is the most populous city in the United Kingdom, with a metropolitan area of over 13 million inhabitants. </p> <p> Standing on the River Thames, London has been a major settlement for two millennia, its history going back to its founding by the Romans, who named it Londinium. </p> </section> <footer> Copyright W3School.com.cn </footer> </body>
CSS
<style> header { background-color:black; color:white; text-align:center; padding:5px; } nav { line-height:30px; background-color:#eeeeee; height:300px; width:100px; float:left; padding:5px; } section { width:350px; float:left; padding:10px; } footer { background-color:black; color:white; clear:both; text-align:center; padding:5px; }
ʹÓñí¸ñµÄ HTML ²¼¾Ö
×¢ÊÍ£º<table> ÔªËØ²»ÊÇ×÷Ϊ²¼¾Ö¹¤¾ß¶øÉè¼ÆµÄ¡£
<table> ÔªËØµÄ×÷ÓÃÊÇÏÔʾ±í¸ñ»¯µÄÊý¾Ý¡£
ʹÓà <table> ÔªËØÄܹ»È¡µÃ²¼¾ÖЧ¹û£¬ÒòΪÄܹ»Í¨¹ý CSS ÉèÖñí¸ñÔªËØµÄÑùʽ£º
ʵÀý
<body> <table class="lamp"> <tr> <th> <img src="/images/lamp.jpg" alt="Note" style="height:32px;width:32px"> </th> <td> The table element was not designed to be a layout tool. </td> </tr> </table> </body>
CSS
<style> table.lamp { width:100%; border:1px solid #d4d4d4; } table.lamp th, td { padding:10px; } table.lamp td { width:40px; } </style>