css - 3 格 : one centered and the two others one in each side

标签 css layout responsive-design

我有这个标记:

<body>
 <div class="prevBtn"> <a> < </a> </div>
<div id="player"> some code </div>
<div class="nextBtn"> <a> > </a> </div>
</body>

我正在尝试获取此布局:

enter image description here 注意:上一个和下一个按钮靠近#player

我正在尝试这样:

            .nextBtn{
                 float:left;
                 width:15%;
                 margin-top:180px;
            }
            .nextBtn a{
                float:right;
            }
            .player{
               float:left;
             width:70%;
                 margin-top:100px;
            }
            .prevBtn{
                float:right;
                 width:15%;
                 margin-top:180px;

            }
            .rightBtn a{
                float:left;

            }

问题是如果分辨率太大或太小,它不会像布局一样,

对于任何分辨率,我怎样才能实现这一目标?

最佳答案

用一个 770px + 左右按钮宽度的 div 包围它(将它们的宽度从百分比更改为固定宽度)。

这将保证所有人都在一起。

还可以使用 overflow: hidden 或末尾带有 clear:both 的 div,这将确保一切就绪。

关于css - 3 格 : one centered and the two others one in each side,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7724576/

相关文章:

css - 适用于大屏幕的 Foundation 4 响应式网格布局

html - @-moz-document url-prefix() 不工作

css - 将 div 的宽度设置为封闭表格的宽度

javascript - 如何更改 Bootstrap 选项卡淡出速度?

xml - Magento 布局 XML 文件覆盖

html - 影响布局的未知边距

css - 在响应式布局中将文本与图像上的另一个文本右对齐

html - 更改 CSS 过渡的方向

android - 在 oncreate() 方法中调用布局更新失败

html - 向非响应式网站添加响应式背景图片