Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize prompt text pop-up window by css3

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to realize the prompt text pop-up window in css3. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

No extra javascript code is required, you can create a similar effect by using the css3 style.

Css code

[data-tips] {

Position: relative

Text-decoration: none

}

[data-tips]: after

[data-tips]: before {

Position: absolute

Z-index: 100

Opacity: 0

}

[data-tips]: after {

Content: attr (data-tips)

Height: 25px

Line-height: 25px

Padding: 0 10px

Font-size: 12px

Text-align: center

Color: # fff

Background: # 222

Border-radius: 5px

Text-shadow: 00 5px # 000

-moz-box-shadow: 0 5px rgba (0pc0pl 0pl 0.3)

-webkit-box-shadow: 0 5px rgba (0pc0pl 0pl 0.3)

Box-shadow: 0 5px rgba (0pc0pm 0pr 0.3)

White-space: nowrap

-moz-box-sizing: border-box

-webkit-box-sizing: border-box

Box-sizing: border-box

}

[data-tips]: before {

Content: ""

Width: 0

Height: 0

Border-width: 6px

Border-style: solid

}

[data-tips]: hover:after

[data-tips]: hover:before {

Opacity: 1

}

/ * Top tips * /

[data-tips]. Top-tip:after

[data-tips]. Top-tip:before {

-webkit-transition: bottom 0.25s ease-in-out, opacity 0.25s ease-in-out

-moz-transition: bottom 0.25s ease-in-out, opacity 0.25s ease-in-out

Transition: bottom 0.25s ease-in-out, opacity 0.25s ease-in-out

Bottom: 90%

Left:-9999px

Margin-bottom: 12px

}

[data-tips]. Top-tip:before {

Border-color: # 222 transparent transparent transparent

Margin-bottom: 0

}

[data-tips]. Top-tip:hover:after

[data-tips]. Top-tip:hover:before {

Bottom: 100%

Left: 0

}

[data-tips]. Top-tip:hover:before {

Left: 15px

}

/ * Bottom tip * /

[data-tips]. Bottom-tip:after

[data-tips]. Bottom-tip:before {

-webkit-transition: top 0.25s ease-in-out, opacity 0.25s ease-in-out

-moz-transition: top 0.25s ease-in-out, opacity 0.25s ease-in-out

Transition: top 0.25s ease-in-out, opacity 0.25s ease-in-out

Top: 90%

Left:-9999px

Margin-top: 12px

}

[data-tips]. Bottom-tip:before {

Border-color: transparent transparent # 222 transparent

Margin-top: 0

}

[data-tips]. Bottom-tip:hover:after

[data-tips]. Bottom-tip:hover:before {

Top: 100%

Left: 0

}

[data-tips]. Bottom-tip:hover:before {

Left: 15px

}

/ * Right tip * /

[data-tips]. Right-tip:after

[data-tips]. Right-tip:before {

-webkit-transition: left 0.25s ease-in-out, opacity 0.25s ease-in-out

-moz-transition: left 0.25s ease-in-out, opacity 0.25s ease-in-out

Transition: left 0.25s ease-in-out, opacity 0.25s ease-in-out

Top:-9999px

Left: 96%

Margin-left: 12px

}

[data-tips]. Right-tip:before {

Border-color: transparent # 222 transparent transparent

Margin-left: 0

}

[data-tips]. Right-tip:hover:after

[data-tips]. Right-tip:hover:before {

Left: 100%

Top: 0

}

[data-tips]. Right-tip:hover:before {

Top: 7px

}

/ * Left tip * /

[data-tips]. Left-tip:after

[data-tips]. Left-tip:before {

-webkit-transition: right 0.25s ease-in-out, opacity 0.25s ease-in-out

-moz-transition: right 0.25s ease-in-out, opacity 0.25s ease-in-out

Transition: right 0.25s ease-in-out, opacity 0.25s ease-in-out

Top:-9999px

Right: 96%

Margin-right: 12px

}

[data-tips]. Left-tip:before {

Border-color: transparent transparent transparent # 222

Margin-right: 0

}

[data-tips]. Left-tip:hover:after

[data-tips]. Left-tip:hover:before {

Right: 100%

Top: 0

}

[data-tips]. Left-tip:hover:before {

Top: 7px

}

HTML code

Bavotasan.com

This is the end of the article on "how to realize the prompt text pop-up window in css3". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it out for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report