33 lines
		
	
	
		
			649 B
		
	
	
	
		
			Markdown
		
	
	
	
	
	
			
		
		
	
	
			33 lines
		
	
	
		
			649 B
		
	
	
	
		
			Markdown
		
	
	
	
	
	
| ---
 | ||
| title: Add Different Margins to Each Side of an Element
 | ||
| localeTitle: 在元素的每一侧添加不同的边距
 | ||
| ---
 | ||
| ## 在元素的每一侧添加不同的边距
 | ||
| 
 | ||
| 要调整元素的边距,请使用:
 | ||
| 
 | ||
| ```css
 | ||
| .example { 
 | ||
|   margin: 10px; 
 | ||
|  } 
 | ||
| ```
 | ||
| 
 | ||
| 要按单个面指定元素的边距大小,我们可以使用“margin-top”,“margin-right”,“margin-bottom”和“margin left”。我们可以以任何顺序组合使用这些中的任何一种。例如:
 | ||
| 
 | ||
| ```css
 | ||
| .example { 
 | ||
|   margin-top: 5px; 
 | ||
|   margin-bottom: 0px; 
 | ||
|  } 
 | ||
| ```
 | ||
| 
 | ||
| 要么:
 | ||
| 
 | ||
| ```css
 | ||
| .example { 
 | ||
|   margin-top: 20px; 
 | ||
|   margin-left: 25px; 
 | ||
|   margin-right: 5px; 
 | ||
|  } 
 | ||
| 
 | ||
| ``` |