css– 我需要帮助让我的内容div容器包裹两个内部div!

css– 我需要帮助让我的内容div容器包裹两个内部div!,第1张

概述我正在学习如何使用div作为我制作的布局,我可能有错误的方法,但到目前为止我所尝试的并没有奏效.所以我花了最近2个小时谷歌搜索和测试各种代码,但我似乎无法做到正确.这是我的css:@charset 'UTF-8'; /* CSS Document */ * { margin: 0; } html{ height: 100%; } body { backgr

我正在学习如何使用div作为我制作的布局,我可能有错误的方法,但到目前为止我所尝试的并没有奏效.所以我花了最近2个小时谷歌搜索和测试各种代码,但我似乎无法做到正确.

这是我的CSS:

@charset "UTF-8";/* CSS document */* {margin: 0;}HTML{height: 100%;}body {background-color: #FFF;background-image: url(images/bckgndPattern.gif);background-repeat: repeat;height:100%;}h2 {color:#cccccc;letter-spacing:4px;}#container_shadow {background-image: url(images/containerShadow.png);background-repeat: repeat-y;height: 100%;wIDth: 920px;margin-right: auto;margin-left: auto;}#container {height: 100%;wIDth: 900px;margin-right: auto;margin-left: auto;background-color: #FFF;}#navbar_shadow_top {background-color: #FFF;height: 10px;wIDth: 888px;}#navbar {background-color: #FFF;height: 50px;wIDth: 888px;}#navbar_shadow_bot {background-color: #FFF;height: 10px;wIDth: 888px;}#container_inner {height: 100%;wIDth: 888px;margin-right: auto;margin-left: auto;background-color: #FFF;border-right-wIDth: medium;border-left-wIDth: medium;border-top-style: none;border-right-style: dashed;border-bottom-style: none;border-left-style: dashed;border-top-color: #c8c8c8;border-right-color: #c8c8c8;border-bottom-color: #c8c8c8;border-left-color: #c8c8c8;}#banner {height: 140px;wIDth: 888px;}#content {background-color: #FFF;height:auto;wIDth: 888px;}#slIDe {background-color: #FFF;height: 200px;wIDth: 700px;position: relative;left: 132px;top: 40px;}.main {background-color:#FFF;wIDth: 590px;min-height: 200px;position:relative;top: 280px;left: 60px;clear:both;}

我的问题是当我用类main创建一个div.内容div不包围div.main.幻灯片div在内容div中似乎没问题.

截至目前,我很确定我的divs嵌套在正确的位置.

这就是我想要实现的目标:

---------------------------------------                                    --        -----------------------     --        -     SLIDE           -     --        -                     -     --        -----------------------     --                                    --    -------------------             --    -    MAIN         -             --    -                 -             --    -------------------             ---------------------------------------

这是项目的链接:Test最佳答案浮动元素时,将其从文档流中取出.因此,父容器不再包含元素.强制父容器包含浮动子项的选项:

1)给容器一个溢出属性:

#container { overflow: auto }

2)同时浮动容器:

#container { float: left }

3)添加第3个子元素,清除前两个浮点数:

.clearingElement { clear: both }
总结

以上是内存溢出为你收集整理的css – 我需要帮助让我的内容div容器包裹两个内部div!全部内容,希望文章能够帮你解决css – 我需要帮助让我的内容div容器包裹两个内部div!所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1120140.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-29
下一篇 2022-05-29

发表评论

登录后才能评论

评论列表(0条)

保存