dsn5510 2014-07-04 22:35
浏览 33
已采纳

如何使div成为另一个

Hello i'm creating a pagination script , i already done everything and now i'm trying to make the index page , it will contain the data retrieved from the database and i wanted to be represented on the form of 2 divs the first for the thumbnail and the other will contain the title under the thumbnail. So here is my code : here is the looping it's ok for it i just want you to see the html code inside.

$brk_cnt = 0;

while($row = mysqli_fetch_array($results))
{
 echo ' <td>
        <div class="datamore">'.$row['thumbnail'].'</div><div class="data1r1">$row['title']</div>
        </td>';

 //break or print <tr> condition
 if(++$brk_cnt % 4 == 0)
 {
    echo '</tr><tr>';
 }
}


echo '</table>';

and the css :

.data1r1 {
width:198px;
height:235px;
background-color:#4D72B7;
border-radius:5px;
/* border shits */
border:1px;
border-color:black;
border-style:solid;
border-radius:5px;
clear:both;

}
.datamore {
width:198px;
height:150px;
background-color:#C7441A;
position:absolute;
border-radius:5px;
clear:both;
}
#table {
    margin-left:250px;
    margin-top:20px;
    position:absolute;
}

I though i'm using the proper css at first but when printing data it's not a good result here is how the divs looks like :

divs http://img11.hostingpics.net/pics/949037test.png

the 2 divs are supperposed the one on the other .. i want to get the blue one under the orange one. Thanks sorry for this long description but i wanted to make things clear.

  • 写回答

2条回答 默认 最新

  • drgd73844 2014-07-04 22:44
    关注

    remove the position:absolute

    .datamore {
     width:198px;
     height:150px;
     background-color:#C7441A;
    
     border-radius:5px;
     clear:both;
    }
    

    Example

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度