html - 如何停止三列液体页面中的列换行?

标签 html css liquid-layout

几个星期以来,我一直在努力解决这个问题,但就是无法在调整浏览器大小时让这三列页面停止换行。我最近尝试使用百分比而不是像素作为边距,但这没有任何区别。

CSS代码在这里

#wrapper 
{ 
       background : #0066FF ;
       color : white ;
       height : 687px ;
       width : 100% ;
       max-width : 1620px ;
       font : 1.4em "Arial", sans-serif ;
       margin : auto ;
       border : 3px solid black ;
       border-top : none ;
       overflow : hidden ;
       position : relative
}

#header 
{ 
         height : 90px ;
         text-align : center ;
         color : black ; 
         background : #66CCFF ;
         margin : 100px auto 0 ;
         clear : both ;
         border : 3px solid black ; 
         border-bottom : 2px solid #0066FF ;
         width : 1620px 
}

#header h1 
{
        font-weight : bold ;
        font-size : 3em ;
        padding : 20px 0   
}



p.paragraphs 
{
        margin : 0 12px 0
}


#left 
{ 
        float : left ;
        width : 15% ;
        min-width : 180px ;
        height : 660px ;
        background-color : #66CCFF ;
        padding : 5px ;
        margin-right : 1.5% ;
        position : relative
}

#content 
{ 
     float : left ;
     background-color : #66CCFF ; 
     color : black ;
     height : 660px ; 
     width : 60% ;
     max-width : 1140px ;
     margin-right : 1.5% ;
     padding : 5px ;
     overflow : auto
}


#right 
{ 
       float : right ;
       position : relative ;
       background-color : #66CCFF ;
       color : black ;
       width : 20% ;
       min-width : 220px ;
       height : 660px ;
       padding : 5px 
}

#right p { margin-top : 20px }

我做了一个JS Fiddle此处显示 HTML。如果展开页面,您将看到列如何并排 float 然后随着浏览器缩小而换行。

最佳答案

您不能在列上设置最小宽度,因为您的包装器没有最小宽度。此外,您应该添加 *{box-sizing: border-box},因为您使用的是百分比宽度而不考虑填充和边距。您还应该清除页脚前的 float 。 fiddle :https://jsfiddle.net/88wbhv9y/2/

关于html - 如何停止三列液体页面中的列换行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31882823/

相关文章:

javascript - 碎片化的 MP4 不显示在 Chrome 中

javascript - 使用 JQuery 删除动态创建的 Div 时出现问题

javascript - 在 Electron 中加载 url 时添加返回按钮

CSS容器div没有得到高度

android - 为 Android 创建单个弹性/液体布局屏幕

CSS 导航栏未出现

javascript - 无法从弹出窗口访问网页 DOM; console.logs不显示

html - Iframe 在 Firefox 和 IE 中不工作

javascript - Material-ui ToolbarTitle 失去了它的字体系列

jquery - 使用 jQuery 更改小屏幕的 CSS 规则