dscojuxf69080 2015-05-28 11:28
浏览 56
已采纳

将2个div放在一起,使用相同的类

I have 2 divs which i cannot give different class names, due to them being the same but in a repeatable php code, which doesen't allow me to give them different class names. So i basically want to display them side by side. I have tried giving them a float left and relative position and a master div surrounding them with absolute position and other things like that, but to no avail.

HTML:

<div class="master"> 
<div class="second">1st</div>
<div class="second">2nd</div>
</div>

CSS currently applied:

.second{
    color:#FFF;
    width:300px;
    height: 10%;
    background-color:#69F;
    border-radius:25px;
    opacity: 0.7;
    filter: alpha(opacity=40);
    float:left;
}
.master{
width:960px;
padding-top:12%;
margin: 0 auto;
font-size:50px;
}
  • 写回答

5条回答 默认 最新

  • douhuocuo9012 2015-05-28 11:32
    关注
    <div class="master"> 
    <div class="second" style="float:left">1st</div>
    <div class="second">2nd</div>
    </div>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)

报告相同问题?

悬赏问题

  • ¥15 树莓派与pix飞控通信
  • ¥15 自动转发微信群信息到另外一个微信群
  • ¥15 outlook无法配置成功
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题