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

When is it appropriate to use dl, dt, and dd?

dl:Definition list Definition List dt:Definition t...

JavaScript String Object Methods

Table of contents Methods of String Object Method...

Detailed tutorial on installing MariaDB on CentOS 8

MariaDB database management system is a branch of...

Let's talk briefly about the changes in setup in vue3.0 sfc

Table of contents Preface Standard sfc writing me...

mysql splits a row of data into multiple rows based on commas

Table of contents Separation effect Command line ...

Linux editing start, stop and restart springboot jar package script example

Preface In the springboot configuration file, the...

RHCE installs Apache and accesses IP with a browser

1. at is configured to write "This is a at t...

Summary of several commonly used CentOS7 images based on Docker

Table of contents 1 Install Docker 2 Configuring ...

vue dynamic component

Table of contents 1. Component 2. keep-alive 2.1 ...

Vue.js implements image switching function

This article shares the specific code of Vue.js t...

Detailed explanation of JavaScript function introduction

Table of contents Function Introduction function ...

How to increase HTML page loading speed

(1) Reduce HTTP requests. (Merge resource files a...