Problem Description The button style is icon + text. When using flex layout to vertically center it, the text and icon are not centered on the iPhone 7 phone, but displayed on the left. The code is as follows (simplified): <button> <img src="./refresh.png" alt /> {{ confirmButtonText }} </button> ... button { display: flex; align-items: center; justify-content: center; img { width: 36px; height: 36px; display: inline-block; } } Expected style: Actual style: Solution Wrap another layer of labels around the icon and text, and set the flex vertical center style for the outer label. The code is as follows: <button> <span class="wrap"> <img src="./refresh.png" alt /> {{ confirmButtonText }} </span> </button> ... button { display: flex; align-items: center; justify-content: center; .wrap { img { width: 36px; height: 36px; display: inline-block; } } } This is the end of this article about how to solve the problem of flex vertical centering inside button not being centered. For more information about flex vertical centering inside button not being centered, please search previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope you will support 123WORDPRESS.COM in the future! |
<<: Practice of using Tinymce rich text to customize toolbar buttons in Vue
>>: A Brief Analysis of Patroni in Docker Containers
I call this kind of bug a typical "Hamlet&qu...
Problem description: When phpstorm's SFTP hos...
Preface Today, after synchronizing the order data...
In MySQL, we usually use limit to complete the pa...
Before the release of Microsoft IE 5.0, the bigges...
The development of Docker technology provides a m...
MySQL storage engine overview What is a storage e...
Preface To be honest, I've been feeling very ...
Table of contents 1. Introduction to basic concep...
Table of contents 1. Basic Example 2. Set the sco...
Solve the problem of eight hours time difference ...
Table of contents Preface What are dynamic proper...
Table of contents 1. Analysis of key source code ...
How to refresh iframe 1. To refresh, you can use j...
1. CSS writing format 1. Inline styles You can wr...