html - 寻找 flex 的替代品

标签 html css flexbox

我正在使用 flex 对齐一个文本和一个 div 中的两个按钮。这是我的代码

#wrapper {
    background-color: gray;
    display: flex;
    padding-left: 90px;
    padding-right: 90px;
}
#left {
    padding-top: 33px;
    padding-bottom: 33px;
    flex: 0 0 65%;
    height: 80px;
    line-height: 44px;
}
#right {
    padding-top: 45px;
    padding-bottom: 45px;
    flex: 1;
}
#button1 {
    height: 70px; 
    width: 70px; 
    margin-right: 20px;
}
#button2 {
    height: 70px; 
    width: 70px;
}
    
<div id="wrapper">
    <div id="left">
        Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard.
    </div>
    <div id="right">
        <input type="button" value="More" id="button1">
        <input type="button" value="Ok" id="button2">
    </div>
</div>

这段代码在大多数浏览器上都能正常工作,但在其他一些浏览器上不支持 flex。是否有任何其他方法可用于实现相同的结果并创建横幅?

最佳答案

你可以在 css 中使用很多技术来达到相同的结果,我将向你展示一些例子:

使用行内 block 元素 https://codepen.io/joaoskr/pen/OaEdJz

使用向左浮动 https://codepen.io/joaoskr/pen/JeZxXX

使用表格对齐 https://codepen.io/joaoskr/pen/zMaewv

正如你所看到的,你有很多可能在不使用 flex 的情况下达到相同的结果,选择你认为更好的,希望它能帮助你!!

关于html - 寻找 flex 的替代品,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53478572/

相关文章:

css - 如何使用 css flexbox 布局日历而不让内容展开框?

javascript - 如何在 javascript/css 中制作移动背景

css - 位置 : absolute messes up a:hover

html - Flexbox - 显示 : flex - My contents appear in one line

javascript - 在 ExtJS 6 上动态更改样式

css - IE8 中使用中断词的表格呈现问题

html - 伪元素与 anchor 标记边框不对齐

html - 什么更快 : serving a static HTML file from the filesystem or from MemCache?

php - 使用 AJAX 发送数组的最佳策略

css - 在 IE8+ 上溢出隐藏和显示列表项