<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Sealyu

    --- 博客已遷移至: http://www.sealyu.com/blog

      BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
      618 隨筆 :: 87 文章 :: 225 評論 :: 0 Trackbacks

    Many past web designers would love to create web design using table and it has been the Achilles point for web developers when it comes to debugging. Now, however when it come to listing data on a web page, example listing data of a profile, many people would use a HTML table instead. In fact, by using HTML dl, dt, dd tags, you will save on writing more codes and add more semantic value to the content. Whereas table are best use for tabular data, and should not be use in listing data, web form or web layout.

    If you are still creating list data using table, look below and compare on how to make your life easier with HTML dl, dt, dd tags.

    DL, DT, DD Tags vs Table

    Live Demo | Download Demo

    It may both look identical, but look closely behind the codes.

    Table List Data

    A typical listing data using table can be as follow. First we have a tr table row to hold the title and the data td table cell. Then when we need to style the title element, we will need to give a class to that td table cell.

    01.<table>
    02.    <tr>
    03.        <td class="title">Name: </td>
    04.        <td class="text">John Don</td>
    05.    </tr>
    06.    <tr>
    07.        <td class="title">Age: </td>
    08.        <td class="text">23</td>
    09.    </tr>
    10.    <tr>
    11.        <td class="title">Gender: </td>
    12.        <td class="text">Male</td>
    13.    </tr>
    14.    <tr>
    15.        <td class="title">Day of Birth:</td>
    16.        <td class="text">12th May 1986</td>
    17.    </tr>
    18.</table>

    So over here in the CSS, we style the title class that we had declare in the HTML.

    01./*TABLE LIST DATA*/
    02.table {
    03.    margin-bottom:50px;
    04.}
    05. 
    06.table tr .title {
    07.    background:#5f9be3;
    08.    color:#fff;
    09.    font-weight:bold;
    10.    padding:5px;
    11.    width:100px;
    12.}
    13. 
    14.table tr .text {
    15.    padding-left:10px;
    16.}

    From here you can see that if you want to change the design or format for the title in the CSS, you will need to give each td for the title a class. If you want to style the data as well, you will need to give a class to it as well, so you are actually writing a lot of codes. More codes mean larger file size to download, more chances for bugs and harder for you to maintain.

    DL, DT, DD List Data

    Now, let's look at using HTML dl, dt, dd tags for listing the data. First we have the dl (definition list) tag to hold the whole set of data, next we have dt (defines the item in the list) tag and dd (describes the item in the list) tag to hold the title and the data.

    01.<dl>
    02.    <dt>Name: </dt>
    03.    <dd>John Don</dd>
    04. 
    05.    <dt>Age: </dt>
    06.    <dd>23</dd>
    07. 
    08.    <dt>Gender: </dt>
    09.    <dd>Male</dd>
    10. 
    11.    <dt>Day of Birth:</dt>
    12.    <dd>12th May 1986</dd>
    13.</dl>

    Over at CSS, we will need to float the dt tag, so that the title for the list data will align to the left. The rest of the styling is up to you.

    01./*DL, DT, DD TAGS LIST DATA*/
    02.dl {
    03.    margin-bottom:50px;
    04.}
    05. 
    06.dl dt {
    07.    background:#5f9be3;
    08.    color:#fff;
    09.    float:left;
    10.    font-weight:bold;
    11.    margin-right:10px;
    12.    padding:5px;
    13.    width:100px;
    14.}
    15. 
    16.dl dd {
    17.    margin:2px 0;
    18.    padding:5px 0;
    19.}

    From dl, dt, dd tags example, you can see that the codes are lesser, sleeker and much more semantic.

    Live Demo | Download Demo

    So if you are still using table to consolidate or list your data on the web form and web layout, it's really time now to make the switch. It's definitely going to make your life a lot more easier.

    posted on 2009-09-24 09:53 seal 閱讀(339) 評論(0)  編輯  收藏 所屬分類: webCSS
    主站蜘蛛池模板: 成年人免费网站在线观看| 亚洲国产精品人人做人人爽 | 亚洲国产日韩女人aaaaaa毛片在线| 99在线观看精品免费99| 亚洲AV成人影视在线观看| 亚洲&#228;v永久无码精品天堂久久| 中文字幕在线免费播放| 亚洲性线免费观看视频成熟| 亚洲精品线路一在线观看| 99在线观看精品免费99| 国产亚洲精品免费| 亚洲午夜精品久久久久久人妖| 成在线人永久免费视频播放| 久久久久久AV无码免费网站| 亚洲精品无AMM毛片| 亚洲自偷自偷精品| 亚洲国产成人精品无码久久久久久综合 | 亚洲人成网站999久久久综合| 亚洲线精品一区二区三区| 999久久久免费精品国产| 国产精品高清免费网站 | 亚洲aⅴ无码专区在线观看| 婷婷亚洲久悠悠色悠在线播放| 啦啦啦www免费视频| 午夜网站在线观看免费完整高清观看| 亚洲精品无码少妇30P| 亚洲精品福利视频| 亚洲欧洲国产成人综合在线观看| 无人在线直播免费观看| 在线观看黄片免费入口不卡| 亚洲av无码一区二区三区天堂| 亚洲色图黄色小说| 亚洲人成人77777网站| 国产婷婷高清在线观看免费| 亚洲一区免费视频| 午夜视频免费在线观看| h片在线观看免费| 特级毛片A级毛片100免费播放| 亚洲依依成人亚洲社区| 亚洲最大的成网4438| 亚洲乳大丰满中文字幕|