For evenly distributed layouts, we generally use the negative margin method. The following figure shows an average layout. In this case, we usually add a div between the parent element and the child element, and then set a negative margin-right for this div, with the value being the distance between the two child elements. //HTML <div class="father"> <div class="middle"> <div class="son1"></div> <div class="son2"></div> <div class="son3"></div> </div> </div> //CSS .son1,.son2,son3{ margin-right:50px; width:100px; } .father{ width:400px; } .middle{ margin-right:-50px; } The middle layer margin-right:-50px is equivalent to "extending" 50px to the right, so that the son3 element has space to be in the same line as other elements. This concludes this article about examples of using CSS to achieve average layout with negative margins. For more information about CSS average layout with negative margins, please search previous articles on 123WORDPRESS.COM or continue browsing the related articles below. I hope you will support 123WORDPRESS.COM in the future! |
<<: Simple implementation of html hiding scroll bar
>>: The effect of zooming in on a Taobao store is similar to the principle of using a slideshow.
Often when we open foreign websites, garbled char...
Hello everyone, today I will share with you the i...
This article mainly introduces how to implement l...
Call How to call Amap API? The official open docu...
First, let me explain the version of MySQL: mysql...
"We're writing our next set of mobile pr...
Ansible is a new automated operation and maintena...
What is "Sticky Footer" The so-called &...
1. Introduction to mysqldump mysqldump is a logic...
This time we set up an rtmp live broadcast server...
This article records the installation and configu...
The usage of H tags, especially h1, has always bee...
Table of contents Preface Simulating data Merged ...
1. Docker startup problem: Problem Solved: You ne...
question: When I was doing project statistics rec...