Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Layout in Chrome breaks on initial page load, corrects after reloaded?

Very strange problem: when my webpage loads for the first time, the layout is broken like so:

broken layout upon initial page load in chrome

If I refresh the browser, the layout is corrected and appears as it should:

layout displayed correctly if page is reloaded in chrome

Here are the styles which affect this portion of the layout:

#cart-container {
    background-color: #000000;
    width: 176px;
    height: 35px;
    float: right;
    margin-top: 74px;
}

I have no idea why this is happening and why it corrects if the page is reloaded. Anybody?

like image 849
max7 Avatar asked Jan 26 '26 21:01

max7


1 Answers

I discovered the issue: the element #cart-container had a class attached to it which set the position on it to relative. This combined with the float: right caused the issue.

To resolve it, I removed the class that assigned relative positioning, kept the float right and then adjusted the absolutely positioned elements containing both the text ("shopping cart") and the down arrow. All is good now.

like image 118
max7 Avatar answered Jan 28 '26 14:01

max7