Home CMS Tutorial WordPress How to center WordPress images

How to center WordPress images

Jul 12, 2019 pm 01:12 PM

How to center WordPress images

When many people use wordpress, some people always ask this question, why can I freely control the left, right and center display of pictures in the wordpress editor? Is the text surrounding the picture, but it cannot be displayed when it reaches the front desk? They are all on the left, and the style is messy.

Log in to the WordPress backend and enter the WordPress theme editor.

How to center WordPress images

Add the following code at the end of stype.css

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

/*Alignment*/

.alignleft {

   display:inline;

   float:left;

   margin-right:1.625em;

}

.alignright {

   display:inline;

   float:right;

   margin-left:1.625em;

}

.aligncenter {

   clear:both;

   display:block;

   margin-left:auto;

   margin-right:auto;

}

Copy after login

For more wordpress-related technical articles, please visit wordpress tutorial Column for learning!

The above is the detailed content of How to center WordPress images. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

The 5 Best IDEs for WordPress Development (And Why) The 5 Best IDEs for WordPress Development (And Why) Mar 03, 2025 am 10:53 AM

The 5 Best IDEs for WordPress Development (And Why)

Create WordPress Plugins With OOP Techniques Create WordPress Plugins With OOP Techniques Mar 06, 2025 am 10:30 AM

Create WordPress Plugins With OOP Techniques

How to Pass PHP Data and Strings to JavaScript in WordPress How to Pass PHP Data and Strings to JavaScript in WordPress Mar 07, 2025 am 09:28 AM

How to Pass PHP Data and Strings to JavaScript in WordPress

How to Embed and Protect PDF Files With a WordPress Plugin How to Embed and Protect PDF Files With a WordPress Plugin Mar 09, 2025 am 11:08 AM

How to Embed and Protect PDF Files With a WordPress Plugin

See all articles