CSS Text Bottom Margin Ignored

后端 未结 3 1262
盖世英雄少女心
盖世英雄少女心 2021-01-19 19:04

Ok, I hope this isn\'t a simple oversight but I have been working on this for hours!

I have a fairly complex HTML / CSS structure on a page I\'m working with. I have

相关标签:
3条回答
  • 2021-01-19 19:40

    Add overflow: hidden to #SubmissionDetails to fix the margin problem by preventing the behaviour of collapsing margins on that div.

    Add a doctype as the very first line to escape Quirks Mode and fix your page in Internet Explorer:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    

    (You could also use the much shorter <!DOCTYPE html>, I just stuck with what you had)

    Making this change will also improve things in other browsers (that is, it will improve the consistency).

    0 讨论(0)
  • 2021-01-19 19:53

    Use padding instead. The margin is there, it's just that margin does not fill in the background (which is why it looks like there is no separation.) It's there, it's just not visible.

    element.style {
        padding-bottom: 10px; /* change the margin property to padding */
        font-size: .9em;
        font-style: italic;
    }
    
    0 讨论(0)
  • 2021-01-19 20:05

    In your example, the div which contains the markup for the thoughts - which currently has no class assiciated with it add the following:

    height: auto; overflow: hidden;
    
    0 讨论(0)
提交回复
热议问题