如何将身高调整为身高 [英] How to fit height of aside to body height

查看:48
本文介绍了如何将身高调整为身高的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  1. 我需要使aside的高度适合身体的高度,而不考虑其中有多少内容.因为它给了我无花果.2,我需要有图1.

  1. i need to fit the height of aside to that of body without regard to how much content there is. As it is it gives me fig. 2 and i need to have figure 1.

我还需要使页脚适合身体的高度. position:absolute 确实适合,但会覆盖将body元素居中的 margin:auto .如何对齐div元素
HTML代码:

I also need to have footer fit inside of body height. position:absolute does fit but overrides margin:auto which centers the body element. How do i align div elements
Html code:

< html>< body>
< header></header>
< aside></aside>
< footer></footer>
</body></html>

我的css代码是这样的:

My css code is this:

  body{ width:920px;
    position:absolute;
    height:auto; }
aside { float:left;
    width:170px; }

 footer { float: right;
     background: #E7DBD3;
     clear:both; }

推荐答案

您应该能够设置aside的顶部和底部值.像这样:

You should be able to set the top and bottom values of the aside. Something like:

aside { 
  position: relative;
  float:left;
  width:170px; 
  top: 0px;
  bottom: 0px;
}

这篇关于如何将身高调整为身高的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆