CSS3 implementation example of rotating only the background image 180 degrees

CSS3 implementation example of rotating only the background image 180 degrees

1. Mental Journey

When I was writing the cockpit recently, I thought about a problem, which is to simply rotate the background image to a certain angle.

Only using CSS3's transfrom to flip the entire container to a certain angle does not achieve the effect I want.

Then I finally achieved this effect by researching and referring to related articles. Without further ado, here is the code.

2. Code Implementation

The HTML template is as follows

<div class="smart_development_right">
  <div class="smart_development_content">
    <span>Intelligent sensing devices</span>
  </div>
  <div class="smart_development_content">
    <span>Online Rate</span>
  </div>
</div>

CSS Code

.smart_development_right{
   position: relative;
   overflow: hidden; 
}
.wisdomGongdi .gongdi_center .center_top .smart_development_right::before {
  content: "";
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: -1;
    background: url('/public/smart_equipment.png') 0 0 no-repeat;
    transform: rotate(180deg);
}

If you want to rotate 90 degrees to the right, change the 180deg in the above code to 90deg

If you want to rotate 90 degrees to the left, change the 180deg in the above code to -90deg

If the idea is right, then implementation will be very simple.

Although I didn’t use this in the end, I still think it is very useful, so I would like to share it with you.

References

This concludes this article about the implementation example of rotating only the background image 180 degrees with CSS3. For more information about rotating the background image 180 degrees with CSS3, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope you will support 123WORDPRESS.COM in the future!

<<:  What is html file? How to open html file

>>:  Bootstrap 3.0 study notes grid system principle

Recommend

SpringBoot integrates Activiti7 implementation code

After the official release of Activiti7, it has f...

An example of how to write a big sun weather icon in pure CSS

Effect The effect diagram is as follows Implement...

Three ways to configure JNDI data source in Tomcat

In my past work, the development server was gener...

How to delete all contents in a directory using Ansible

Students who use Ansible know that Ansible only s...

About Docker security Docker-TLS encrypted communication issues

Table of contents 1. Security issues with Docker ...

18 common commands in MySQL command line

In daily website maintenance and management, a lo...

vue.js downloads pictures according to picture url

Recently, when I was working on a front-end vue.j...

Detailed explanation of script debugging mechanism in bash

Run the script in debug mode You can run the enti...

How to use bar charts in Vue and modify the configuration yourself

1. Import echart in HTML file <!-- Import echa...

JS, CSS style reference writing

CSS: 1. <link type="text/css" href=&q...

Solution to "Specialized key was too long" in MySQL

Table of contents Solution 1 Solution 2 When crea...

Record a slow query event caused by a misjudgment of the online MySQL optimizer

Preface: I received crazy slow query and request ...