SORU
3 Mart 2010, ÇARŞAMBA


HTML Giriş 100% taşmaları tablo hücre genişliğinde textbox

Kimse 100% genişliğinde giriş elemanları tablo hücrelerinin sınır üzerinden oluyor. Giriş kutusu tablo hücreleri sınırdan gidip aşağıdaki basit örnekte, sonuç korkunç. Bu test edildi ve aynı şekilde oluyor: FF, IE 7 ve Safari. Sizin için mantıklı mı? Eksik bir şey, olası bir çözüm hakkında ne biliyorsun mıyım?

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">    
<html><head>    
   <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <!-- don't use closing slash in meta tag, it breaks HTML4.01 transitional -->
   <title>Test input text in table</title>
   <style type="text/css">      
      table {border-top: 1px solid #ff0000; border-left: 1px solid #ff0000;}
      table td {border-right: 1px solid #00ff00; border-bottom: 1px solid #00ff00;}
      input[type="text"] {width: 100%;} /* removing this would make input not to go over cells border, but they would be too short, I want them to fit cells size */
   </style>    
</head><body>

<table cellpadding="0" cellspacing="0">
   <tr>
      <td><p>column one hello babe babe babe</p></td>
      <td><p>column two hello babe more</p></td>
      <td><p>column three hello babe more and more</p></td>
   </tr>
   <tr>
      <td><input type="text" value="test"></td>
      <td><input type="text" value="test"></td>
      <td><input type="text" value="test"></td>
   </tr>
</table>

</body></html>

CEVAP
30 Kasım 2011, ÇARŞAMBA


CSS3 box-sizing özelliği dış dolgu ve kenarlık eklemek için kullanabilirsiniz:

input[type="text"] {
     width: 100%; 
     box-sizing: border-box;
     -webkit-box-sizing:border-box;
     -moz-box-sizing: border-box;
}

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • Jordie Jordan

    Jordie Jorda

    27 Ocak 2008
  • Mr. H

    Mr. H

    1 Temmuz 2012
  • williamfitzsimmons

    williamfitzs

    14 Mart 2008