2016-03-17 5 views
2

Я ищу способ обернуть текст, заполненный div вокруг другого div. Like this.Как обернуть div, содержащий текст вокруг другого div?

Кажется, что я, возможно, пропустил важную деталь. Текст должен обернуться вокруг встроенного видео YouTube. Кажется, что это не работает со всеми ответами, которые вы предоставили, я пробовал все приведенные примеры, и как только я вставляю видео, текст исчезает.

+0

выглядит как вы просто хотите

где Css .litle {поплавок :оставил;} – Seichi

ответ

1

Оберните оба divs в 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> 
1

Вы можете разместить 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> 
2

Вы можете использовать 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>

Смежные вопросы