[continuous update] front end special style implementation

Yuany 2021-05-03 13:23:08
continuous update end special style


 There will be some animation effects in the development , The picture is getting bigger and smaller , Record the implementation here .
The example code is short .
 Copy code 

1. hover Zoom in and out

001- Image zoom effect .gif

Method 1 : In the mouse hover On the way up , Use transform Of scale() To zoom the image .

 <style>
div {
width: 400px;
height: 300px;
overflow: hidden;
}
img {
width: 100%;
height: 100%;
transition: all .5s;
}
div:hover img {
transform: scale(1.2);
}
</style>
<div>
<img src="./images/1.jpg" alt="">
</div>
 Copy code 

Method 2: Set the picture as the background picture , mouse hover On the way up , Adjust the background size background-size, Here, set the background position to center (background-position:center center).

 <style>
div {
width: 400px;
height: 300px;
background: url(./images/1.jpg) no-repeat;
background-size: 100% 100%;
background-position: center;
transition: all .5s;
}
div:hover {
background-size: 135% 135%;
}
</style>
<div></div>
 Copy code 

2. hover Display QR code

002-hover Display QR code .gif

Method 1: Hide images by default (display:none), mouse hover Show pictures when you're in the middle of the game (display:block)

 <style>
.box {
width: 200px;
}
.box p {
height: 30px;
color: #fff;
text-align: center;
line-height: 30px;
background-color: rgba(30, 143, 255, 0.452);
}
.box:hover img {
display: block;
}
.box img {
display: none;
width: 200px;
height: 200px;
}
</style>
<div class="box">
<p>hover Display QR code </p>
<img src="./images/erweima.png" alt="">
</div>
 Copy code 

3. picture hover It's going to get dark up there

003- picture hover It's going to get dark up there .gif

Method 1: Set a background color for the box containing the picture ( Like black ), Picture by hover When , More transparency (opacity), The picture will show the background color at the back .

 <style>
.box {
width: 300px;
height: 300px;
background-color: #000;
}
.box img {
width: 100%;
height: 100%;
transition: all 0.5s;
}
.box:hover img {
opacity: 0.5;
}
</style>
<div class="box">
<img src="./images/brk.jpg" alt="" />
</div>
 Copy code 

4. The box was sealed hover A mask slides up

004- The box was sealed hover A mask slides up .gif

 <style>
div {
position: relative;
width: 100px;
height: 40px;
color: #fff;
line-height: 40px;
text-align: center;
background-color: orange;
overflow: hidden;
}
div::after {
content: "";
position: absolute;
top: 40px;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.301);
transition: all .5s;
}
div:hover::after {
top: 0;
}
</style>
<div>
Start Coding
</div>
 Copy code 
版权声明
本文为[Yuany]所创,转载请带上原文链接,感谢
https://qdmana.com/2021/05/20210503131222198M.html

  1. Why did gitlab choose vue.js?
  2. HTTP-RPC: 轻量跨平台REST服务
  3. 继全面采用Node.js以后,PayPal分享大幅度踩坑GraphQL心得 - Mark Stuart
  4. vue组件化开发实战之滚动/轮播的实现
  5. Http-rpc: lightweight cross platform rest Service
  6. Following the full adoption of node.js, PayPal shares a great deal of graphql experience mark Stuart
  7. Implementation of rolling / carousel in Vue component development
  8. CSS是什么?这一篇全解,绝对有你想要的
  9. What is CSS? This is a complete solution, there is absolutely what you want
  10. 04-HTML5常用标签-HTML5极速入门
  11. 04-html5 common tags
  12. WEB前端全套零基础视频教程+软件2021最新编程视频
  13. Web front end full set of zero basic video tutorial + software 2021 latest programming video
  14. 使用Node, Mongo, React, Redux实现Token认证
  15. Using node, Mongo, react and Redux to realize token authentication
  16. 体面编码之CSS和HTML
  17. CSS and HTML for decent coding
  18. 使用Playwright基于多浏览器进行javascript自动化测试的简单教程- Applitools
  19. A simple tutorial for JavaScript automatic testing based on multi browser using playwright - applitools
  20. Minimum distance to target element
  21. 浅谈 React 中的 XSS 攻击
  22. XSS attack in react
  23. 自学前端教程整理,附不容错过的前端100篇文章合集
  24. Self taught front-end tutorial collation, with a collection of 100 front-end articles that can not be missed
  25. 使用OpenTracing跟踪Go中的HTTP请求延迟
  26. Using opentracing to track HTTP request latency in go
  27. Encapsulating databinding allows you to write less than 10000 lines of code
  28. 03-HTML5标签-HTML5极速入门
  29. 03-html5 tag-html5 quick start
  30. LayUI - 极易上手拿来即用的前端 UI 框架
  31. Layui - easy to use front end UI framework
  32. Interpretation of lodash source code (1)
  33. Why is the first parameter of node family callback error?
  34. 报告:JavaScript 开发者达1380 万,C#超越 PHP,Rust 增长最快
  35. Report: Javascript developers reach 13.8 million, C surpasses PHP, and rust grows fastest
  36. 小白前端入门笔记(10),怎么设置网站内部的超链接?
  37. How to set up hyperlinks inside the website?
  38. Using node and socket to realize online chat room
  39. The core competitiveness of Vue: data bidirectional binding
  40. React configuration agent
  41. CSS layout
  42. Application scenario explanation of Vue dynamic component
  43. Redux learning notes 04 -- using multiple reducers to manage data
  44. After three months of typescript writing, what have I learned?
  45. Node family - what is a callback?
  46. React -- a simple implementation of render & create element
  47. JS learning simple usage of jquery
  48. Seamless love
  49. 小白前端入门笔记(12),设置哑链接
  50. Small white front-end entry notes (12), set dumb links
  51. Vue2. X opens composition API and TSX
  52. Interview record and thinking of social recruitment for one and a half years (Alibaba, Tencent, baidu offer)
  53. Flex learning notes
  54. The most essential closure article in the eastern hemisphere
  55. 2021-05-03 hot news
  56. Sword finger offer -- reverse order pair in array (JS Implementation)
  57. Working process of scaffold
  58. Use decorator mode to strengthen your fetch
  59. [JS] scope (Introduction)
  60. Employment information statistics network (interface document)