td colspan width not working

时间:2015-05-12 22:59:34

标签: html css

"Empty"
table 
{
    width: 100%;
}
td:first-child
{
    width: 100px;
}

I do not quite understand why the first <table> <thead> <tr> <td colspan="2">A</td> <td>B</td> <td>C</td> </tr> </thead> </table> is not 100px wide and how can I do it exactly 100px with no JS?

3 个答案:

答案 0 :(得分:2)

You don't need to remove the GET https://forum-api.company.tld/grant_scope/[user_id]?scope=forum:admin:somegroupid to get this to work, as other's are suggesting, although that might be a valid/better idea, if it is not needed (in your example it isn't, since there is only one row, but perhaps this is for another situation where you need it)

You can use colspan to get it to respect your value. I also added table-layout: fixed; , to get the exact with down from padding: 0; to 102px, just for neatness sake:

100px
table 
{
    width: 100%;
    table-layout: fixed;
}
td {
    padding: 0;
}
td:first-child
{
    width: 100px;
}

答案 1 :(得分:0)

JSFiddle Remove public function addemail(){ //ini_set('display_errors','off'); $this->load->model('Model_email'); $this->Model_email->addemail($this->input->post('email')); } this multiplies your width value from your css.

HTML

colspan=2

CSS

<table>
  <thead>
    <tr>
        <td>A</td>
        <td>B</td>
        <td>C</td>
    </tr>
  </thead>
</table>

答案 2 :(得分:0)

This should work :

sudo apt-get install tmpreaper
table 
{
    width: 100%;
}
tr td:first-child
{
    width: 100px;
}