html - 100% width table cell -


I have this table layout, I want to align the entire contents in right, so I am width: 100%; I'm using a cell with . Usually everything looks good and good.
But something that I did not understand If the content in the cell, which is colspan, becomes larger than normal cell in this column (you can test it by clicking on the click button ), this breaks the whole layout.
It is on Chrome, Safari 4 and 5, IE8, but OK on opera, FF and IE7.

Any thoughts?

  & lt ;! DOCTYPE HTML PUBLIC "- // W3C / / DTD HTML 4.01 Transcription // N" "http: //www.w3 org / TR / HTML4 / loose.dtd" & gt; & Lt; Html & gt; & Lt; Top & gt; & Lt; Meta http-equiv = "content-type" content = "text / html; charset = UTF-8" & gt; & Lt; Title & gt; Test & lt; / Title & gt; & Lt; Style type = "text / css" & gt; Table {width: 100%; } Table TD {boundary: 1 px solid black; White-space: Abrop; } .Delimiters {width: 100%; } & Lt; / Style & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Table & gt; & Lt; TR & gt; & Lt; Td> & Lt; Label & gt; Line 1 & lt; / Label & gt; & Lt; / Td> & Lt; TD & gt; & Nbsp; & Lt; / TD & gt; & Lt; Td> & Lt; Input type = "text" value = "field 1" id = "field1" size = "25" & gt; & Lt; / Td> & Lt; Td> & Lt; Input type = "button" value = "click to test" onclick = "var o = document.getElementById ('field2'); o.size = o.size == 25? 50: 25;" & Gt; & Lt; / TD & gt; & Lt; Td square = "delimiter" & gt; & Amp; Nbsp; & Lt; / Td> & Lt; / TR & gt; & Lt; TR & gt; & Lt; Td> & Lt; Label & gt; Line 2 & lt; / Labels & gt; & Lt; / Td> & Lt; TD & gt; & Nbsp; & Lt; / TD & gt; & Lt; Td colspan = "3" & gt; Input  & Lt; / TR & gt; & Lt; / Table & gt; & Lt; / Body & gt; & Lt; / Html & gt;  

I was not surprised when you said that it works in some browsers and others Not to Welcome to the real world of developing the web app. I see that browsers refresh their layout differently, so I know it can be a black hole of time. Instead, I put the following solution:

   & Lt; Label & gt; Line 1 & lt; / Label & gt; & Lt; / Td> & Lt; TD & gt; & Nbsp; & Lt; / TD & gt; & Lt; Td square = "delimiter" & gt; & Lt; Table & gt; & Lt; TR & gt; & Lt; Td> & Lt; Input type = "text" value = "field1" id = "field1" size = "25" /> gt; & Lt; / Td> & Lt; Td> & Lt; Input type = "button" value = "click to test" onclick = "var o = document.getElementById ('field2'); o.size = o.size == 25? 50: 25;" / & Gt; & Lt; / TD & gt; & Lt; Td square = "delimiter" & gt; & Amp; Nbsp; & Lt; / Td> & Lt; / TR & gt; & Lt; / Table & gt; & Lt; / TD & gt; & Lt; / TR & gt; & Lt; TR & gt; & Lt; Td> & Lt; Label & gt; Line 2 & lt; / Labels & gt; & Lt; / Td> & Lt; TD & gt; & Nbsp; & Lt; / TD & gt; & Lt; TD & gt; & Lt; Table & gt; & Lt; TR & gt; & Lt; Td> & Lt; Input type = "article" id = "field 2" value = "field 2" size = "25" /> gt; & Lt; / Td> & Lt; Td square = "delimiter" & gt; & Amp; Nbsp; & Lt; / Td> & Lt; / TR & gt; & Lt; / Table & gt; & Lt; / TD & gt; & Lt; / TR & gt; & Lt; / Table & gt; & Lt; / Body & gt; & Lt; / Html & gt;  

I know this is not the best solution, but it works as a raw HTML. Tested in Chrome and IE10


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -