Height of outer div not expanding with inner div

后端 未结 5 1901
遇见更好的自我
遇见更好的自我 2020-12-30 03:52

I have a bodyMain div of 100% width. Inside it is a body div 800px with auto margin(can I use \'body\' as id ?). Inside this are two divs bodyLeft and bodyRight 200px and 60

5条回答
  •  孤城傲影
    2020-12-30 04:16

    To avoid confusion with predefined tag names, refrain from using body, html, or head as ID attribute values.

    I agree with Muhammed Irfan's idea. I don't agree with his method though. Avoid inline styling except for small snippets. Especially in this case, because it is likely that there will be another case where clear: both is necessary. So, add a div, give it a meaningful class name and apply the additional CSS.

    See this fiddle for an example.

提交回复
热议问题