【问题标题】:moving the tables from one position to another with using css only仅使用 css 将表格从一个位置移动到另一个位置
【发布时间】:2012-07-21 15:39:24
【问题描述】:

这里有两张桌子

<div class="ex1">
<table>
<th> table1</th>
<tr>..</tr>
<tr>....</tr>
</table>
</div>
<div class="ex2">

<table>
<th>table2</th>
<tr>..</tr>
<tr>....</tr>
</table>
</div>

我为那些类写的css,我写的是

.ex1{
display: block;
position: relative;
margin: 0;
padding: 0;
border: 0px solid #CCC;
overflow: hidden;
clear: right;
height: 392px;
width: 630px;
}

.ex2{
display: block;
position: relative;
clear: right;
margin: 3px 0 0 0;
border: 1px solid #CCC;
padding-top: 0px;
color: #5A5655;
background-color: #F8F8F8;
text-align: left;
overflow: auto;
z-index: 88;
height: 50px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
width: 620x;
}

我想要的是当我编写上面的代码时,它可以很好地显示 2 个表,我想先显示 table2,然后我想只使用 css 显示 table1,而不用接触 html 代码.... 我该怎么做?谁能帮帮我...

【问题讨论】:

  • HTML 本身并不是真正的代码
  • @WilliamVanRensselaer 我认为我们可以同意不同意那个... :)
  • 你会使用 JavaScript 吗?使用 JS 在物理上切换这两个元素会非常容易(并且更可取)。
  • 你想从 css 创建表 1?
  • @Tieson 您的意思可能是 HTML 不是一种编程语言。尽管en.wikipedia.org/wiki/Code 它仍然是代码

标签: html css


【解决方案1】:

http://jsfiddle.net/Y3BMe/

position:absolute 用于带有top: 0 的第二个表,然后使用margin-top 属性向下移动第一个表

在您的真实示例中,它可能需要一些调整 - 请参阅 css positioning 寻求帮助

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-06-28
    • 2017-10-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多