locked
Image margin problem RRS feed

  • Question

  • User-1826049516 posted

    Hi,

    I overwrite browser defaults with margin and padding = 0 for all elements. I have some images lined up in a table cell and on page load the margin between them is ok, with margin-right. If I then clone some other images (jQuery) and appendto to this table cell, the cloned ones all have no right margin and a squashed right next to each other.

    If I full reload the page, everything looks fine even the cloned ones (I'm writing them out to a db as part of the clone). If I add .css( "margin-right", "4px" ) to the clone it looks good.

    I've been through CSS about 20 times and can't see anything obvious. This is an authenticated intranet so can't provide a link.

    Thursday, June 20, 2019 3:54 PM

Answers

  • User-1826049516 posted

    float: left on the images fixed it. Weird one though because if I doubled the CSS margin page load would be set to that, then cloned elements were only some of it!

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, June 20, 2019 4:05 PM