tags:

views:

50

answers:

2

Why ul border is wider than table border? Why ul height isn't contain every li elements?

Thanks you very much for your helps...

alt text

    ul
    {
        font-family: Verdana;
        font-size: 8pt;
    }

    ul a
    {
        text-decoration: none;
        color: Black;
    }

    ul a:hover
    {
        text-decoration: underline;
    }

    table
    {
        background-color: Transparent;
        border-collapse: collapse;
    }
    table tr td
    {
        vertical-align: top;
        text-align: left;
        font: Verdana, Geneva, sans-serif;
        font-size: 12px;
    }

    #tblYayinAkisi
    {
        border:1px white solid;
        background-color: #222222;
        font-family: Verdana;
        color: #ffffff;
        vertical-align: middle;
        font-size: 10pt;
        width:100%;
    }

    #tblYayinAkisi th
    {
        background-color: Transparent;
        background-image: url(../images/bckSiyahGriTram.png);
        background-repeat: repeat-x;
        height: 20px;
        padding-left: 10px;
    }

    #tblYayinAkisi td
    {
        background-color: #222222;
    }

    #tblYayinAkisi td ul
    {
        border:1px white solid;
        width:100%;
        margin-left: 10px;
    }
    #tblYayinAkisi td ul li
    {
        clear:both;
        padding-top: 7px;
        list-style: none;
    }
    #tblYayinAkisi td ul li b
    {
        margin-right: 10px;
        float: left;
    }

    #tblYayinAkisi td ul li a
    {
        color: #ffffff;
        float: left;
    }

Full code:

    <html>
    <head>
        <style>
            body
            {
                background-color: Red;
            }
            ul
            {
                font-family: Verdana;
                font-size: 8pt;
            }
            ul a
            {
                text-decoration: none;
                color: Black;
            }
            ul a:hover
            {
                text-decoration: underline;
            }
            table
            {
                background-color: Transparent;
                border-collapse: collapse;
            }
            table tr td
            {
                vertical-align: top;
                text-align: left;
                font: Verdana, Geneva, sans-serif;
                font-size: 12px;
            }
            #tblYayinAkisi
            {
                border: 1px white solid;
                background-color: #222222;
                font-family: Verdana;
                color: #ffffff;
                vertical-align: middle;
                font-size: 10pt;
                width: 100%;
            }
            #tblYayinAkisi th
            {
                background-color: Transparent;
                background-image: url(../images/bckSiyahGriTram.png);
                background-repeat: repeat-x;
                height: 20px;
                padding-left: 10px;
            }
            #tblYayinAkisi td
            {
                background-color: #222222;
            }
            #tblYayinAkisi td ul
            {
                border: 1px white solid;
                width: 100%;
                margin-left: 10px;
            }
            #tblYayinAkisi td ul li
            {
                clear: both;
                padding-top: 7px;
                list-style: none;
            }
            #tblYayinAkisi td ul li b
            {
                margin-right: 10px;
                float: left;
            }
            #tblYayinAkisi td ul li a
            {
                color: #ffffff;
                float: left;
            }
        </style>
    </head>
    <body>
        <table id="tblYayinAkisi">
            <tbody>
                <tr>
                    <th>
                        YABAN'da bugün
                    </th>
                </tr>
                <tr>
                    <td>
                        <ul>
                            <li><b>00:00</b><a target="_blank" href="programlar.aspx?id=24">TROFE ODASI</a></li>
                            <li><b>01:00</b><a target="_blank" href="programlar.aspx?id=17">YERLİ YABAN</a></li>
                            <li><b>01:30</b><a target="_blank" href="programlar.aspx?id=16">HEDEF</a></li>
                            <li><b>02:00</b><a target="_blank" href="programlar.aspx?id=28">İZCİ</a></li>
                            <li><b>02:30</b><a target="_blank" href="programlar.aspx?id=4">KUŞLAR</a></li>
                        </ul>
                    </td>
                </tr>
                <tr>
                    <td>
                        <div style="text-align: center;">
                            <img src="images/canliYayin.png" />
                            <img src="images/tumAkis.png" />
                        </div>
                        <br />
                    </td>
                </tr>
            </tbody>
        </table>
    </body>
    </html>
A: 

Just remove the 100% width for ul element, and add a right margin, like so:

 #tblYayinAkisi td ul
 {
     border: 1px white solid;
     margin-left: 10px;
     margin-right: 10px;
 }

That fixes the display in Firefox, and should work for other browsers.

Thilo
But ul is in the table. And if i add Width: 100%, it will have maximum width like table willn't it? Could you please express why?
uzay95
If you specify 100% plus left and right margins, that adds up to more than 100% of the enclosing element, at least in some browsers. Only specify 100% if it's not already the default, as it is for block level elements like ul.
Thilo
+1  A: 

The height problem occurs because you have both the b contents and a contents floating - this means that li element does not have any real (meaning: not floating) content. Remove floating from and you should be good to go.

Piotr Jakubowski
if b tag or any tags in li have float attribute, they willn't belong to li element?
uzay95
floating tags do belong to the li element, but they do not add their height to li height. Just found another solution - http://www.quirksmode.org/css/clearing.html - the overflow: auto thing.
Piotr Jakubowski