<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 :: 首頁(yè) :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
      618 隨筆 :: 87 文章 :: 225 評(píng)論 :: 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 閱讀(338) 評(píng)論(0)  編輯  收藏 所屬分類(lèi): webCSS
    主站蜘蛛池模板: 日本亚洲成高清一区二区三区| 日本媚薬痉挛在线观看免费| 亚洲成人免费电影| 亚洲av无码成人精品区| 亚欧在线精品免费观看一区| 性生大片视频免费观看一级| 亚洲一卡2卡4卡5卡6卡在线99| 亚洲视频在线一区二区| 亚洲精品免费在线| 国产精品久久久久久久久久免费| a一级爱做片免费| 亚洲AV色无码乱码在线观看| 亚洲丁香色婷婷综合欲色啪| 国产亚洲免费的视频看| 男女猛烈无遮掩视频免费软件| 久久久久国产成人精品亚洲午夜 | 中文字幕在线免费观看视频| 国产精品亚洲αv天堂无码| 免费无码又爽又高潮视频| 95老司机免费福利| 手机看片国产免费永久| a级毛片免费观看视频| 一级特黄特色的免费大片视频| 国产一区二区三区亚洲综合| 激情婷婷成人亚洲综合| 免费人成视频在线播放| 国产美女视频免费观看的网站 | 美女网站免费福利视频| 91精品国产免费久久久久久青草| 一级毛片免费观看| 在线精品免费视频无码的| 亚洲?V乱码久久精品蜜桃| 99re免费视频| 无码不卡亚洲成?人片| 国产AV无码专区亚洲AV手机麻豆 | 国产久爱免费精品视频| 波多野结衣在线免费观看| 国产一级特黄高清免费大片| 国产A在亚洲线播放| 亚洲av无码专区在线电影| 成人午夜影视全部免费看|