English 中文(简体)
外传的高度没有根据内传的声响和元素变化
原标题:Height of the outside div is not changing according to inside divs and elements
  • 时间:2012-05-21 23:57:13
  •  标签:
  • css

我有一个 Div( main content) 。 这些 div( main container) 位于 aspx 页面中, 我内部 div( mainer div) 内部有许多 asp. net 控制 。 但有趣的是, 网站看起来是这样的 。

""https://i.sstatic.net/omahx.jpg" alt="此处输入图像描述"/ >

https://i.sstatic.net/omahx.jpg" rel=“不跟随 nofollow noreferrer>>https://i.static.net/omahx.jpg

白色部分( maincontent) 应根据里面的精灵调整大小。 但是它的高度显示为 0px 。

这是主内容和容器的 cs;

#container
{
background: #FFF;
width: 1000px;
height:auto;
margin-right: auto;
margin-left: auto;
border-right: 2px solid #B0AA94;
border-left: 2px solid #B0AA94;
border-bottom: 2px solid #B0AA94;
border-radius: 0px 10px 0px 10px;
}

#maincontent
{
height: auto;
font-family: Trebuchet MS;
font-size: 10px;
color: Black;
margin-left: 30px;
margin-top: 40px;
}

我错过了什么?

最佳回答

您很可能在这些容器内有很多浮动元素。 您需要清除这些元素。 您可以将容器的溢出属性设置为“ 自动” 或“ 隐藏” 来清除浮动元素 。

小问题:http://jsfiddle.net/JyAMb/"rel="nofolp">http://jsfiddle.net/JyAMb/

问题回答

浮动 div 将它从元素的正常流中移除 。 添加 < code@ lt; div 样式="\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

Drop down background url in Safari Issue

selectBox.selectCSS { background: url(/Images/replacementSelectBackground.png) top left no-repeat height:auto; } I have an issue in Safari only where the image is not rendering on top ...

CSS specific for Safari

How do you target specifically safari in css with styles?

Aligning textarea in a form

Ive used the following css code to align my form elements: form { position:relative; } form input { position:absolute; left:11em; } However, the textarea element is not aligned correctly with the ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

CSS problem with page footer

I have defined my page footer in the css file as: #footer { position: absolute; height: 50px; text-align: center; background: #66CCCC; bottom: 0px; left: 0px; width: 100%; height: ...

热门标签