我正在尋找一種方法來包裝文本填充div div圍繞另一個div。 Like this.如何在另一個div上包含包含文本的div?
看來我可能錯過了一個重要的細節。文字需要包裹嵌入的YouTube視頻。這似乎不適用於你提供的所有答案,我已經嘗試了所有給出的例子,一旦我嵌入視頻,文本消失。
我正在尋找一種方法來包裝文本填充div div圍繞另一個div。 Like this.如何在另一個div上包含包含文本的div?
看來我可能錯過了一個重要的細節。文字需要包裹嵌入的YouTube視頻。這似乎不適用於你提供的所有答案,我已經嘗試了所有給出的例子,一旦我嵌入視頻,文本消失。
將兩個div都包裝在'容器'div中,並給'div1'使用float
作爲樣式。這會給你想要的結果。請參閱下面的代碼。
<div class="container">
<div class="div1" style="float:left; width: 150px; height: 150px; margin: 10px; background-color: #ff0000;"></div>
<div class="div2">Wrapping text comes here.</div>
</div>
你可以把DIV 1 DIV 2
例
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Div Test</title>
<style>
.outer {
width:800px;
height:600px;
background-color:#22e;
}
.inner {
width:300px;
height:200px;
background-color:#e22;
}
</style>
</head>
<body>
<div class="outer">
<div class="inner">
</div>
</div>
</body>
</html>
裏面你可以嘗試這樣的事情。 div
裏面有一個div
具有保證金和浮動屬性。
您可以使用float: left
,然後.content
會,如果它在DOM未來把它包
.wrapper {
border: 1px solid blue;
}
.left {
float: left;
width: 100px;
height: 100px;
background: red;
margin: 0 10px 10px 0;
}
<div class="wrapper">
<div class="left"></div>
<div class="content">
The English word world comes from the Old English weorold (-uld), weorld, worold (-uld, -eld), a compound of wer "man" and eld "age," which thus means roughly "Age of Man."[3] The Old English is a reflex of the Common Germanic *wira-alđiz, also reflected in Old Saxon werold, Old High German weralt, Old Frisian warld and Old Norse verǫld (whence the Icelandic veröld).[4]
The corresponding word in Latin is mundus, literally "clean, elegant", itself a loan translation of Greek cosmos "orderly arrangement." While the Germanic word thus reflects a mythological notion of a "domain of Man" (compare Midgard), presumably as opposed to the divine sphere on the one hand and the chthonic sphere of the underworld on the other, the Greco-Latin term expresses a notion of creation as an act of establishing order out of chaos.
'World' distinguishes the entire planet or population from any particular country or region: world affairs pertain not just to one place but to the whole world, and world history is a field of history that examines events from a global (rather than a national or a regional) perspective. Earth, on the other hand, refers to the planet as a physical entity, and distinguishes it from other planets and physical objects.
'World' distinguishes the entire planet or population from any particular country or region: world affairs pertain not just to one place but to the whole world, and world history is a field of history that examines events from a global (rather than a national or a regional) perspective. Earth, on the other hand, refers to the planet as a physical entity, and distinguishes it from other planets and physical objects.
</div>
</div>
看起來你只是想