Background colour of <div> containing <ul>

This question already has an answer here:

  • How do you keep parents of floated elements from collapsing? [duplicate] 16 answers

  • This should work: <div style="background-color: #302683; overflow: hidden;">

    See the example: http://jsfiddle.net/b8q836zs/1/

    Overflow: hidden|auto will make an element establish a 'new block formatting context' — an isolated container, which will keep it from flowing into the space occupied by preceiding floats — see: CSS 2.1 - floats.

    链接地址: http://www.djcxy.com/p/88428.html

    上一篇: 根据2个孩子<div>设置父母<div>的边框

    下一篇: 包含<ul>的<div>的背景颜色