为什么我不能在段落周围浮动div?

时间:2016-12-15 01:54:52

标签: html css

我不能为我的生活弄清楚如何使div文本在段落文本旁边!像这样: ........段落文本段文本div文本div文本........ 我希望div成为下一段,就像它们在一个文本中一样。请帮助我!!

HTML:

<p><a href="#">paragraph text</a>, <a href="#">paragraph text</a>, <a href="#">paragraph text</a>, <a href="#">paragraph text</a>, <a href="#">paragraph text</a>, <a href="#">paragraph text</a>, <a href="#">paragraph text</a>, <a href="#">paragraph text</a>, <a href="#">paragraph text</a>, <a href="#">paragraph text</a>, <a href="#">paragraph text</a>, <a href="#">paragraph text</a>, <a href="#">paragraph text</a>, <a href="#">paragraph text</a></p>

<div><a href="#">div text</a>, <a href="#">div text</a>, <a href="#">div text</a>, <a href="#">div text</a>, <a href="#">div text</a>, <a href="#">div text</a>, <a href="#">div text</a>, <a href="#">div text</a>, <a href="#">div text</a>, <a href="#">div text</a>, <a href="#">div text</a>, <a href="#">div text</a>, <a href="#">div text</a>, <a href="#">div text</a>,</div>

CSS:

p {float:left;}

http://jsfiddle.net/Lmk9s/519/

1 个答案:

答案 0 :(得分:5)

只需使用

 display = (
        <section>
            {
               if (this.state.content.length >0)
               {
                this.state.content.map((item, i) => {
                    return <CardRenderer addPacks={true} key={i} container={item}/>
                })
              }
            }
        </section>
    )

Updated fiddle