Home  >  Article  >  Web Front-end  >  input输入框如何去除边框和修改背景色_html/css_WEB-ITnose

input输入框如何去除边框和修改背景色_html/css_WEB-ITnose

不言
不言Original
2018-05-18 17:20:1610924browse

<body> 
 <table> 
 <tr> 
 <td> 
 <input type="text" value="不如意十八九" > 
 </td> 
 </tr> 
 </table> 
 </body>

因为编辑和预览界面共用一个,考虑使用样式进行区分,上面代码要以下的结果: 

<body> 
 <table> 
 <tr> 
 <td> 
 不如意十八九 
 </td> 
 </tr> 
 </table> 
 </body>

请问各位能否实现 

回复讨论(解决方案)

<input type="text" value="不如意十八九" style="border:0px;">

用css就能实现 
 定义一个class,然后定义边框 none,背景色 
不就好了

<input type="text" style="border:0px;background-color:blue" value="不如意十八九" >
<input type="text" style="border:0px;background-color:blue" value="不如意十八九" >

+1

input{ border-style:none; background-color:#FF9;}

看了下问题,是不是在问JS效果如何实现? 

<body> 
 <table> 
 <tr> 
 <td id="box"> 
 <input type="text" value="不如意十八九" id="myinput" > 
 <button onclick="clicked()">click me</button> 
 </td> 
 </tr> 
 </table> 
 </body> 

------------------ 
<script>function clicked(){
var user_val = document.getElementById("myinput").value;document.getElementById("box").innerHTML = user_val;
}</script>

没有边框都是border:0px;背景色background-color:#fef;


 


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn