css - float div 布局不正确

标签 css asp.net-mvc asp.net-mvc-3 layout

我想像这样划分在默认 MVC3 布局中呈现的内容

<div id="main">
            <div id="left">
                @RenderBody()
            </div>    
             <div id="right">
             Feeds  here!
             </div>

        </div>

但它变成了这样 wrong layout 这是我修复的 CSS 中的部分内容

#main #left
{
    float:left; 
}

#main #right
{
    position:fixed;
    padding-right:50px;
    right:10px;
    text-align:left;
}

#main {
    padding: 30px 30px 15px 30px;
    background-color:Black;
    border-radius: 4px 0 0 0;
    -webkit-border-radius: 4px 0 0 0;
    -moz-border-radius: 4px 0 0 0;
    clear:both;    

    color:White;
}

最佳答案

如何交换 HTML 中左侧上方的右侧 div:

<div id="main">
    <div id="right">
        Feeds  here!
    </div>
    <div id="left">
        @RenderBody()
    </div>
</div>

然后是 css:

#main #left
{
}

#main #right
{
    float:right;
    padding-right:50px;
    right:10px;
    text-align:left;
}

关于css - float div 布局不正确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9342191/

相关文章:

jquery - 如何使用 jQuery 刷新 ASP.NET MVC UserControl?

c# - Autofac 使用 Assembly.Load 注册 dll

vb.net - 我可以在 @Using.BegingForm() 中渲染 @Section 吗?

css - 撤消 CSS 规范

asp.net-mvc - MVC : Override default ValidationMessage

css - 如何嵌套*位置: sticky* inside of mat-expansion-panel => css grid

asp.net-mvc - View 中出现意外的 NullReferenceException

asp.net-mvc-3 - ASP.NET MVC3 : How to get access to parameters passed as routeValues anonymous type in a HtmlHelper extension method?

html - 如何使按钮的中心点出现在中心,而不是元素的左侧?

css - 如何仅使用 css 更改文本中每个单词背后的背景?