Home  >  Article  >  Web Front-end  >  Recommend 10 commonly used examples of centering usage

Recommend 10 commonly used examples of centering usage

伊谢尔伦
伊谢尔伦Original
2017-06-15 09:47:511618browse

This article summarizes various centering layout methods using CSS. Interested friends can refer to this article to discuss the situation where the centering situation is set to a variable total width and variable content width. (Still centered when resized). Special note: When setting position:absolute; to set the centering effect on an element, in addition to the css3 method introduced in the blog, you can also use negative margin to center. This solves the compatibility problem, but only applies to known width and height. (because a negative offset is half the width and height of the element). When the width and height change, there is no longer a centered effect. Child elements in these layouts default to the content width because of their property settings. All the centered examples in this article only discuss the implementation of css. The html code is unified as follows:

demo

&a

1. Detailed introduction about detailed summary

Recommend 10 commonly used examples of centering usage

##Introduction: This article summarizes various centering layout methods using CSS. Interested friends can refer to this article to discuss how to set the centering situation to total The width is variable and the content width is variable. (Still centered when resized). Special note: When setting position:absolute; to set the centering effect on an element, in addition to the css3 method introduced in the blog, you can also use negative margin to center. This solves the compatibility problem, but only applies to known width and height. (because a negative offset is half the width and height of the element). When the width and height change, it is no longer the center...

2. Recommended 4 articles about block tags

Recommend 10 commonly used examples of centering usage

##Introduction: Classification of HTML tags      When talking about tag classification, as beginners, we will find some attributes when we first use tags It does not work on some tags, such as width, height, horizontal centering, etc. In fact, the use of this attribute only works on block-level tags. Personally, I think this is something that beginners can easily overlook, so I wrote it down! First of all, we can divide HTML tags into block-level tags, inline tags, and inline block tags according to different displays; we will introduce them separately now. Block-level tag Features...

3. How to use

margin? Summary of margin instance usage

Recommend 10 commonly used examples of centering usage## Introduction: The problem of how to vertically center an element in CSS is already a commonplace question . Whether it is a newbie or a veteran, this question is often asked during the interview process. I was watching a flex video tutorial two days ago, and it mentioned the centering of elements, so today I will take a look at some common methods. Please criticize and correct any shortcomings (all the codes are typed by myself and available) 1. Horizontal centering (margin: 0 auto;) Regarding this, everyone should be the least familiar with it, whether it is in a training class or self-study if. This should...

4.

Summary of the points to note about front-end performance

Recommend 10 commonly used examples of centering usageIntroduction: The problem of how to vertically center an element in CSS is already a commonplace question. Whether it is a newbie or a veteran, this question is often asked during the interview process. I was watching a flex video tutorial two days ago, and it mentioned the centering of elements, so today I will take a look at some common methods. Please criticize and correct any shortcomings (all the codes are typed by myself and available) 1. Horizontal centering (margin: 0 auto;) Regarding this, everyone should be the least familiar with it, whether it is in a training class or self-study if. This should...

5.

10 recommended articles about compatibility handling

Introduction: The compatibility of CSS with browsers is sometimes a headache. Perhaps when you understand the techniques and principles, you will find it is not difficult. We have collected the compatibility of IE7, 6 and Fireofx from the Internet. The processing methods are sorted out. For the transition to web2.0, please try to write code in xhtml format, and DOCTYPE affects CSS processing. As a W3C standard, DOCTYPE must be added. CSS skills 1.p vertical Centering problem vertical-align:middle;...

6. About using css to center text and images vertically and horizontally

Recommend 10 commonly used examples of centering usage

#Introduction: I have always believed that a good memory is not as good as a bad writing. Recently, I have come across a lot of posts that use vertical centering. I will sort them out for future reference.

7. Summary of 7 ways to vertically center divs

Recommend 10 commonly used examples of centering usage

Introduction: In our daily web development, we often use CSS and DIV for layout to make the page more beautiful and have a better experience. So how to make the div display in various centered ways? , let’s summarize the method of vertically centering divs in detail.

8. CSS Centering: The most comprehensive collection of CSS centering methods

Recommend 10 commonly used examples of centering usage

Introduction: In Web page development, for the sake of the beauty of the entire page and the user experience, we often use CSS centering. In the web page, it can center pictures or text in different styles. The centering method is displayed, so how are these different centering methods implemented? Today we will introduce to you the most comprehensive CSS centering method.

9. div centering: the most comprehensive summary of div centering methods

Recommend 10 commonly used examples of centering usage

Introduction: How can I achieve horizontal or vertical centering of text or images on a web page? You can use DIV+css to implement layout very conveniently. So today I will give him a summary of several methods for using CSS to center DIVs and using JS/JQ for centering:

#10. css picture centering: css picture top and bottom Left and right centering (horizontal and vertical centering)

Recommend 10 commonly used examples of centering usage

##Introduction: In our web page layout, we often need to use Use the DIV+CSS layout to center the image horizontally, left, and right, and vertically and vertically. How to achieve this? This article summarizes several methods for you to use DIV+css to center the image left and right/horizontally and center the image up and down/vertically!

[Related Q&A recommendations]:

ios - When setting layout in storyboard, can the width of the space be set as a percentage of the screen width?

javascript - How to center a picture that is larger than the container on a web page in the container

ios - How about the prompt information of uitableview (no data prompt) Ensure centering

#css - Why can't flex's align-items: center be vertically centered?

css - flexbox conflicts with list-style?

The above is the detailed content of Recommend 10 commonly used examples of centering usage. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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