margin-right and left, margin, display:block/inline-block auto not working on div

I have a scenario in AEM which is on container level default AEM has the CSS of float: left which cannot be removed since the entire flow will be affected, but on the same div, I need to achieve max-width:1280px with center-aligned. The following code where the class container cannot be removed and I have to add an extra class for achieving it. The code I have tried so far.
Note: I cannot remove float property since its core component.
Any help will be appreciated !!

Unknown margin to the right

My div element containing an img element has an unknown large margin towards the right. I’ve set the margin-right property to 0px explicitly to no avail #pfpbg { padding: 5px; width: 20%; max-width: 20%; height: auto; margin-right: 0px; background-color: #1c1c1c; position: relative; box-sizing: border-box; left: 5%; } heres my entire code: I believe this … Read more

Why is there an unexplainable gap between these inline-block div elements?

I have two inline-block div elements, that are the same, positioned next to eachother. However there seems to be a mysterious space of 4 pixels between the two divs despite the margin being set to 0. There are no parent divs effecting them – What is going on? CSS #container { display:inline-block; position:relative; background:rgb(255,100,0); margin:0px; … Read more