📜 ⬆️ ⬇️

Using fractional values ​​in layout

I noticed that browsers differently round off fractional pixel values. For example, in Opera 10 and IE7, the indentation value of 12.5px is rounded to 12px, and in Firefox 3.6 and IE8 - to 13px. This feature of processing a CSS document helped me to accurately connect two blocks.

If you have a desire to personally verify this feature, you can use, for example, the following code:

  <style>
 #test {
	 background-color: # f0f6fa;
	 color: # 272727;
	 height: 12.5px;
 }
 </ style>

 <div id = "test"> </ div>

 <script language = "javascript">
	 document.getElementById ('test'). innerHTML = document.getElementById ('test'). offsetHeight;
 </ script> 

')
Be careful! This behavior of the analyzer may vary depending on the version of the browser.

Source: https://habr.com/ru/post/98019/


All Articles