Jump to content

Recommended Posts

The following code, displays a basic 2x2 table. Why is the height of the table heading cells 22 pixels, even after I have declared them to be 19 pixels in height?

 

How do I get the height of the table heading cells to be 19 pixels?

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
<style type="text/css">
body
{
background: url(plan.bmp) no-repeat;
}

table.coll 
{
font-size: 8pt;
font-family: "Verdana";
border-collapse: collapse;
border: 1px solid rgb(138,188,1);
}

th
{
height: 19px;
border: 1px solid rgb(138,188,1);
background: url(bg.bmp);
}


</style>
</head>

<body>
<table class="coll" border="1">
<tr>
    <th><input type="checkbox" name="checkbox" value="checkbox"></th>
    <th>First Name</th>
    <th>Last Name</th>
</tr>
<tr>
    <td><input type="checkbox" name="checkbox" value="checkbox"></td>
    <td>FirstName</td>
    <td>LastName</td>
</tr>
</table>

</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/83432-set-table-heading-cells-height/
Share on other sites

if you do not set table spacing and padding, ie will use a default values of 2. set them explicitly:

<table cellpadding="0" cellspacing="0" class="coll" border="1">

that border setting may also cause you a problem because of the 'ie box model problem'

The table heading cells no get displayed at 21 pixels in height when view in IE6.0. How do I change the height to 19 pixels?

Is it possible to get IE to behave kind of like FireFox, as FireFox display the table cells at the correct height? - Would changing the doctype help? If so what to?

 

Also, how do I declare the cell padding and cell spacing using CSS?

 

the thing to know about setting table padding and spacing using css is that the table tag and the td tags are separate entities in css. Also css uses the word 'margin' instead of 'cellspacing'

<style>
    table { padding:0;margin:0; } /* set all tables */
    td { padding:0;margin:0; } /* set all td's */
</style>

the reason ff displays differently than ie is that ff will use default padding and margins of 0 if not specified and ie will use default values of 2px.  Also border values used with an item that also has a width or height item will cause you to run into the 'ie box model problem' and it will dispay differently in ie and ff.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.