简体   繁体   English

如何隐藏文字并在点击时显示

[英]How to to hide text and show on click

我有一个深色分隔框,当您在div上单击并按住鼠标时,我想开发这样的东西。一个圆形div将透明,并且它将在该深色div下显示隐藏的句子。

give that div box a class eg darkBox then in css u can also give "active" property for clicking border-radius can make it round, if u give 50% it will make it circle, if u want corner edges round or curved u can give values less than this 给该div框一个类,例如darkBox,然后在css中,您还可以为单击border-radius提供“ active”属性,以使其变为圆形;如果您给其50%的值,则将其变为圆形;如果您希望拐角边缘为圆形或弯曲,则可以给出小于此的值

.darkBox:hover{
background-color: transparent;
border-radius: 50%;
}

I hope this helps ,if not can you please tell me what u exactly require 希望对您有所帮助,如果不能,请告诉我您的确切要求

Key point: 关键点:

  • A round shape can easily be made by using border-radius: 50% . 通过使用border-radius: 50%可以轻松地制作圆形border-radius: 50%

  • The pseudo-class :hover is what activates the alternate state. 伪类:hover是激活备用状态的元素。

  • The pseudo-class :before (and :after ) can insert into an element some text. 伪类:before (和:after )可以在元素中插入一些文本。

  • The extra fading effects were done with transition . 额外的衰落效果是通过transition完成的。

 .orb { font-size: 3em; border: 2px solid black; border-radius: 50%; height: 1.5em; width: 1.5em; text-align: center; cursor: pointer; background-color: black; } .orb:before { content: '\\2620'; transition: opacity 3.5s ease-in, color 4s linear; opacity: 0; color: transparent; } .orb:hover:before { content: '\\2620'; opacity: 1; color: white; } .cap:after { content: ''; transition: opacity 3.5s ease-in, color 4s linear; opacity: 0; color: transparent; } .orb:hover .cap:after { content: 'The skull and crossbones is actually a font character'; opacity: 1; color: red; font: 400 16px/.3 'Palatino Linotype'; white-space: nowrap; } 
 <figure class="orb"> <figcaption class="cap"></figcaption> </figure> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM