No more nonsense, post code HTML part <div class="positionleft">I am on the left side of the position method, accounting for 30%</div> <div class="positionright">I am on the right side of the position method, accounting for 70%</div> CSS part .positionleft { position: relative; display: inline-block; background-color: #8d8d8d; width: 30%; height: 20%; } .positionright { position: relative; display: inline-block; left: 0; background-color: #ff8888; width: 70%; height: 20%; } Display Effect It can be clearly seen that the two div blocks are misaligned. After consulting the information, it is found that this phenomenon occurs when there is a space between the two inline-blocks. Modify the html code as follows <div class="positionleft">I am on the left side of the position method, accounting for 30%</div> <div class="positionright">I am on the right side of the position method, accounting for 70% </div> Just delete the space between the two divs and see the effect. Problem Solving Please pay attention to this problem when using document formatting tools such as prettier Summarize This is the end of this article about how to solve the misalignment problem of inline-block with CSS. For more relevant CSS inline-block misalignment content, please search 123WORDPRESS.COM’s previous articles or continue to browse the related articles below. I hope you will support 123WORDPRESS.COM in the future! |
<<: JS cross-domain XML--with AS URLLoader
>>: Detailed explanation of anonymous slots and named slots in Vue
The recommended code for playing background music ...
Navigation, small amount of data table, centered &...
Table of contents 1. Environmental Preparation 1....
The questions encountered in Baidu interviews nee...
Frame structure tag <frameset></frameset...
1. Download cuda10.1: NVIDIA official website lin...
This article example shares the specific code of ...
Table of contents 1. What is a design pattern? 2....
The domestic market still has a certain demand fo...
View system help help contents mysql> help con...
I just tried it on IE6, and it does show the toolb...
The CSS3 category menu effects are as follows: HT...
Everyone must know the composition of the box mod...
What is Load Balancing Load balancing is mainly a...
Simple example of HTML checkbox and radio style b...