簡體   English   中英

如何在div周圍包裝文本?

[英]How to wrap text around a div?

我的coinlider周圍有一個容器div。 我想在這個容器div周圍包裝文本。 如何實現這一目標?

現在我的HTML設置如下:

<p> <!-- LOTS OF TEXT --> </p>
<div id="mycontainer"> <!-- coinslider inside --></div>

我的CSS設置如下:

#mycontainer {
position: relative;
float: right;
width: 500;
height: 334;
}

 <div> <div style="float:left; width: 150px; height: 150px; margin: 10px; background-color: #ff0000;"> <!--your image or text--> </div> <p>But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?</p> <p>But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?</p> </div> 

在另一個div中包含你Div並給它浮動屬性......

<div id="main">
    <div id="mycontainer"> <!-- coinslider inside --></div>
</div>
<p> <!-- LOTS OF TEXT --> </p>

#main
{
    float:right;
}
#mycontainer 
{
    width: 500px;
    height: 334px;
    background-color:  gold;
}

檢查小提琴

要么

P應該在Div之后

   <div id="mycontainer"> <!-- coinslider inside --></div>

    <p> <!-- LOTS OF TEXT --> </p>

#mycontainer 
{
    float:right;
    width: 500px;
    height: 334px;
    background-color:  gold;
}

**

小提琴

**

將此添加到您的CSS,你應該是好的:

display: block;
<div id="mycontainer"> <!-- coinslider inside --><p> <!-- LOTS OF TEXT --> </p></div>

你的文本需要進入div容器。 希望有效。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM