CSS question. I am writing markup:
<!DOCTYPE HTML> <html> <head> <style> * { margin: 0px; padding: 0px; } #one { width: 1200px; height: 100px; margin: 10px; background-color: red; } #two { width: 1500px; height: 100px; background-color: green; } </style> </head> <body> <div id="one"></div> <div id="two"></div> </body> When the left and right margin are not equal to auto and the width is not equal to auto, then the left margin is set first, then the content with the specified width is placed, and the right margin is reset to auto and adjusted to the width of the content of the parent block.
How do i get a real right margin? It is written that it is 10 pixels, but it can be seen that there is much more - it is highlighted in orange. window.getComputedStyle () gives 10 pixels width.
Why does the browser in my example lie and say that the right margin is 10 pixels, although there are all 50 pixels there?
In this situation, my margin-left not auto , the margin-right not auto and the width is not auto - in such a situation the browser should reset the margin-right to auto. The width of the field to the right will be determined in accordance with the rule that the value of auto COMPLETES the total width of the element to the width of its container block. source - Eric Meyer "css detailed guide", page 197
var one = document.getElementById('one'); one.parentElement.getBoundingClientRect().right - this item works relative to the viewport. if you scroll the horizontal scroll bar, the values change. one.parentElement.getBoundingClientRect().right is "give me the distance from the left edge of the viewport to the right edge of the body" 

marginis10px... - Yuri