To achieve the plus sign effect shown below: To achieve this effect, you only need a div element. CSS is needed for before, after, and border properties. First set a div note <div class="add"></div> Set another border: .add { border: 1px solid; width: 100px; height: 100px; color: #ccc; transition: color .25s; position: relative; } The border now looks like this: We can use the pseudo-class before and its border-top to set a "horizontal": .add::before{ content: ''; position: absolute; left: 50%; top: 50%; width: 80px; margin-left: -40px; margin-top: -5px; border-top: 10px solid; } Note that we used absolute positioning. Now it becomes like this: Referring to the above, we can use the after pseudo-class and border-bottom to set a "vertical": .add::after { content: ''; position: absolute; left: 50%; top: 50%; height: 80px; margin-left: -5px; margin-top: -40px; border-left: 10px solid; } Add the hover pseudo-class and set the color when the mouse is hovering: .add:hover { color: blue; } The final style: When the mouse hovers over it, it changes color: You can view the effect here: https://jsbin.com/quvidap/edit?html,css,output Summarize The above is the example code of how to use CSS to achieve the "plus sign" effect. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website! |
<<: js to realize payment countdown and return to the home page
>>: Select web page drop-down list and div layer covering problem
When using MySQL, dates are generally stored in f...
Set change mysqlroot password Enter the MySQL dat...
Reminder: Whether it is planning, designing, or de...
Because the router at home forced to reduce the b...
Scenario 1: Html: <div class="outer"...
Table of contents Preface 1. bat executes js 2. T...
This article shares the specific code of jQuery t...
Cause of failure Today, when I was writing a caro...
Sttty is a common command for changing and printi...
Table of contents What is two-way data binding Im...
Table of contents 1. Introduction to podman 2. Ad...
In general applications, we use timestamp, dateti...
Perfect solution to the scalable column problem o...
Table of contents Preface Benefits of axios encap...
Flex Basic Concepts Flex layout (flex is the abbr...