how do i make an invisible text input box visible

2019-08-26 00:55发布

It doesn't seem to work for me!

HTML

 <div id="box1">
     <form action="">
         <input type="string" name="htmlcode" />
     </form>
 </div>

CSS

#box1 {
    width:100px;
    height:100px;
    border-color:black 4px
}
input {
    display:none;
}
a:hover input{
    display:block;
}

the text input is either invisible, or visible but does not respond to hover

4条回答
仙女界的扛把子
2楼-- · 2019-08-26 01:06

in your css you need to add this

#box1:hover input{display:block;}
查看更多
Juvenile、少年°
3楼-- · 2019-08-26 01:12

You don't have an a tag that you can hover to show the input...

Change it to #box1:hover input{display:block;} so it will show when you move your mouse into the box.

border-color:black 4px is also invalid. If you want to set the border color, you can only give it a color, not a color and size.

Here's a demo showing both of those things fixed.

查看更多
爷、活的狠高调
4楼-- · 2019-08-26 01:13

You don't have <a> in html. Try: div:hover input{display:block;}

查看更多
Bombasti
5楼-- · 2019-08-26 01:16
 #box1 { 
    width:100px;
    height:100px;
    border:4px solid black;
}
 input {display:none;}
 #box1:hover input{display:block;}​

As others mentioned, you don't have an a tag so change the target of the :hover as well.

Also fixed the border declaration.

http://jsfiddle.net/XZvHh/

查看更多
登录 后发表回答