如何在CSS中使用mainarea调整侧边栏的高度 [英] How can I adjust the height of sidebar with mainarea in CSS
问题描述
我制作了一个html页面.页面的宽度为1000像素.我用侧边栏和主区域来布局页面.
两者的CSS样式如下;
I have made an html page. The Width of the page is 1000px. I layout the page with a sidebar and a mainarea.
the CSS Style for both is as under;
#sidebar
{
width:300px;
background-color:#000;
float:left;
}
#mainarea
{
width:700px;
background-color:#C30;
float:left;
}
我不知道主要区域需要多少高度,因为主要区域的内容将动态生成.
我的问题是,如何确保侧边栏的高度必须与主区域的高度相同.
我的意思是我想要侧边栏和主区域一样长.希望您理解我的观点.
I don''t know how much height will require for the mainarea, because the contents of the mainarea will be generated dynamically.
My Question is how I can ensure that the sidebar height must end up with the mainarea height.
I mean I want the sidebar as long, as the mainarea. I hope you have understood my point.
推荐答案
使用此CSS,您可以根据需要更改边距
use this css you can change margin as per your requirement
#sidebar
{
width:300px;
background-color:#000;
float:left;
height : auto;
}
#mainarea
{
width:700px;
background-color:#C30;
float:left;
margin:10px;
}
如果您喜欢这个,那么请多加赞赏,并始终以您的知识帮助他人.
if you like this than pls appreciate and always help others from your knowledge.
这篇关于如何在CSS中使用mainarea调整侧边栏的高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!