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

Build a Docker image using Dockerfile

Table of contents Build a Docker image using Dock...

Complete steps to quickly configure HugePages under Linux system

Preface Regarding HugePages and Oracle database o...

Implementation of pushing Docker images to Docker Hub

After the image is built successfully, it can be ...

The process of installing and configuring nginx in win10

1. Introduction Nginx is a free, open source, hig...

Rules for using mysql joint indexes

A joint index is also called a composite index. F...

Detailed explanation of zabbix executing scripts or instructions on remote hosts

Scenario Requirements 1. We can use the script fu...

TCP performance tuning implementation principle and process analysis

Three-way handshake phase Number of retries for c...

W3C Tutorial (16): Other W3C Activities

This section provides an overview of some other i...

MySQL database operations and data types

Table of contents 1. Database Operation 1.1 Displ...

Database backup in docker environment (postgresql, mysql) example code

Table of contents posgresql backup/restore mysql ...

Solution to the problem of not finding Tomcat configuration in Intelli Idea

I joined a new company these two days. The compan...

Vue uses three methods to refresh the page

When we are writing projects, we often encounter ...

Three notification bar scrolling effects implemented with pure CSS

Preface The notification bar component is a relat...