如何在css中使用float创建表格布局 [英] how to create a table layout with float in css

查看:103
本文介绍了如何在css中使用float创建表格布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在外部div中创建3个div。外部div为72%。具有第一,第二,第三类的三个内部跨度应为24%。

I want to create 3 divs inside outer div.The outer div is 72%.The three inner span with classes first,second,third should be 24%.

   <div id="outer">
   <div id="inner">
      <div class="content">
      <span class="first">
      HELLO
      </span>
      </div>

    <div class="content">
      <span class="second">
      pRERNA
          </span>
      </div>

   <div class="content">
      <span class="third">
      gOLANI
       </span>
    </div>


css

#inner
   {
      width:72%;   
   }

    div.content span.first
    {
        display:block;
        float:left;
        width:33%;

    }
    div.content span.second
    {
        clear:left;
        display:block;
        float:right;
        width:33%;

    }

我想借助 float 属性css

推荐答案

我会摆脱跨度并给第一个第二和第三个div一个类的content然后在你的css中: .content {float:left; }

I would get rid of the spans and give the first second and third divs a class of "content" and then in your css put: .content { float: left; }.

这篇关于如何在css中使用float创建表格布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆