css - 在 CSS 中移动第一个 Div 出现在第二个下面

标签 css

我的 html 代码如下所示:

包装 div(百分比宽度,向左浮动)包含:

  1. 一个包含文本和链接的 div;
  2. 一个包含图像的 Div;

问题: 我想保持上面的编码顺序,但为了用户体验,我想使用 CSS 反转 div 顺序以获得如下内容:

注意:包装 div 占 20%,向左浮动,然后是该页面上其他 4 个类似的 div。

Inverse the order of the divs with CSS

是的!

这是 fiddle 链接:

http://jsfiddle.net/sexywebteacher/4sbQf/

最佳答案

http://jsfiddle.net/QGyNN/

HTML

<div id="wrapper">
    <div id="txt">
    </div>
    <div id="img">
    </div>
</div>​

CSS

div#wrapper
{
    height:100px;
    width:60px;
    border:1px solid black;
    position:relative;
}
div#txt, div#img
{
    position:absolute;
    margin: 5px;
    width:50px;
}
div#img
{
    top:0px;
    height: 60px;
    border:1px solid red;
}
div#txt
{
    bottom:0px;
    height:20px;
    border:1px solid green;
}​

关于css - 在 CSS 中移动第一个 Div 出现在第二个下面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10412896/

相关文章:

html - 背景 : fixed; disappearing on scroll in chrome

javascript - 粒子js隐藏它下面的网页元素

html - Firefox 对 "display:table-cell; vertical-align:bottom;"的理解不同

html - Django Allauth - 如何将自定义 css 类添加到字段?

css - 列表项菜单中的图像上的文字

css - FF 在 :after element (CSS) 上应用随机字体大小

html - Chrome、IE6 和 Firefox 中 HTML 链接图像底部的额外填充

css - 当由 IIS 提供服务时,Fontawesome 不起作用

javascript - applet 上的 div 标签

css - 覆盖媒体查询中的重要规则集? !不重要?