Home >WeChat Applet >Mini Program Development >Can the mini program title be centered?
Can the mini program title be centered?
Method to center the title of the mini program:
1. To achieve the centering of the WeChat mini program, you can use the flex layout tool. I believe many friends know the use of the flex layout tool. If you don't know, I can tell you that its biggest function is to quickly achieve the layout you need (horizontal centering, vertical centering, left and right alignment, etc.).
2. The flex layout is quite simple. Here I will briefly talk about a few scene applications. For specific details, friends still have to read books or watch video tutorials. First, set display:flex on the layout container; such as the most painful vertical centering.
3. Change align-items to justify-content
4. The two attributes are happily combined in Together.
#5. There are many more common scenarios than just centered WeChat applet layout.
#6. If we want to center the main vertically, we only need to set display:flex and align-items:center to its parent element body. There is a div and p in main. If you want to vertically center these two elements in main, you also need to set display:flex and align-items:center for their parent element main; in addition, justify-content and flex-direction are used for adjustment. The order in which these two child elements are centered horizontally.
7. A common method is to use absolute positioning with negative margin. The idea is to set it to absolute, specify top and left as 50%, place the upper left corner of the element in the center of the page, and then use half the width and height of the negative margin to pull the element back to the center of the page.
For more related knowledge, please visit PHP Chinese website! !
The above is the detailed content of Can the mini program title be centered?. For more information, please follow other related articles on the PHP Chinese website!