文本在一个特定字段的输入类型字段中不可见

时间:2017-05-11 11:53:49

标签: html css

以下是我的代码,其中我使用了输入类型=文本,并且特定字段的文本不可见。请检查代码并告诉我是否有任何错误。

  .description{
width: 75%;
height: 38px;
padding-left: 1000px;
}

     <tr>
  <td>Description</td>
  <td><input type="text" name="Description" class="description"></td>
</div>

3 个答案:

答案 0 :(得分:2)

  

填充边距

之间存在差异

填充适用于元素的内部(添加一种&#34;内部边框&#34;,像框架一样,将内容推离边框) 例如:应用于输入,10px填充将从边框移动文本并将其定位在10px内

保证金适用于元素的一般位置。

  

参考BOX models

请注意,它适用于 - &gt;顶部/右侧/底部/左侧

填充10px 25px 0 50px将在顶部执行10次,在右侧执行25次,在底部执行0,在左侧执行50次。

在您的情况下,如果您希望在标题&#34;描述&#34;之间留出更多空间,请对表格应用一些填充。输入名为&#34;描述&#34;:

以下是一个例子,与它一起玩并适应您的需要:)

<style> 

.description {
width: 75%;
height: 38px;
padding: 10px;
}

.margin {
margin: 50px auto; // applies to TOP/BOTTOM (left/right is auto)
}

.padding {
padding: 25px; // applies to Top/Right/Bottom/Left
}

</style>


<div class="margin">
<table>
<tr>
<td class="padding">Description</td>
<td class="padding"><input type="text" name="Description" class="description"></td>
</tr>
</table>
</div>

答案 1 :(得分:1)

正如评论中所说。从CSS中删除padding-left: 1000px;,您应该再次看到该文本。填充将文本推送到屏幕右侧1000px。这是不可见的输入字段。

检查以下jsfiddle是否有工作示例

答案 2 :(得分:1)

首先确保你发布了正确的代码,bcoz你已经打开<tr>但是关闭为</div>并且默认情况下不会有任何文字你提到你的输入要输入应该是文本类型..如果你需要一个文本默认你可以添加占位符=“一些描述”,并从左侧开始文本你应该删除padding-left:1000px;我已按如下方式编辑了您的代码,

html as

  <tr>
    <td>Description</td>
    <td><input type="text" name="Description" class="description"></td>
  </tr>

和css是,

.description{
width: 75%;
height: 38px;
}
相关问题