当前位置: 动力学知识库 > 问答 > 编程问答 >

html - How to make the 'content' div float to the right of 'subMenu' div?

问题描述:

I know this is very simple, but i've been struggling for a while and I just can't make it work. I thought someone here might be able to give me a quick answer.

I'm trying to make a div float and align with another div. I'm trying by changing the float and display css attributes but with no luck.

I've set up a jsFiddle: jsFiddle

Thanks in advance

网友答案:

Here: jsfiddle

I just changed the height of the div for the example to appear better but you can set it back to your heights for your site.

I'd set the margin-top on the whole container div so that you only define that property once instead of setting it for both the menu and the content separately: anytime you're defining a value twice, you should try to put a wrapper and define it only once.

网友答案:

Your code works well if the screen is wide enough. Only if it's not the #content gets pushed under the submenu. To fix that give your #container a width that can accomodate both - http://jsfiddle.net/zaRqz/11/

#container {
    width: 1040px;
    overflow: hidden;
}
分享给朋友:
您可能感兴趣的文章:
随机阅读: