开发者

Doctype vs. html design

i got this piece of code:

 <head>
 <title>width height</title>
 </head>
 <body>
     &开发者_高级运维lt;table border="1" cellpadding="0" cellspacing="0" height="100%" width="800px">
     <tr>
         <td style="height: 100px">
             cucu
         </td>
     </tr>
     <tr style="height: 100%">
         <td class="tdMargin" style="width: 760px">
         bau    
         </td>
     </tr>
     <tr>
         <td style="height:50px" valign="bottom">
            bla
         </td>
     </tr>
     </table>
 </body>
 </html>

it behaves how it should

i added it in a masterpage, it works all right

but when i take the doctype stuff from the old masterpage (we are redesigning the app) and add the:

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

to the page, the design (height 100% stuff) goes mad

is there a way to fix it?

i don't know too much about doctypes ...

it should basically work in IE, if that helps


Please have a look : HTML Declaration

The doctype declaration is not an HTML tag; it is an instruction to the web browser about what version of the markup language the page is written in.

The DocType you are using seems to be incorrect or restrictive. Please set it as per the HTML version you are using.


The height settings should be ignored, the browser behaves exactly as expected.

There is no height attribute for the table element in the standard. It's only Internet Explorer that thinks that there is, and it only does so in quirks mode (i.e. when there is no doctype).

Use a CSS style to set the height of the table instead:

<table border="1" cellpadding="0" cellspacing="0" width="800px" style="height: 100%;">

Preferrably the CSS should go in a style sheet, not in the separate elements, but I show the style that way here so that you can test it easily.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜