Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
您将如何设计此html的样式,以便将所有内容都放在一个表中?_Html_Css_Positioning_Css Tables - Fatal编程技术网

您将如何设计此html的样式,以便将所有内容都放在一个表中?

您将如何设计此html的样式,以便将所有内容都放在一个表中?,html,css,positioning,css-tables,Html,Css,Positioning,Css Tables,如何将以下html放入一个类似于表格的结构中,其中每个div.comment\u列水平排列在一起?我更喜欢使用CSS而不是表格: <div class="comments_div"> <div class="comment_column"> <div id="comment_title_23" class="comment_title"> What do you think of the lyrics?

如何将以下html放入一个类似于表格的结构中,其中每个
div.comment\u列
水平排列在一起?我更喜欢使用CSS而不是表格:

<div class="comments_div">

    <div class="comment_column">
        <div id="comment_title_23" class="comment_title">
            What do you think of the lyrics?
            <a href="/comment_titles/23" class="comment_title_delete" data-method="delete" data-remote="true" rel="nofollow">x</a>
        </div>
        <div class="comment" id="comment_4">
             Great lyrics!
        </div>
    </div>

    <div class="comment_column">
        <div id="comment_title_25" class="comment_title">
            What should my next song be?
            <a href="/comment_titles/25" class="comment_title_delete" data-method="delete" data-remote="true" rel="nofollow">x</a>
        </div>
        <div class="comment" id="comment_4">
             Nice job! Do a another song next.
        </div>
    </div>

    <div class="comment_column">
        <div id="comment_title_26" class="comment_title">
            Feedback
            <a href="/comment_titles/26" class="comment_title_delete" data-method="delete" data-remote="true" rel="nofollow">x</a>
        </div>
        <div class="comment" id="comment_4">
             Awesome stuff... next time rap a little more than sing but still great job.
        </div>   
    </div>

</div>

你觉得歌词怎么样?
很棒的歌词!
我的下一首歌应该是什么?
干得好!接下来再唱一首歌。
反馈
很棒的东西。。。下一次说唱会比唱歌多一点,但还是很棒的工作。

将这些添加到css中:

.clearfix:after {
    content: ".";
    display: block;
    clear: both;
    visibility: hidden;
    line-height: 0;
    height: 0;
}

.clearfix {
    display: inline-block;
}

html[xmlns] .clearfix {
    display: block;
}

* html .clearfix {
    height: 1%;
}

.comment_colum {
    float: left;
    /* width: 200px; <-- can set a width here */
}
.clearfix:after{
内容:“.”;
显示:块;
明确:两者皆有;
可见性:隐藏;
线高:0;
身高:0;
}
.clearfix{
显示:内联块;
}
html[xmlns].clearfix{
显示:块;
}
*html.clearfix{
身高:1%;
}
.评论{
浮动:左;

/*宽度:200px;如果您希望它看起来像一个表,这通常表明您的内容属于表中的内容类型。moe提供了一个绕过表的很好的解决方案。那么为什么要使用表呢?如果表中的数据是表中的数据,那么表可以更容易访问。表对于表格式数据仍然非常有用。我们只是不要再在页面布局中使用它们了。太棒了!唯一的问题是
comment
保持在
comment\u title
的同一行。我希望它位于它下面的下一行。我该如何实现这一点?我需要查看您的css,但尝试将其添加到css
。comment\u column.comment{clear:tware;}
实际上还有一件事……如果整个“表”的宽度足够短,它似乎与上面的元素(注释表单)保持在同一行。我在表单和表上都有
显示:block;清除:两者;
。我还应该做什么?
注释{width:100%;
?并确保没有浮动“表单”
<div class="comments_div">
<div class="comments_div clearfix">